888ba8
Posts: 44
Joined: Mon Dec 21, 2020 11:18 am

How to get the line of the currentDateIndicator to run through the xAxis date labels as well?

I am moving the currentDateIndicator to the top of the chart, by using y-100

Code: Select all

currentDateIndicator: {
            label: {
                format: 'Today (%b %d, %Y)',
                y: -100, align: 'center',
            },
        },
        min: today.getTime() - (10 * day),
        max: today.getTime() + (45 * day), 
It works well for the text. However, the line itself is not of the right z-index I guess because it never shows above the other x label points (in this case they are dates).

See here in the screenshot the area in gray. Image There is no red line running through it, unfortunately.

I tried to find a workaround using plotLines but to no avail:

Code: Select all

plotLines: [{
          value: today.getTime() + (0 * day),
          width: 0,
          color: 'none',
          dashStyle: 'dash',
          margin: 0,
          label: {
            text: '|<br>|<br>',
            align: 'center',
            y: -10,
            x: 0,
          }
        }],
I hope I could just use the currentDateIndicator and tweak it a bit to run all the way to the top, where I placed its text?
pawelys
Posts: 962
Joined: Wed Sep 02, 2020 10:37 am

Re: How to get the line of the currentDateIndicator to run through the xAxis date labels as well?

Hi!
What you can do, is you can use the SVGRenderer class to draw any line that you want on the plotArea.
Check the API reference for a detailed explanation: https://api.highcharts.com/class-refere ... derer#rect

(you can use rect to draw vertical and horizontal lines, or path to draw any line, that you want)

Let me know if that works for you, and in case of any further questions feel free to contact us again!
Kind regards,
Paweł Lysy
Highcharts Developer

Return to “Highcharts Gantt”