Found it:

data.getNumberOfColumns()

Le jeudi 18 février 2016 15:55:30 UTC+1, Gibono a écrit :
>
> Uhm I'me greedy...
>
> Is there a way to get the last index?
>
> Le jeudi 18 février 2016 15:52:58 UTC+1, Gibono a écrit :
>>
>> Works like a charm.
>>
>> THANKS!
>>
>> Le jeudi 18 février 2016 15:38:37 UTC+1, Daniel LaLiberte a écrit :
>>>
>>> You can't do it quite like that, though in the future, we could probably 
>>> support referencing a series by its column id.  Instead, you'll need to do 
>>> something like this:
>>>
>>>
>>>
>>> var options = {
>>>    title : 'My graph',
>>>    vAxis: {title: 'CHF'},
>>>    hAxis: {title: 'Month'},
>>>    seriesType: 'bars',
>>>    series: {}
>>> };
>>> options.series[nbYears] = {type: 'line'};
>>>
>>>
>>> On Thu, Feb 18, 2016 at 9:26 AM, Gibono <gib...@gmail.com> wrote:
>>>
>>>> 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 google-visualization-api+unsubscr...@googlegroups.com.
>>>> To post to this group, send email to google-visua...@googlegroups.com.
>>>> 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
>>>>  
>>>> <https://groups.google.com/d/msgid/google-visualization-api/1bf7ea1d-9614-44d8-88fa-cc6eceb6f451%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> -- 
>>> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
>>> dlali...@google.com   5CC, Cambridge MA
>>>
>>

-- 
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 google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
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/0a0b4d54-ec43-470a-a59f-462f0beed879%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to