Datetime formatting unpredictably breaks - area chart

471 views
Skip to first unread message

Allomorphy

unread,
Feb 26, 2012, 5:58:54 PM2/26/12
to google-visua...@googlegroups.com
Hi

I have the following column and row declarations on an area chart;

data.addColumn('datetime', 'Date and Times');
[new Date (2011,9,03,02,32),9.5,,....

I am puzzled as to why the formatting of the datetime sometimes
breaks from showing the full date and time like "Sep 9, 2011 12:00AM"
to just the time like: 12:00AM.

I did not change the data but just added some columns to the
chart and this broke. Sometimes it does break with different data
sets.

Is there anything that could help me find the source
of this error?

--
Eric

ChartALot

unread,
Feb 28, 2012, 1:10:59 PM2/28/12
to google-visua...@googlegroups.com
Hi,
Did you read the following:

Perhaps you intend to use discrete and not continues axis? 



--
Eric

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.


Jinji

unread,
Feb 29, 2012, 11:54:43 AM2/29/12
to google-visua...@googlegroups.com
Assuming your column of type 'datetime' is the first column, and the formatting you refer to is on the hAxis, then:
The chart automatically decided the formatting of the axis based on the granularity of the data (for example, if the data is day-based, the format contains the date and not the hour). In your case it's possible that the algorithm that computes the granularity got confused, but we can't be sure without see an example that reproduced the problem. Anyway, you can override the default granularity-based formatting using the hAxis.format option.

Allomorphy

unread,
Feb 29, 2012, 4:02:52 PM2/29/12
to google-visua...@googlegroups.com
Thanks Jinji

Here is an example of the issue:
http://jsfiddle.net/ericsmythe/geGAt/

I tried to implement your suggestion of the hAxis.format
to override this unwanted behavior but must be doing something wrong
as I have a syntax error.

Thanks for your help to solve this issue.

--
Eric

Jinji

unread,
Mar 1, 2012, 8:19:34 AM3/1/12
to google-visua...@googlegroups.com
When we say "hAxis.format", we mean "hAxis: {format: '...'}" (you already have hAxis options, so just add 'format' to the bunch.

asgallant

unread,
Mar 1, 2012, 9:50:27 AM3/1/12
to google-visua...@googlegroups.com
You needed to have 'format' as a property of hAxis, not have an 'hAxis.format' property of your options; see this: http://jsfiddle.net/vBDcP/
Reply all
Reply to author
Forward
0 new messages