<ejs-grid id="Grid" dataSource="ViewBag.dataSource" dataBound="dataBound"
toolbar="@(new List<string>() { "Update", "Cancel" })" allowPaging="true"
allowFiltering="true" actionComplete="actionComplete">
</ejs-grid>
<div id="Chart"></div>
<script>
var chart;
function dataBound(args) {
var grid = document.getElementById("Grid").ej2_instances[0];
chart = new ej.charts.Chart({
//Initializing Primary X Axis
primaryXAxis: {
},
series: [
{
type: 'Line',
dataSource: grid.getCurrentViewRecords(),
xName: 'OrderID', width: 2, marker: {
visible: true,
width: 10,
height: 10
},
yName: 'Freight', name: 'Germany',
},
],
});
chart.appendTo('#Chart');
}
function actionComplete(args) {
if (args.requestType === 'save') {
chart.series[0].dashArray = '5,5';
chart.refresh();
}
}
</script> |