I have this timeline chart for shipments and I would like to add a vertical line indicating the current date for reference. Is this possible?
There two ways to do this are a workaround here and a more 'robust' approach here. In this case I think you would need to use the first approach and get the current date using the now() function in a table calculation.
Does this for timeline charts as well as line charts?
I think it will work for Cartesian charts - bar charts, column charts etc. - so if your timeline is the X axis on one of those it should work.
Hi,
The first method does not work for my Gantt chart, I suspect it is because my date dimension is assigned to the Y-axis in the config.
I am trying the second method by referencing a currrent_date dimension, but the reference line only aligns itself to the vertical axis. This is the code I am using, would you please let me know if I am doing it incorrectly?
yAxis: {
plotBands: [{
to: 'value = transit.current_date',
from: 'value = transit.current_date',
label: {
text: 'Today'
}
}]
}
I'm not very knowledgeable about Highcharts JSONs unfortunately - but LLMs are...if you have access to Gemini or ChatGPT or any other LLM, you can paste in part or all of your code and ask it to troubleshoot it for you.
I use the first method to plot bands for weekends (using the 'Day of Week Index' date dimension in a table calculation to identify weekend days e.g. if(${history.created_day_of_week_index}=5 OR ${history.created_day_of_week_index}=6,max(${history.query_run_count}),0)).
If you want to plot bands over consecutive days, then there will be a gap between each bar. You can remove the gap in the Chart Config Editor:
series: [{
pointPadding: 0,
}, {
pointPadding: -0.1,
}],
Question: can you reference today's day / relative dates in the Chart Config Editor? I would love to insert a plot band based on a relative date(s), rather than having to hard-code Unix values, which is of limited use.
Unfortunately I don't think you can reference today's date in the chart config editor - one thing that might be worth trying though is to have a column in your result set that just returns today's date, and try to reference that value in the Chart Config as that series should be available.
Yes, you can achieve it using table calculations. I just wanted to know if it could be done exclusively in the Chart Config Editor, as I could then save it as a template and reuse it.