//Date range picker change event
var Change = function(args) {
if (args.event && args.event.target.classList.contains("e-apply")) {
if ((document.getElementById('container').childNodes.length > 1)) {
Getting instance of chart
var chart = document.getElementById('container').ej2_instances[0];
Get filtered data based on start and end values
var filterData = chartData.filter(function (data) {
return (data['x'].getTime() >= (args.startDate) && data['x'].getTime() <= (args.endDate));
});
Bind data to chart and refresh
chart.series[0].dataSource = filterData;
chart.refresh();
}
}
} |
//chart data bind dynamically through on ajax call in partial view
var Change = function(args) {
if (args.event && args.event.target.classList.contains("e-apply")) {
var chart = document.getElementById('container').ej2_instances[0];
var startDate =args.startDate;
var endDate = args.endDate;
var ajax = new ej.base.Ajax("/Home/_CoreChart?frmDate=" + startDate + "&toDate=" + endDate, "POST", true); ajax.onSuccess = function (value) {
$('#refreshContainer').html(value);
};
ajax.send();
}
}
|
var Change = function(args) {
if (args.event && args.event.target.classList.contains("e-apply")) {
var chart = document.getElementById('container').ej2_instances[0];
var startDate =args.startDate;
var endDate = args.endDate;
//second way
var ajax = new ej.base.Ajax("/Home/GetChartData?frmDate=" + startDate + "&toDate=" + endDate, "POST", true);
ajax.onSuccess = function (value) {
//Bind the data to chart and then refresh
chart.series[0].dataSource =JSON.parse(value);
chart.refresh();
};
ajax.send();
}
} |
// add your additional code here Html.EJS().Chart("container").Width("100%").LegendSettings(le => le.Visible(false))
.PrimaryXAxis(px => px.LabelFormat("d-M-y"))
.PrimaryYAxis(py => py.Title("Server Load")).
// add your additional code here
.Render()
// add your additional code here
|