Line Chart

96 views
Skip to first unread message

Asrar Hussain

unread,
Feb 7, 2013, 1:32:12 PM2/7/13
to google-visua...@googlegroups.com
Hi All,

I am working with the LineChart api, I can't get the x axis to show all the days in the month.  i.e.1,2,3 etc) I bet the option is staring me in the face on this page but i just cannot find it https://developers.google.com/chart/interactive/docs/gallery/linechart

Any help greatly appreciated


Thanks




asgallant

unread,
Feb 7, 2013, 3:21:49 PM2/7/13
to google-visua...@googlegroups.com
This may or may not be possible, depending on a number of factors.  First of all, are you using strings, numbers, or Date objects for your x-axis values?  If you are using strings, then you have to set some combination of the hAxis suboptions slantedText, slantedTextAngle, maxAlternation, maxTextLines, minTextSpacing, and showTextEvery (documented in the LineChart options).  If you are using numbers, then you have to set the hAxis.gridlines.count option to the number of days you want to show (as each label corresponds to a gridline).  If you are using Date objects, you are out of luck for the time being, as the hAxis.gridlines.count option is broken in combination with Dates (see bug report here for more info).

In any case, if your chart isn't wide enough to draw the labels for all of your days, then you won't get all of them no matter what options you set (without changing the width, anyway).

Asrar Hussain

unread,
Feb 8, 2013, 4:28:20 AM2/8/13
to google-visua...@googlegroups.com
Hi,
I have date on my x axis, how annoying wasted 2 hours on that.   I guess the fix will be here this month or the next according to the bug updates.

Thanks for your help

Asrar Hussain

unread,
Feb 8, 2013, 5:52:47 AM2/8/13
to google-visua...@googlegroups.com
When i change the library package from corecharts to linecharts it shows me all the days?  The only problem I noticed then is you cant format the date to display specific fields it just takes the default.


On Thursday, February 7, 2013 8:21:49 PM UTC, asgallant wrote:

asgallant

unread,
Feb 8, 2013, 10:22:25 AM2/8/13
to google-visua...@googlegroups.com
The linechart package is deprecated and doesn't have anywhere near the fully list of features supported by LineCharts in the corechart package.  What you are seeing there is the effect of changing your data from a date type to a string type (as the old package treated all data types as if they were strings).

Asrar Hussain

unread,
Feb 8, 2013, 10:55:53 AM2/8/13
to google-visua...@googlegroups.com
Thanks for the reply, 
The linechart package is indeed rubbish compared to the corecharts but i couldn't find anywhere on the site that says it is deprecated.

Are there any cool examples available where the charts are integrated with  a java based back end, pulling the data directly from a database?

asgallant

unread,
Feb 8, 2013, 11:03:23 AM2/8/13
to google-visua...@googlegroups.com
I don't know of any examples for java back ends off the top of my head, but there is a java library for implementing a data source for the charts: https://developers.google.com/chart/interactive/docs/dev/dsl_about
Reply all
Reply to author
Forward
0 new messages