why ColumChart() cannot have date as Xaxis specifier

21 views
Skip to first unread message

geeohgeegeeoh

unread,
Apr 2, 2012, 10:25:22 PM4/2/12
to Google Visualization API
I don't dispute the behaviour of the ColumnChart() is exactly as
specified.

But, from an interest-only perspective: *WHY* is this chart style
unable to take date specifiers?

I am trying to understand how the codebase can process LineChart()
with date in column 0 but not ColumnChart()

I know "use the source luke" but if a google chart API person can say
succinctly "why this is so" ...

-G

MC Get Vizzy

unread,
Apr 3, 2012, 7:04:13 AM4/3/12
to google-visua...@googlegroups.com
I don't know, but it probably has something to do with the width of the bars/columns: since dates are not (necessarily) evenly spaced, it's unclear how the chart would choose a column width.  In some cases, columns might overlap.


-G

--
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.


asgallant

unread,
Apr 3, 2012, 9:23:43 AM4/3/12
to google-visua...@googlegroups.com
That, and if you had multiple series in a non-stacked Column chart, it would be difficult to (visually) tell the difference between data points which share the same date and those that are adjacent in time.  You can simulate a "date" axis on your own, though, by inserting rows with null data in them in between your actual data points.  You'll have to choose some level of granularity to represent the smallest measured unit of time in your data, and insert rows based on that.  For example, if you charted data for the month of March, on a daily basis, your DataTable might look like this:

var data new google.visualization.DataTable();
data.addColumn('string''Date');
data.addColumn('number''Foo');
data.addColumn('number''Bar');

data.addRows([
    ['3/1'73],
    ['3/2'nullnull],
    ['3/3'nullnull],
    ['3/4'48],
    ['3/5'29],
    ['3/6'67],
    ['3/7'nullnull],
    ['3/8'82],
    .
    .
    .
]); 
Reply all
Reply to author
Forward
0 new messages