ColumnChart - best way to move month to x axis

25 views
Skip to first unread message

C Miller

unread,
Sep 22, 2017, 11:12:07 AM9/22/17
to Google Visualization API
Hello, 
I've created a fiddle to demonstrate how my data comes from JSON and renders in a ColumnChart.  


My JSON comes over like this:
[{"lPlusScoreID":1,"jan":60.03,"feb":43.57,"mar":48.55},
 {"lPlusScoreID":2, "jan":89.42,"feb":85.71,"mar":90.46},
 {"lPlusScoreID":3,"jan":86.22,"feb":90.61,"mar":89.53}]

The column chart comes out like this:



My goal is month across the x-axis and product as column/bar.  

How can I accomplish this?  I prefer a Google Visualization chart, method, or configuration option.  

Coding would be OK if that is the only way, but I struggle there and would need help.

Thank you so much, as always!


Ray Thomas

unread,
Sep 22, 2017, 4:57:55 PM9/22/17
to Google Visualization API
I really don't know a way using the configuration method but you can do it relatively easily by using code. The function everyone seems to post was originally written by Bhuman Soni at http://captaindanko.blogspot.com/2013/05/transpose-of-google-visualization-data.html and appears on Stack Overflow at https://stackoverflow.com/questions/16949993/inverting-rows-and-columns-on-google-area-chart 

I use it extensively and you can see what I use it for at https://jsfiddle.net/brisray/z49jw264/781/ 

The only argument it needs is the data table.

Ray
Reply all
Reply to author
Forward
0 new messages