The only way to do that would be to have the first column be type "string", and enter the numbers as strings, eg:
data.addColumn('string', 'Y');
data.addColumn('number', 'X');
data.addRows(6);
data.setCell(0, 0, 'zero');
...
This will make your axis into a discrete axis instead of a continuous axis, though (see the difference
here).
On Tuesday, October 16, 2012 2:13:39 PM UTC-4, NickMi wrote:
I spent hours to find answer for this question......
I have simple line graph (xy style):
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('number', 'Y');
data.addColumn('number', 'X');
data.addRows(6);
data.setCell(0, 0, 0);
data.setCell(0, 0, 1);
data.setCell(1, 0, 2);
data.setCell(1, 1, 2);
data.setCell(2, 0, 3);
data.setCell(2, 1, 3);
data.setCell(3, 0, 4);
data.setCell(3, 1, 4);
data.setCell(4, 0, 5);
data.setCell(4, 1, 5);
data.setCell(5, 0, 6);
data.setCell(5, 1, 6);
var options = {
title: 'Title'
};
var table = new google.visualization.LineChart(document.getElementById('chart_div'));
table.draw(data, options);
Well, labels under X-Axis is the actual numbers! I would to know how can I set my customs labels under X-Axis(example: Zero, One, Two, Four, but not 0, 1, 2, 4 ,5). By words, but not by arabic numbers. I hope someone will help me.