Pre loader

Tag: Dynamic Axis interval

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0 votes
8k views

I am trying to develop a realtime moving chart which reads data and plots. It has four channels. Both X and Y axis intervals are dynamic. ie, required to change the axis interval runtime so that graph plots accordingly.
I implemetd it. Y axis is ok. As it is an moving chart I need to reset the visible range so as to move the chart along X axis . Even if I change the interval of X axis, when I reset the visible it changes to old value.

Following is the code:

On Load:
double SclX=10; // no of intervals in x axis(major ticks)

sciChartSurface.XAxis.AutoTicks = false;
sciChartSurface.XAxis.AutoRange = AutoRange.Never;
sciChartSurface.XAxis.MajorDelta = 100; //Convert.ToDouble(trackFactorX[XCur, 1])
sciChartSurface.XAxis.MinorDelta = 20; //((Convert.ToDouble(trackFactorX[XCur, 1]) /SclX)*2)
XCurMin = 100; // Convert.ToDouble(trackFactorX[XCur, 1]);
XCurMax = 1000; //SclX * Convert.ToDouble(trackFactorX[XCur, 1]);
sciChartSurface.XAxis.VisibleRange = new DoubleRange(XCurMin, XCurMax );

Resetting visible range to implement moving chart

timer.Interval = TimeSpan.FromMilliseconds(1);
timer.Tick += (s, e) =>
{
if (i > XCurMax)
{
XCurMin = XCurMin + Convert.ToDouble(trackFactorX[XCur, 1]);
XCurMax = XCurMin + (SclX * Convert.ToDouble(trackFactorX[XCur, 1]));
sciChartSurface.XAxis.VisibleRange = new DoubleRange(XCurMin, XCurMax);
}
};

Changing interval from 100 to 200 (button click)

sciChartSurface.XAxis.AutoTicks = false;
sciChartSurface.XAxis.MajorDelta = 200; //Convert.ToDouble(trackFactorX[XCur, 1]);
sciChartSurface.XAxis.MinorDelta = 40; // ((Convert.ToDouble(trackFactorX[XCur, 1]) / SclX) * 2);
XCurMin = XCurMin;
XCurMax = XCurMin + (SclX * Convert.ToDouble(trackFactorX[XCur, 1]));

sciChartSurface.XAxis.VisibleRange = new DoubleRange(XCurMin, XCurMax);

Please check any thing else is required.

  • Sophiya K asked 5 years ago
  • last active 5 years ago
0 votes
4k views

Hello,

I have an x-axis of type DateTime. Now I need to change that x-axis to show data in different intervals like Daily, Weekly, Monthly, continuous axis, and discontinuous axis at runtime.

Can you help me to guide on how can we achieve this. Also, any code reference would be really helpful.

Thanks,
Parthiv

1 vote
2k views

The project is developed on SciChart JS.

The x axis is date time numeric and y axis is numeric.

There is a option for the user to select the x axis interval. The interval values are 5 Min, 10 Min, 15 Min, 30 Min, 1 Hour, 6 Hour, 12 Hour, Days, Weeks, Months & Years.

When the user the selects a interval in the select option, the x axis should be updated with the selected interval.

For Example, If the user selects the 5 Min in the select option, then the x axis interval should be 5 Min.

For 5 Min X Axis Interval

16-Jan-2023 07:00
16-Jan-2023 07:05
16-Jan-2023 07:10
16-Jan-2023 07:15
16-Jan-2023 07:20
16-Jan-2023 07:25
16-Jan-2023 07:30

For 1 Hour X Axis Interval

16-Jan-2023 07:00
16-Jan-2023 08:00
16-Jan-2023 09:00
16-Jan-2023 10:00
16-Jan-2023 11:00
16-Jan-2023 12:00
16-Jan-2023 13:00
16-Jan-2023 14:00

So let me know how to change the interval in the x axis (date time numeric) based on the selection.

I have attached the zip file which contains the HTML file.

  • Leo Leslin asked 1 year ago
  • last active 4 months ago
Showing 3 results

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies