SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

0
0

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.

Version
5.1.1
  • You must to post comments
0
0

I am not sure what the problem is / or fully understand the question, however you seem to be wanting to make a Strip Chart with SciChart WPF (a chart which scrolls automatically when new data arrives).

We have a KB article on how to do this here: How to Create a Scrolling Strip Chart in SciChart?

enter image description here

And also a code sample here: https://github.com/ABTSoftware/SciChart.WPF.Examples/tree/master/v5.x/Sandbox/UsefulExamples/Examples/StripChart

Please let me know if this helps,

Best regards
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.