sorting - Google Charts is changing my data order -


i trying create simple google charts column chart using date string x-axis. when pass in ordered hash (or array) reason google charts re-orders data based on own interpretation of how sort.

example:

[["dec 27", 206.17], ["28", 411.09], ["29", 411.09], ["30", 411.09], ["31", 411.09], ["jan  1", 411.09], [" 2", 411.09], [" 3", 411.09], [" 4", 411.09], [" 5", 411.09], [" 6", 411.09], [" 7", 411.09]] 

given data, google chart displays:

x-axis example displayed google charts

has else run , solved this? there way tell google charts accept data order without re-sorting?

maybe share code, here column chart keeps sort same defined in array.

google.load('visualization', '1.1', {'packages':['corechart']});  google.setonloadcallback(drawchart);    function drawchart() {      var data = google.visualization.arraytodatatable([      ["date", "amount"],      ["dec 27", 206.17],      ["28", 411.09],      ["29", 411.09],      ["30", 411.09],      ["31", 411.09],      ["jan  1", 411.09],      [" 2", 411.09],      [" 3", 411.09],      [" 4", 411.09],      [" 5", 411.09],      [" 6", 411.09],      [" 7", 411.09]    ]);        var options = {      title: 'my daily activities'    };      var chart = new google.visualization.columnchart(document.getelementbyid('chart'));      chart.draw(data, options);  }
<script src="https://www.google.com/jsapi"></script>  <div id="chart" style="width: 900px; height: 500px;"></div>


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -