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

0
0

Hi there,

I’m writing an ECG display and I use a fixed chart (0-10 sec X axes) and append data. When it draws to the right edge (time = 10 sec), I reset time to zero for series to reappear at the left edge. I don’t clear the chart, because I don’t want to clear previous data so I use the FIFO buffer for erase after 9 sec.

There is a problem. When I reset the time, the last line drawn is a horizontal line (from x =10 (the right edge) to x=0 (the left edge)
), because the line I believe has X1=rightedge and X2=leftedge. How can I set the X2= rightedge or make the series to begin at X=0 ?

int count = 0;
double time = 0;
double cont = 10;
public void Plot()
{
while (stop == false)
{
Dispatcher.BeginInvoke((Action)delegate
{
if (bufSampleFiltered.Count() > count)
{
short[] sample = bufSampleFiltered[count].value;
time = time + bufSampleFiltered[count].milliseconds;
count++;
if (time > cont)
{ time = 0; cont = +10; }

                    ((WpfDisplaySciChartViewModel)myWpfDisplaySciChart.DataContext).Plot(sample, time);


                }
            },
            DispatcherPriority.Render);
            if (stop == true)
                break;

            Thread.Sleep(1);
        }
    }

Thanks!

  • You must to post comments
0
0

Hi there,

Thank you for your enquiry about SciChart! Have you as a starting point used our ECG example? If not, please take a look at this as it might answer some of your questions.

I think what you want to do differently (correct me if I’m wrong), is to restart the trace at zero on the left side when it touches the right side (instead of scroll 50%). While keeping the old trace on the graph, is that right? If so we have a couple of forum posts which might be useful:

What we suggest is to have two DataSeries on the chart and actually update them like this (see attached).

Does that help answer the question?

It’s not something I’ve tested but I have a hunch it will work. Swap between using two RenderableSeries and don’t change the X-values. Just append or Update Y-values. You can set a Y-value = double.NaN to treat it as a Null value. This will allow you to have two DataSeries with a discontinuous jump like an ECG.

Let me know how you get on. I’d be interested to hear if it works!

Best regards,
Andrew

Images
  • info@cardioline.it
    Hi,To avoid the horizontal line from righedge=10 to leftedge=0 I call render->append(10 [therightedgeX], double.NAN), and it works!
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.