Since there is no data in that column, the arrayToDataTable method is 
inferring a data type (probably "string") for that column.  Try setting the 
data type explicitly for each column:

var data = google.visualization.arrayToDataTable([
     [{label: 'Date', type: 'string'}, {label: 'clk', type: 'number'}, 
{label: 'io', type: 'number'}],
     ['03_18_2014',    ,    1000],
     ['03_31_2014',    ,    1020],
     ['04_04_2014',    ,    1035]
 ]);

On Tuesday, April 8, 2014 8:32:18 PM UTC-4, Rashed Islam wrote:
>
> Hi,
>  I have a situation (html code is shown below), when all the elements of 
> the second column (clk) is empty.
> In this case, the chart.draw function fails with the message "All series 
> on a given axis must be of the same data type×"
> Is there a workaround? 
> (In my environment, I am updating graphs every hour, and at some later 
> time some of the elements in the second column may be 
>  populated, but I want the chart to be shown properly at least for i/o 
> even when all the elements of clk are empty.) 
>
> Thanks.
>
> <html>
>   <head>
>     <script type="text/javascript" src="https://www.google.com/jsapi
> "></script>
>     <script type="text/javascript">
>       google.load("visualization", "1", {packages:["corechart"]});
>       google.setOnLoadCallback(drawChart);
>       function drawChart() {
>         var data = google.visualization.arrayToDataTable([
>           ['Date',           'clk',   'io'],
>           ['03_18_2014',    ,    1000],
>           ['03_31_2014',    ,    1020],
>           ['04_04_2014',    ,    1035]
>      ]);
>      var options = {
>        title : 'Area over time',
>        legend : {position: 'in'},
>        pointSize : 10
>      };
>      var chart = new 
> google.visualization.LineChart(document.getElementById('chart_div'));
>      chart.draw(data, options);
>       }
>     </script>
>   </head>
>   <body>
>     <h1> Line Chart </h1>
>     <div id="chart_div" style="width: 900px; height: 500px;"></div>
>     <h1>Line Chart Ends </h1>
>   </body>
> </html>
>
>
>

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

Reply via email to