Hi All ,
We have a taks to pass the json array value in the google chart . when we were trying to bind the database , how to assign the json array to that google chart. If anyone knows this guide us with sample .
Sample code :
$(function () {
$.ajax({
type: "POST",
url: "InteractiveDashboard.aspx/Web_GetTotalSaleslist",
data: '{}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response)
{
//alert(response.d);
alert("Error..1");
},
error: function (response)
{
alert("Error..2");
alert(response);
}
});
});
function OnSuccess(response) {
// var jsonResult = JSON.stringify(response.d)
// alert(jsonResult);
var jsonResult = JSON.parse(response.d);
var jsonCount = jsonResult.length;
for (var n = 0; n < jsonCount; n++)
{
var _Month = jsonResult[n].Month;
var _TotalsalesAmt = jsonResult[n].TotalsalesAmt;
}
sessionStorage.setItem("JsonResult", JSON.stringify(jsonResult));
// loop the jsonresult Here
drawBasic();
};
Thanks in advance ,
K.Karthik.K

Jayraj ChhayaPosted May 17, 2024, 9:09 AM
To pass a JSON array to a Google Chart in Dot Net, you need to ensure that the JSON data retrieved from the server is properly formatted and then bind it to the Google Chart. In the provided code snippet, after successfully fetching the JSON data using AJAX, you can parse the JSON response and extract the necessary data for the chart.
To assign the JSON array to the Google Chart, you can utilize the Google Charts API.
Jayraj ChhayaPosted May 28, 2024, 6:00 AM
Thanks Karthik K,
I am happy to share my knowledge and hope it was helpful to you and other members.
Thank you for accepting my answer.
Karthik KPosted May 18, 2024, 7:00 AM
@ Jayraj Chhaya ,
Your code works exactly what i expect. Thank you much .