attaching chart-data to be ignored during rendering?

6 views
Skip to first unread message

manuel aldana

unread,
Jan 10, 2012, 11:31:15 AM1/10/12
to Google Visualization API
Hi,

I am rendering a typical time based column-chart (x-axis time, y-axis
count).

On server side I am rendering respective js-code:
===
var timeData = new google.visualization.DataTable();
timeData.addColumn('string', 'Details');
timeData.addColumn('number', 'Count');
// time info as weekdays
timeData.addRow(["Su",321]);
timeData.addRow(["Mo",12]);
timeData.addRow(["Tu",14]);


As I want to make zooming possible (clicking on a column would open
new request) I am attaching a callback:
===
google.visualization.events.addListener(chart, 'select',
function() {
window.location.href = "http://xxyy" + $("chart.getSelection()
[0].row).attr('href');
location.load();
);


In this case 'chart.getSelection()[0].row' is not accurate enough (I
only get weekday like 'Su', but I need '2012-01-01/12:00:00'. I tried
to get this done by adding a 3rd row 'timeData.addRow(["Su",
321,"2011-01-01/12:00:00"]);' but this causes graph rendering more
columns.

Is there a way to attach data to chart-data object, which is hidden
and not displayed on chart at all?

thanks.

manuel aldana

unread,
Jan 10, 2012, 11:38:17 AM1/10/12
to Google Visualization API
Posted a bit too early...

I see http://code.google.com/apis/chart/interactive/docs/reference.html#dateformatter
which allows dedicated formatting, I'll have a look whether it works
this way.

asgallant

unread,
Jan 10, 2012, 12:33:11 PM1/10/12
to google-visua...@googlegroups.com
You can include extra data in new columns and then hide them with a DataView:

Reply all
Reply to author
Forward
0 new messages