Hi,
first thx for your patience with me, your helped me alot :)
you have mentioned in an post how i can convert strings to date object like
this:
dataView.setColumns([{
> type: 'date',
> label: data.getColumnLabel(0),
> calc: function (dt, row) {
> var dateString = dt.getValue(row, 0).toString();
> var year = dateString.substring(0, 4);
> var month = dateString.substring(4, 2); // javascript uses
> 0-indexed months (ie, January is 0 not 1), so you may need to subtract 1
> from this if you haven't already accounted for it
> var day = dateString.substring(6, 2);
> return new Date(year, month, day);
> }
> }, 1, 2]);
But can i make this more flexible? the date string can also look like this
"01-10-1980".. i want that a user can set a pattern in an input field so
that it automatically parses the string to a date object.
Can i do this with the google.visualization.DateFormat({pattern: "EEE, MMM
d, ''yy"}); this is from the examples.. ?
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.