Hello
I have found that many people got problem with structuring data to use inside html element with Google Charts.
I did some small js improvements to simply put format data to arrays needed by Charts.
Simply put your list of values inside x or y variable.
Note this way you can make also multi series charts just add y2,y3 labels and variables to results.push([…
Multi-series charts:
You need to prepare your datapoints within the same X axis context. (watch app example datapoint thing’s structure)
This code inside html element is the key to customization for multiseries:
var results = [];
var x = [LIST OF THINGS'S X SORTED by X];
var y = [LIST OF THINGS'S Y SORTED by X];
var yn...
results.push(['THINGS's LabelX', ' THING'S LabelY', 'yn labels...']);
for (i = 0; i < x.length; i++) {
results.push([parseInt(x[i]),parseInt(y[i]), parse more yn....]);
}
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable(results);
Remember you need to add script to header in your page settings to be able to render charts:
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
I believe for those of You who aren’t familiar with js it might look a bit messy so as soon as plugin’s elements will be ready to public and I will find enough time to finish this I will release this as a free plugin.
Regards