[CSHTML]
<ej-chart id="container" enable-canvas-rendering="true" loaded="loadDataSource" scroll-end="scrollEnded">
<e-primary-x-axis value-type="AxisValueType.Datetime" label-format="dd/MM/yyyy">
<e-scrollbar-settings visible="true">
<e-scroll-range min="new DateTime(2010, 1, 1)" max="new DateTime(2010, 1, 1).AddHours(5000000)"></e-scroll-range>
</e-scrollbar-settings>
</e-primary-x-axis>
. . . .
. . . .
</ej-chart>
<script type="text/javascript">
//. . . .
//. . . .
//Event handler to handle scroll end event of range scroll bar
function scrollEnded(sender) {
var start = new Date(2010, 1, 1),
interval = 10,
end;
//Show waiting popup till chart renders the data from Web API
$("#container").ejWaitingPopup();
$("#container").ejWaitingPopup("show");
//newRange.start indicates the start range for the view after scrolling
//Date conversion is not necessary for numerical x-axis
start = (new Date(sender.data.newRange.start).getTime() - start.getTime()) / 1000 / 60 / 60;
//newRange.end indicates the end range for the view after scrolling
//Date conversion is not necessary for numerical x-axis
end = start + ((new Date(sender.data.newRange.end).getTime() - new Date(sender.data.newRange.start).getTime()) / 1000 / 60 / 60);
//Method to get the specified data from Web API and update the chart
getData(start, end);
}
</script>
|