Page 1 of 1

realtime data subtract function

Posted: Wed Jun 23, 2010 1:37 pm
by 16056172
I have 2 fast line series, plotted them on the chart. Works great
I have added another fastline, associated a subtract function and the data source pointing to above mentioned 2 fastline series. Works great.

Now in realtime whenever I update my source 2 fastlines with another data point. ( of course data points added - point to the same datetime on x series)
the difference is not udpated on the fastline (the one that has the subtract function)

Should I be calling Invalidate or CheckDataSource on the series to show the diff?

Regards,
Vish

Re: realtime data subtract function

Posted: Wed Jun 23, 2010 1:46 pm
by narcis
Hi Vish,

Yes, exactly. You should call CheckDataSource to recalculate the function series.

Re: realtime data subtract function

Posted: Wed Jun 23, 2010 3:01 pm
by 16056172
That is working out fine.

Issue with Min and Max on Y axis.

The y-axis for the diff line is to Right Axis

Since I set the Axis to automatic, I thought it would scale properly. Most of the time it does and sometimes it shows the min as 0 and max as 100. My diff series range is in -2 to +3 only.

Please advise.

Re: realtime data subtract function

Posted: Wed Jun 23, 2010 3:11 pm
by narcis
Hi vk_nomura,

Can you please attach a simple example project with which we can reproduce the problem here?

Thanks in advance.

Re: realtime data subtract function

Posted: Wed Jun 23, 2010 3:45 pm
by 16056172
I know what the problem is and here is the scenario:

When it comes to subtract function, as long as you have valid vaues, everything is fine. But when you have a null value for one of the data points, thats where I see the issue:

Example:
Series1 -> Datapoint1: x = 0 and y = 99
Series2 -> Datapoint1: x = 0 and y = 100
Subtract function returns 1(which is correct)

Series1 -> Datapoint2: x = 0 and y = 99
Series2 -> Datapoint2: x = 0 and y = null
Subtract function returns 99 -> this I do not want to see. I would rather see a "blank space" meaning no-paint. than 99. This messes up the graph.

Please advise.

Regards,

Re: realtime data subtract function

Posted: Fri Jun 25, 2010 1:13 pm
by 16056172
The issue has been resolved. We had to do lot of data cleansing before we applied the it to the graph.

Re: realtime data subtract function

Posted: Fri Jun 25, 2010 1:36 pm
by narcis
Hi vk_nomura,

I'm glad to hear you solved the issue. An option for supporting null values in a function is doing something like this:

Code: Select all

    public Form1()
    {
      InitializeComponent();
      InitializeChart();
    }

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;

      Steema.TeeChart.Styles.Points points1 = new Steema.TeeChart.Styles.Points(tChart1.Chart);
      Steema.TeeChart.Styles.Points points2 = new Steema.TeeChart.Styles.Points(tChart1.Chart);

      points1.Add(0, 99);
      //points2.Add(0, 100);
      points2.Add();

      Steema.TeeChart.Functions.Subtract subtract1 = new Steema.TeeChart.Functions.Subtract();

      Steema.TeeChart.Styles.Points points3 = new Steema.TeeChart.Styles.Points(tChart1.Chart);
      points3.Function = subtract1;
      points3.DataSource = new object[] {points1, points2};

      for (int i = 0; i < points3.Count; i++)
      {
        if (points1.IsNull(i) || points2.IsNull(i))
        {
          points3.SetNull(i);
        }
      }

    }