On Friday, 21 February 2014 16:04:13 UTC+1, Ashok Kumar wrote:
>
> Hi,
>
> I am trying to generate a column chart from a csv file with 1677 rows. 
> However the chart only displays data from the first 550 rows in the source 
> CSV file.
>
> I am using the group method to display the max usage of tokens for each 
> day in the month. I have also given my code hereunder.
>
> Regards,
> Ashok
>
> <!DOCTYPE html>
> <html>
> <head>
>    <title>Tele2 QTP License Monitoring Console</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:["corechart" , 
> "gauge"]});
>   //google.load("visualization", "1", {packages:["gauge"]});
> </script>
> <script>
> function Initalize()
> {
> drawChart();
> drawGauge();
> }
>
>  function drawChart()
> {
> var queryOptions =
> {
> csvColumns: 
> ['string','string','string','string','string','number','number','number','string','string','string','number','string','string','string','string'],
>  
> csvHasHeader: false
> }
>  csvUrl= 'http://10.206.50.158/output.csv'; 
> var query = new google.visualization.Query(csvUrl,queryOptions); 
> query.send(handleQueryResponse);
> function handleQueryResponse(response)
> {  
> if (response.isError()) 
> { 
> alert('Error in query: ' + response.getMessage() + ' ' + 
> response.getDetailedMessage());
> return;
> }
> var data = response.getDataTable();
> /*var GaugeData = response.getDataTable();
> var RowId = GaugeData.getNumberOfRows()-1;*/
> var maxLicensebyDate = google.visualization.data.group(data,[3],[{
> type: 'number',
> label: 'License',
> column: 6,
> aggregation: google.visualization.data.max
> }]);
> var dataView1 = new google.visualization.DataView(maxLicensebyDate);
> /*var dataView2 = new google.visualization.DataView(GaugeData);
> dataView2.setRows([RowId]);
> dataView2.setColumns(6);*/ 
> var chart = new 
> google.visualization.ColumnChart(document.getElementById('chart'));
> //var GaugeChart = new 
> google.visualization.Gauge(document.getElementById('gaugechart'));
>  chart.draw(dataView1,{title: 'Daywise License Utilization',hAxis: 
> {title: 'Date'},vAxis: {title: 'License'}});
> //GaugeChart.draw(dataView2,{width: 400, height: 250,redFrom: 18, redTo: 
> 20,yellowFrom:15, yellowTo: 17,minorTicks: 5,min: 1,max: 
> 20,animation:{duration: 400,easing: 'linear'}}); 
> } 
> }
>  function drawGauge()
> {
> var queryOptions =
> {
> csvColumns: 
> ['string','string','string','string','string','number','number','number','string','string','string','number','string','string','string','string'],
>  
> csvHasHeader: true
> }
>  csvUrl= 'http://10.206.50.158/output.csv'; 
> var query = new google.visualization.Query(csvUrl,queryOptions); 
> query.send(handleGaugeResponse);
> function handleGaugeResponse(response)
> {  
> if (response.isError()) 
> { 
> alert('Error in query: ' + response.getMessage() + ' ' + 
> response.getDetailedMessage());
> return;
> } 
> var GaugeData = response.getDataTable();
> var RowId = GaugeData.getNumberOfRows()-1; 
> var dataView2 = new google.visualization.DataView(GaugeData);
> //console.log(RowId);
> dataView2.setRows([RowId]);
> dataView2.setColumns([6]); 
> var FilteredView = dataView2.toDataTable(); 
>
> //'string','string','string','string','string','number','number','number','string','string','string','number','string','string','string','string'
>
> //FilteredView.insertRows(1,[[null],[null],[0],[null],[null],[null],[null],[null],[null],[null],[null],[null],[null],[null],[null],[null]]);
> FilteredView.setColumnLabel(0,'License'); 
> var GaugeChart = new 
> google.visualization.Gauge(document.getElementById('gaugechart')); 
> GaugeChart.draw(FilteredView,{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(Initalize); 
>    </script>
> </head>
> <body>
>    <center><blockquote><font size =8><font color="blue">QTP License 
> Dashboard</font></blockquote></center>
>    <div id="chart"></div>
>    <br>
>    <br>
>    
>    <div id="gaugechart"></div>
> </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/groups/opt_out.

Reply via email to