Hi,

I've got a dynamic DataTable (the number of columns is not fix => database 
related).

Here is an exemple of the dataTable:

{
 "cols": [{
 "id": "Month",
 "label": "Month",
 "type": "string"
 }, {
 "id": "2015",
 "label": "2015",
 "type": "number"
 }, {
 "id": "Average",
 "label": "Average",
 "type": "number"
 }],
 "rows": [{
 "c": [{
 "v": "January"
 }, {
 "v": 1
 }, {
 "v": 1
 }]
 }, {
 "c": [{
 "v": "February"
 }, {
 "v": 2
 }, {
 "v": 2
 }]
 }]
}

or

{
 "cols": [{
 "id": "Month",
 "label": "Month",
 "type": "string"
 }, {
 "id": "2015",
 "label": "2015",
 "type": "number"
 },
 {
 "id": "2016",
 "label": "2016",
 "type": "number"
 }, {
 "id": "Average",
 "label": "Average",
 "type": "number"
 }],
 "rows": [{
 "c": [{
 "v": "January"
 }, {
 "v": 1
 }, {
 "v": 1
 }]
 }, {
 "c": [{
 "v": "February"
 }, {
 "v": 2
 }, {
 "v": 2
 }]
 }]
}

So it depends of the number of years....


I'd like to do somehting like this:

var firstYear = 2015;
var data = new google.visualization.DataTable(jsonData);
var curYear = new Date().getFullYear();
var nbYears= (curYear-firstYear)+1;
   
var options = {
  title : 'My graph',
  vAxis: {title: 'CHF'},
  hAxis: {title: 'Month'},
  seriesType: 'bars',
  series: {nbYears: {type: 'line'}}
};





or


var options = {
   title : 'My graph',
   vAxis: {title: 'CHF'},
   hAxis: {title: 'Month'},
   seriesType: 'bars',
   series: {lastIndex: {type: 'line'}}
};

or

var options = {
   title : 'My graph',
   vAxis: {title: 'CHF'},
   hAxis: {title: 'Month'},
   seriesType: 'bars',
   series: {'Average': {type: 'line'}}
};


How can I do that?`

Thanks for the answers.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/1bf7ea1d-9614-44d8-88fa-cc6eceb6f451%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to