Pre loader

The real-time graph only shows the data of the last minute on the x-axis, and the VisibleRange property setting is invalid

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
0

The real-time graph only shows the data of the last minute on the x-axis, and the VisibleRange property setting is invalid

private void InitializeChart()
{
    for (int i = 0; i < 50; i++)
    {
        var dataSeries = new XyDataSeries<DateTime, double> { FifoCapacity = 10 };
        Color color = Color.FromArgb(0xAA, (byte)random.Next(1, 256), (byte)random.Next(1, 256), (byte)random.Next(1, 256));
        var lineSeries = new FastLineRenderableSeries()
        {
            DataSeries = dataSeries,
            StrokeThickness = 2,
            Stroke = color
        };
        sciChart.RenderableSeries.Add(lineSeries);
        fastLines.Add(dataSeries);
    }
}

private void StartTimer()
{
var timer = new Timer(1000);
timer.Elapsed += (sender, e) =>
{
Dispatcher.Invoke(() =>
{
var currentDate = DateTime.Now;
for (int i = 0; i < fastLines.Count; i++)
{
var xAxis = sciChart.XAxes.OfType().FirstOrDefault();
if (xAxis != null&& xAxis.DataRange!=null)
{
var newRange = new DateRange(currentDate.AddSeconds(-60), currentDate);

                fastLines[i].XRange.Min = newRange.Min;
                //xAxis.VisibleRange = newRange;
                Application.Current.Dispatcher.BeginInvoke((Action)(() =>
                {
                    xAxis.InvalidateElement();
                }));
                sciChart.ZoomExtents();
            }
            if (fastLines[i].Count > 5 &&i>40)
            {
                break;
            }
            double y = (i + 1);
            fastLines[i].Append(currentDate, y);
        }
    });
};
timer.Start();

}

Version
8.5.0.28148
Attachments
Images
  • You must to post comments
0
0

Hi,

Thanks for your inquiry.
Please accept my apologies for the late response.

Unfortunately, it’s not clear enough what are you trying to achieve.
We have a couple of real-time examples in our WPF Examples Suite that should help you though. Here are the corresponding links:

WPF Chart FIFO 1 billion points demo – SciChart

WPF Realtime Scrolling Charts with FIFO – SciChart

WPF Realtime Ticking Stock Charts – SciChart

Hope this helps.
Otherwise please provide us with a more detailed description of your requirements.

Kind regards,
Lex,
SciChart Technical Support Engineer

  • You must to post comments
0
0

My requirement is that initially, for example, there are 10 curves drawn in parallel on the interface. After drawing for a period of time, some of them, including 5, stop. If 50 points have been drawn so far, the remaining 5 will continue to be drawn on the screen. I only want to display the last 100 points on the screen because the 5 curves that stopped in the front will never meet my previous condition if they are not drawn again. Therefore, I increased the time range value and only displayed the last hour without taking effect

  • You must to post comments
0
0

You can run my previous code to clearly identify my issue

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.