Conditional gridline display

41 views
Skip to first unread message

nsharony

unread,
Jun 11, 2017, 3:21:17 AM6/11/17
to Chart.js User Discussion
Hi,

Does anyone know if it is possible to indicate that I want my line chart's x axis gridlines to be displayed on specific labels?
My x axis represents time in seconds. I would like to render a gridline that goes up from the x-axis upon every minute and not upon every tick.
Is this possible? 
According to my understanding, the gridline.display is a boolean attribute that will affect all the ticks.
Maybe there is some other way to achieve the desired look.

Thank you in advance.

Evert Timberg

unread,
Jun 11, 2017, 8:00:52 AM6/11/17
to nsharony, Chart.js User Discussion
Hey,

One way is to use the tick callback to return null, but that would hide the label too. Another option is to set the grid line colour as an array and then set it to 'transparent' where you want it hidden.

Neither of these are great, but they could get you what you want.

-Evert

--
You received this message because you are subscribed to the Google Groups "Chart.js User Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chartjs-user-disc...@googlegroups.com.
To post to this group, send email to chartjs-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chartjs-user-discussion/c863d836-11c8-4770-8e68-35bffc8c61a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

nsharony

unread,
Jun 11, 2017, 11:46:55 AM6/11/17
to Chart.js User Discussion
Thank you Evert.

The colors solution seems like the way to go in my case
Reply all
Reply to author
Forward
0 new messages