The Visualization API does not have any date-string input parsing tools
like the d3 parser you linked to. If that parser works for you, go ahead
and use it.
On Friday, April 4, 2014 8:26:23 AM UTC-4, cyb wrote:
>
> Hi,
>
>
> i want implement a Date Filter for the X-Axis so i think i need the
> Date-Strings as a Date object.
>
> If i have something like this:
>
> var data = new google.visualization.arrayToDataTable([
>> ['date','column1','column2'],
>> [20111001,2,3],
>> [20111002,5,6],
>> [20111003,8,9],
>> [20111004,11,12] ]);
>>
>
> or this..
>
> var data = new google.visualization.arrayToDataTable([
> ['date','column1','column2'],
> [2011-10-01,2,3],
> [2011-10-02,5,6],
> [2011-10-03,8,9],
>
>> [2011-10-04,11,12] ]);
>
>
>
> i must parse this values to Date Object so i need first a parser for that,
> or is there an other way to implement a Date Filter.. and yes the users can
> upload different Date Formats
>
> I want then implement the Date Filter like this :
> view.setRows(view.getFilteredRows([{column:
> 1, minValue: new Date(2011, 10, 2),maxValue :new Date(2011,10,4)}]));
>
> So i must first parse the date string in a Date Object..
>
> or can i use the D3 parser for that ? (
> https://github.com/mbostock/d3/wiki/Time-Formatting)
>
> var format = d3.time.format("%Y-%m-%d");format.parse("2011-01-01"); //
> returns a Dateformat(new Date(2011, 0, 1)); // returns a string
>>
>> the user should only define the parser-pattern like "%Y-%m-%d" and he
> must say in which column are the date strings.
>
> or has google charts something similar ?
>
> Best regards
> Am Montag, 24. März 2014 17:03:13 UTC+1 schrieb cyb:
>>
>> Hi,
>>
>> i have the following code:
>>
>>
>> var data = new google.visualization.arrayToDataTable([
>> ['date','column1','column2'],
>> [20111001,2,3],
>> [20111002,5,6],
>> [20111003,8,9],
>> [20111004,11,12] ]);
>>
>>
>> var dataView = new google.visualization.DataView(data);
>>
>> var chart = new
>> google.visualization.LineChart(document.getElementById('chart_div'));
>>
>> chart.draw(dataView, options);
>>
>>
>> This draws me a line chart but if i replace the LineChart with this:
>> chart = new
>> google.visualization.PieChart(document.getElementById('chart_div'));
>> i get this error: "Pie chart should have a first column of type string"
>> What is now the best an easiest way to convert the data from a line in a
>> pie chart? I want switch between a pie and a line chart and all should use
>> the same data-array. Or can i disable the check that the first value must
>> be a string !?
>> And then i want select different values with dataView.setColumns(); so
>> that i can determine which data is showing in my chart.
>>
>> And second question can i convert the date- column to a real date !?
>> 20111001 is Year 2011 Month: 10 and Day: 01 ?
>>
>>
>>
>> Best regards cyb
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
--
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 http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.