|
ASP.NET Core
<ej-chart id="container" load="chartLoad" axes-label-rendering="axesLabelRendering">
//The below highlighted code snippet is used to add multiple axis
<e-axes>
<e-axis opposed-position="true" visible="true" name="yAxis" orientation="Vertical">
</e-axis>
</ej-chart>
Converted datetime values to milliseconds and bind to y values as highlighted below
var chartData = [
{ x: new Date(2000, 06, 11, 16, 15, 0), y: new Date(2000, 02, 11, 2, 0, 0).getTime(), y2: new Date(2000, 02, 11, 4, 0, 0).getTime() },
{ x: new Date(2000, 06, 11, 16, 20, 0), y: new Date(2000, 02, 11, 2, 0, 0).getTime(), y2: new Date(2000, 02, 11, 4, 0, 0).getTime() },
//...
];
function chartLoad(sender) {
Bind the data source for chart
//...
Specified the interval for y axis in double, not as date time
sender.model.primaryYAxis.range.min = new Date(2000, 02, 11, 0, 0, 0).getTime();
sender.model.primaryYAxis.range.max = new Date(2000, 02, 11, 3, 0, 0).getTime();
In similar way, specify the ranges for multiples axes here
}
function axesLabelRendering(sender) {
if (sender.data.axis.orientation == "vertical") {
var label = new Date(sender.data.label.Text);
sender.data.label.Text = label.getHours().toString() + ":" + label.getMinutes().toString();
}
//...
}
|
|
<ej-chart id="container ">
<e-primary-x-axis>
<e-range interval="1"></e-range>
</e-primary-x-axis>
</ej-chart>
|
|
var count = 0
function change() {
var start = setInterval(function () {
count++
myTimer(count)
}, 3000);
function myTimer(count) {
var chart = $("#container").ejChart("instance");
if (count < 4) {
for (var i = 0; i < 7; i++) {
if (Math.random() > .5) {
value += 2 * Math.random();
}
else {
value -= 4 * Math.random();
}
var point1 = { x: new Date(1930, 0, 0, count, i * 10), y: value };
series1.push(point1);
}
chart.model.series[0].dataSource = series1;
chart.model.primaryXAxis.range.interval += 10;
chart.redraw();
} else {
clearInterval(start);
}
}
} |
|
<e-primary-x-axis label-rotation="45">
</e-primary-x-axis > |
|
Query |
Response | |
|
How can the X-axis in the real-time drawing have the same effect as the example you gave? |
As for your requirement, we have prepared a live data sample in date time axis. In this sample, we have changed interval of primaryXAxis based on hours of data.
Please find the code snippet below to achieve this requirement and you can change this with respect to your scenario.
Screenshot:
First One hour Data interval
Two hour Data with interval:
Sample for your reference can be find from below link,
| |
|
In one case, the total amount of data display is unchanged, and the graph scrolls in the direction of the X axis. |
Unfortunately, we are unable to reproduce the issue at our end. Could you please modify the attached sample or provide your sample with replication steps which will be helpful in further analysis and provide you the solution sooner.
| |
|
In the other case, the total number of data displays continues to increase. How long does it take for the X-axis of the chart to increase as the total number of data increases? |
While increasing the total number of data, then X axis also updated automatically according to the increased data. If your query is misunderstood at our end, kindly revert us with more information on your query, so that we can provide you the solution sooner. |