Hi guys,
I just started using this library after a couple of days reading the Analytics and Chart Tools API and I must say you guys made an incredible job making our lifes easier when it comes to working with the API, thanks a lot!
That being said, I have a really beginner question, but after several tries I haven't been able to figure how to solve it. When it comes to extracting data from analytics and rendering it to a graph, we have this example in the user documentation page:
// Create a new Chart that queries visitors for the last 30 days and plots
// visualizes in a line chart.
var chart1 = new gadash.Chart({
'type': 'LineChart',
'divContainer': 'line-chart-example',
'last-n-days':30,
'query': {
'ids': TABLE_ID,
'metrics': 'ga:visitors',
'dimensions': 'ga:date'
},
'chartOptions': {
height:600,
title: 'Visits in January 2011',
hAxis: {title:'Date'},
vAxis: {title:'Visits'},
curveType: 'function'
}
}).render();
But when it comes to rendering a PieChart, I always get the same error: PieChart should have a first column of type String. I assume it means the labels, but can't figure how to put it in the config array. Could somebody put a configuration based on the previous code of a working PieChart please?
My code looks like this:
var chart2 = new gadash.Chart({
'type': 'PieChart',
'divContainer': 'pie-chart-example',
'query': {
'ids': TABLE_ID,
'start-date':'2012-07-01',
'end-date':'2012-08-01',
'metrics': 'ga:percentNewVisits',
'dimensions': 'ga:date',
'sort': 'ga:date'
},
'chartOptions': {
height:600,
title: 'Title'
//legend: 'right'
}
}).render();
I know it is a really beginner question, but I would really appreciate the help and maybe its useful for future users too.
Iker