How can I add a grid line and value at end of a chart?

17 views
Skip to first unread message

Steve Morris

unread,
Jul 25, 2016, 4:03:15 AM7/25/16
to Google Visualization API
My application shows a stacked column chart where the x-axis is a time window. The user can change the width of the time window but it always starts and ends on the hour.
The problem is that If the number of hours is not an even number, there is no grid line at the end of the chart, as shown below. I handle this if the window <= 12 hours by setting hAxis.gridlines.count so that there is a grid line every hour. However, that becomes too crowded when the window is more than 12 hours.
An additional problem is that, even if there is a grid line at the end of the chart, the graph does not show the value.

Is there a way to always show a line at the end of the chart and to show the value?

Daniel LaLiberte

unread,
Jul 25, 2016, 9:51:36 AM7/25/16
to Google Visualization API
Situations in which the chart area is not bounded by gridlines is considered less important than other criteria, though it does try.  If you specify a viewWindow min and max value, they will be used as hard constraints on the boundary, and then if the correct number of equally-spaced gridlines fall on the bounds you set, you will get those gridlines.  The count is a slightly less hard constraint, since it will be sacrificed (usually + or - one) if the resulting gridlines don't fall on nice-enough values.  

You can also specify exactly the tick values you want for where the gridlines should go, using the 'ticks' option.  

Hope this helps you get a result you are happy with.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/d0ff3f8b-74ab-4675-b809-0f32f2e5fd1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages