I am in the process of separating my view from JavaScript. In my view, I call a function in a JavaScript file to create a chart.
Below is the JavaScript file and the function:
function createPieChart(chartID, pieChartData) {
chartID.kendoChart({
dataSource: {
data: pieChartData
},
series: [{
type: "pie",
field: "list",
categoryField: "mm",
padding: 0,
labels: {
visible: true,
}
}],
seriesClick: onClick,
tooltip: {
visible: true,
template: "${ category }"
},
legend: {
position: "bottom"
}
});
}
function onClick(e) {
var clickedValue = e.category;
}
Here is a snippet from my view:
createPieChart($("#pieChart"), result);
The issue I am facing is that the onClick() function in my JavaScript file is triggered when I click on the chart. I need to send this value back with an Ajax call in my view. How can I access this value in my view?