"The Piechart created using the below code displays duplicate values 
randomly, on refreshing the chart gets corrected."
Want to understand the problem and solution thereof...

Code :- 
<script type="text/javascript" 
src="https://www.gstatic.com/charts/loader.js";></script>
<script type="text/javascript" src="https://www.google.com/jsapi";></script>
<script 
src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js";></script>

$.ajax({

type: "POST",
dataType: "json",
contentType: "application/json",
url: '@Url.Action("VisualizeBookingStatus", "View")',
success: function (result) {

// Load the Visualization API and the corechart package.
google.charts.load('current', { 'packages': ['corechart'] });

// Set a callback to run when the Google Visualization API is loaded.
google.charts.setOnLoadCallback(function () {
drawChart(result);
});

}

});

});

function drawChart(result) {

var data = new google.visualization.DataTable();

data.addColumn('string', 'Agency');
data.addColumn('number', 'Booked');

var dataArray = [];


$.each(result, function (i, obj) {
dataArray.push([obj.agency, obj.booking_count]);

});


data.addRows(dataArray);

var chartoptions = {
'title': 'Booking-Agencywise',
chartArea: { width: 500, height: 400 },
is3D: true
};

var chart = new 
google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, chartoptions);

}

-- 
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 google-visualization-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/d4065ada-4f58-4343-bf39-8e40efff0432n%40googlegroups.com.

Reply via email to