Duplcate values in piechart.

21 views
Skip to first unread message

vivek krishna

unread,
Nov 23, 2020, 3:38:27 AM11/23/20
to Google Visualization API
"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>

$.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);

}

Victor Wong

unread,
Nov 23, 2020, 4:30:29 PM11/23/20
to google-visua...@googlegroups.com
Thank you! 
Are you an expert on the animations column charts in the google apis?
I'm now trying to get the column chart (there are 12 columns that I want to shrink  to 'zero' when I click on the button) to shrink using a constant velocity  to zero for all 12 column charts..
I'm so new to this and I'm a deer in a dark place..
Any suggestions would be appreciated!
Thanks,
Victor!
PS: if you want my code and html page let me know..

--
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-visualizati...@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 all
Reply to author
Forward
0 new messages