I see. Well unfortunately we don't have a built in solution to do what you
want, but here is some code that converts a list of series to a 2d array.
You just need to make sure that your dates are all consistent (i.e.
'2008-01-01') and it should work well.
function array2fromSeries(allSeries) {
var createNulls = function() {
var l = [];
for (var s in allSeries) {
l.push(null);
}
return l;
};
var domain = {};
var domainList = [];
for (var s in allSeries) {
var series = allSeries[s];
for (var i in series) {
var item = series[i];
if (!(item[0] in domain)) {
domain[item[0]] = createNulls();
domainList.push(item[0]);
}
domain[item[0]][s] = item[1];
}
}
var out = [];
domainList.sort();
for (var i in domainList) {
var d = domainList[i];
out.push([d].concat(domain[d]));
}
return out;
}
- Sergey
On Fri, Dec 21, 2012 at 4:52 PM, Maciek <[email protected]> wrote:
> It's problematic because number of series (and dates) is various in my
> script... So I'll think about consolidate it adding by series is not
> possible.
>
> W dniu piątek, 21 grudnia 2012 21:41:45 UTC+1 użytkownik Sergey napisał:
>>
>> Unfortunately we do not support adding data by series. Can you elaborate
>> on why adding null values is problematic? Isn't it possible to write a tool
>> that consolidates multiple series into a data table?
>>
>> - Sergey
>>
>>
>> On Fri, Dec 21, 2012 at 3:24 PM, Maciek <[email protected]> wrote:
>>
>>> I would like to define data for my chart like in jqPlot (
>>> http://www.jqplot.com/tests/**date-axes.php<http://www.jqplot.com/tests/date-axes.php>
>>> ).
>>>
>>> Adding 'null' values is problematic. Best solution would be adding data
>>> by series like:
>>>
>>> serie1=[['2008-06-30 8:00AM',4], ['2008-7-30 8:00AM',6.5], ['2008-8-30
>>> 8:00AM',5.7], ['2008-9-30 8:00AM',9], ['2008-10-30 8:00AM',8.2]];
>>>
>>> Can I get this method of providing data in Google Chart Tools
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google Visualization API" group.
>>> To view this discussion on the web visit https://groups.google.com/d/**
>>> msg/google-visualization-api/-**/b-XLQt3Dq9AJ<https://groups.google.com/d/msg/google-visualization-api/-/b-XLQt3Dq9AJ>
>>> .
>>> To post to this group, send email to google-visua...@**googlegroups.com
>>> .
>>>
>>> To unsubscribe from this group, send email to google-visualization-api+*
>>> *[email protected].
>>> For more options, visit this group at http://groups.google.com/**
>>> group/google-visualization-**api?hl=en<http://groups.google.com/group/google-visualization-api?hl=en>
>>> .
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-visualization-api/-/rPRBN9AaqxcJ.
>
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-visualization-api?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.