I just started playing with this yesterday and have run into a problem
I just cannot seem to get by.
Using the sample code for gauges I can display the gauges fine. When I
get the data from a csv file, no gauges are displayed. However if I
change to display a table, it displays just fine. The csv file looks
like this:
Label,Value
Memory,80
CPU,55
Network,68
This does work:
// var data = response.getDataTable();
var data = new google.visualization.DataTable();
data.addColumn('string', 'Label');
data.addColumn('number', 'Value');
data.addRows(3);
data.setValue(0, 0, 'Memory');// data.setValue(0, 1,
80);
data.setValue(1, 0, 'CPU');// data.setValue(1, 1,
55);
data.setValue(2, 0, 'Network');
data.setValue(2, 1, 68);
var chart = new google.visualization.Gauge
(document.getElementById('char
t_div'));
chart.draw(data, null);
This does not work:
var data = response.getDataTable();
// var data = new google.visualization.DataTable();
// data.addColumn('string', 'Label');
// data.addColumn('number', 'Value');
// data.addRows(3);
// data.setValue(0, 0, 'Memory');// data.setValue(0,
1, 80);
// data.setValue(1, 0, 'CPU');// data.setValue(1, 1,
55);
// data.setValue(2, 0, 'Network');
// data.setValue(2, 1, 68);
var chart = new google.visualization.Gauge
(document.getElementById('char
t_div'));
chart.draw(data, null);
Yet --- Exactly the same code, but changing to a table does work:
var data = response.getDataTable();
// var data = new google.visualization.DataTable();
// data.addColumn('string', 'Label');
// data.addColumn('number', 'Value');
// data.addRows(3);
// data.setValue(0, 0, 'Memory');// data.setValue(0,
1, 80);
// data.setValue(1, 0, 'CPU');// data.setValue(1, 1,
55);
// data.setValue(2, 0, 'Network');
// data.setValue(2, 1, 68);
var chart = new google.visualization.Table
(document.getElementById('char
t_div'));
chart.draw(data, null);
Any ideas or suggestions?
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.