Can you modify the server-side code?  If so, then the best method might be 
to build the DataTable as a JSON object (structure linked to in the post 
above), which you can feed directly to the DataTable constructor.  There 
are examples of this in PHP on the forum here; doing it in perl would 
probably be similar.

On Tuesday, November 27, 2012 2:37:10 PM UTC-5, Dragomir Haralambiev wrote:
>
> Hi.
> Thanks for your replay.
> You right if obj is generate from javascript.
> What I do if obj is generate from AJAX like this:
>             var jsonData = $.ajax({
>                 url: "js/chart.pl",
>                 dataType: "json",
> contentType: "application/json",
>                 async: false
>             }).responseText;
>
>             var obj = jQuery.parseJSON(jsonData);
>
>
> Best regards,
> Fragomir
> 27 ноември 2012, вторник, 18:55:07 UTC+2, asgallant написа:
>>
>> The 
>> arrayToDataTable<https://developers.google.com/chart/interactive/docs/reference#google.visualization.arraytodatatable>method
>>  doesn't handle dates properly; your dates are being input as 
>> strings.  To fix this, you will have to manually construct the DataTable 
>> (or use the 
>> json<https://developers.google.com/chart/interactive/docs/reference#dataparam>format).
>>
>> Here's one way you could do it manually:
>>
>> var obj = [
>>     [new Date(2012,10,2),15,14],
>>     //....
>> ];
>> var data = new google.visualization.DataTable();
>> data.addColumn('date', 'Date');
>> data.addColumn('number', 'Buy');
>> data.addColumn('number', 'Sell');
>> data.addRows(obj);
>>
>> Note that the format for the date is as a Date object and not a string 
>> when using this method.
>>
>> On Tuesday, November 27, 2012 5:37:44 AM UTC-5, Dragomir Haralambiev 
>> wrote:
>>>
>>> I'm trying to test the Google Chart, but I receive follow error:
>>> "One or more participants failed to draw().
>>> The filter cannot operate on a column of type string. Column type must 
>>> be one of: number, date, datetime or timeofday. Column role must be domain, 
>>> and correlate to a continuous axis."
>>>
>>> What am I doing wrong?
>>>  
>>>
>>>
>>> <script type="text/javascript" src="
>>> https://www.google.com/jsapi";></script>
>>>     <script type="text/javascript">
>>>
>>>          google.load('visualization', '1.0', {'packages':['controls']});
>>>         google.setOnLoadCallback(drawDashboard);
>>>     
>>>       function drawDashboard() {
>>>  var obj = 
>>> [["Date","buy","sell"],["Date(2012,10,2)",15,14],["Date(2012,10,3)",55,51],["Date(2012,10,4)",53,49]];
>>>         var dataa = google.visualization.arrayToDataTable(obj);
>>>         var dashboard = new 
>>> google.visualization.Dashboard(document.getElementById('dashboard_div'));
>>>
>>>         var donutRangeSlider = new google.visualization.ControlWrapper({
>>>           'controlType': 'ChartRangeFilter',
>>>           'containerId': 'filter_div',
>>>           'options': {
>>>      'filterColumnIndex': 0,
>>>      'ui': {
>>>       'chartType': 'LineChart',
>>>       'chartOptions': {
>>>         'chartArea': {'width': '90%'},
>>>         'hAxis': {'baselineColor': 'none'}
>>>       },
>>>       'chartView': { 'columns': [0, 1] },
>>>       'minRangeSize': 86400000
>>>     }
>>>           },
>>>         });
>>>
>>>         var lineChart = new google.visualization.ChartWrapper({
>>>           'chartType': 'LineChart',
>>>           'containerId': 'chart_div',
>>>           'options': {
>>>                 title: 'Title',
>>>           }
>>>         });
>>>
>>>         dashboard.bind(donutRangeSlider, lineChart);
>>>         dashboard.draw(dataa);
>>>       }    
>>> </script>
>>>
>>> Best regards,
>>> Dragomir
>>>
>>

-- 
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/-/m1b2NFS0H5IJ.
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.

Reply via email to