I'm trying to use Google Chart API in my Aspnet application. My data is provided by a Web Api controller, I'm using Google.DataTable.Net.Wrapper do generate my data, and the following template in Javascript :
function drawVersionDistributionChart() {
var versionDistributionJsonData = $.ajax({
url: BASE_URL + "api/VersionDistribution",
dataType: "json",
async: false
}).responseText;
// Create our data table out of JSON data loaded from server.
var versionDistributionData = new google.visualization.DataTable(versionDistributionJsonData);
// Instantiate and draw our chart, passing in some options.
var versionDistributionChart = new google.visualization.PieChart(document.getElementById('versiondistribution_chart_div'));
versionDistributionChart.draw(versionDistributionData, { width: 500, height: 300 });
}
My data seems well formatted : {"cols": [{"type": "string" ,"id": "VersionNumber" ,"label": "Version number" }, {"type": "number" ,"id": "ApplicationCount" ,"label": "Application count" }], "rows" : [{"c" : [{"v": "1"}, {"v": 1}]}]}
I validated the data with Google API Playground.
I also tried to use the Chart Wrapper method by providing the URL of my Web API controller as datasourceUrl.
What am I missing please ?
BASE_URL + "api/VersionDistribution"URL in a browser and post what it outputs. - asgallant