Hi,

I am not able to filter and display the gauge chart based on my query. Also 
the gauge chart is always displayed for the entire CSV data and not based 
on my query.Find below the code that i used.

<!DOCTYPE html>
<html>
<head>
   <title>Google Chart Example</title>
   <script src="https://www.google.com/jsapi";></script>
   <script src="http://code.jquery.com/jquery-1.10.1.min.js";></script>
   <script src="http://localhost/jquery.csv-0.71.js";></script>
   <script type="text/javascript">
      google.load("visualization", "1", {packages:["gauge"]});
</script>
<script>
function drawChart()
{
//$.get("http://localhost/output.csv",function(csvString)
//{
var queryOptions =
{
//csvColumns: 
['string','string','string','date','string','number','number','number','string','string','string','number','string','string','string','string','string'],
//csvColumns: 
['string','string','string','string','string','string','string','string','string','string','string','string','string','string','string','string','string']
csvColumns: ['string','number'], 
csvHasHeader: true
}
 //csvUrl= 'http://localhost/output.csv';
csvUrl= 'http://localhost/temperatures.csv';
var query = new google.visualization.Query(csvUrl,queryOptions);
//var query = new 
google.visualization.Query('http://spreadsheets.google.com/tq?key=pCQbetd-CptGXxxQIG7VFIQ&range=B1:D11&pub=1');
//var arrayData = $.csv.toArrays(csvString, {onParseValue: 
$.csv.hooks.castToScalar});
query.setQuery('select B,C where C > 6');
query.send(handleQueryResponse);
function handleQueryResponse(response)
{
 if (response.isError()) 
{ 
alert('Error in query: ' + response.getMessage() + ' ' + 
response.getDetailedMessage());
return;
}
var data = response.getDataTable();
 //alert(data[1,1]);
//var dataView1 = new google.visualization.DataView(data);
//dataView1.setColumns([1]);
var chart = new 
google.visualization.Gauge(document.getElementById('chart'));
chart.draw(data,{width: 400, height: 250,redFrom: 18, redTo: 
20,yellowFrom:15, yellowTo: 17,minorTicks: 5,min: 1,max: 
20,animation:{duration: 400,easing: 'linear'}});
}
 }
google.setOnLoadCallback(drawChart);     
   </script>
</head>
<body>
   <div id="chart">       
   </div>
</body>
</html>

This is my CSV Data.

Label,License_Utilized,validation
License,10,5
License1,18,7

Thanks,
Ashok





-- 
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/groups/opt_out.

Reply via email to