Google chart: is it possible to use rows for the x axis?

So I tried to combine with my charts and noticed that the integers / float / date work fine for the x axis, but the moment you insert a line, it explodes.

I am trying to build a graph: a Word / Count graph, but unfortunately I can’t put the rows on the x axis. Is it allowed on Google Charts, or is it strictly int / floats / date?

+4
source share
2 answers

use the vAxis and hAxis property as shown below

google.visualization.ColumnChart(document.getElementById('visualization')).
  draw(data,
       {title:"Yearly Coffee Consumption by Country",
        width:600, height:400,
        vAxis: {title: "Year",ticks: [{v:100, f:"100$"},{v:150, f:"150$"},{v:200, f:"200$"},{v:300, f:"300$"}]},
        hAxis: {title: "Cups",ticks: [{v:4, f:"3-4"},{v:8, f:"5-9"},{v:10, f:"9-13"},{v:14, f:"13-14"},{v:20, f:"15-20"}]} }
  );

For more details see How to get vaxis row in google api chart column?

+2
source

, string, . , .

var data = new google.visualization.DataTable();
        data.addColumn('string', 'Month');
        data.addColumn('number', 'Sales');
        data.addRows([
        ['Jan', 1],
        ['Feb', 5],
        ['Mar', 2],
        ['Apr', 3]
    ]);

, string, number, float, date. - x, ticks jsfiddle : http://jsfiddle.net/j29Pt/417/

+4

All Articles