I am looking to create a chart using amCharts and I have received some values from the server through an ajax call. Now, I need help in utilizing this data for my chart. Can anyone guide me on how to achieve this?
var chart = am4core.create("chartdiv", am4charts.XYChart);
// Add data
chart.data= (avoiding manual addition of data)
// Add and configure Series
var pieSeries = chart.series.push(new am4charts.PieSeries());
pieSeries.dataFields.value = "SalePrd";
pieSeries.dataFields.category = "SaleYear";
Sample code for making data call
var Ajax_URL= url;
var Year_Val = GetSelectValue("YearSelect");
var Prd_Val = GetSelectValue("PrdSelect");
app.request.get(Ajax_URL, { "Token": Token_Data, "SaleYear":Year_Val, "SalePrd":Prd_Val }, function (data)
{
var data_Str=''+data;
var data_Output = JSON.parse(data_Str);
return data_Output;
});
}