realtime data subtract function

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
vk_nomura
Newbie
Newbie
Posts: 12
Joined: Mon May 17, 2010 12:00 am

realtime data subtract function

Post by vk_nomura » Wed Jun 23, 2010 1:37 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: realtime data subtract function

Post by Narcís » Wed Jun 23, 2010 1:46 pm

Hi Vish,

Yes, exactly. You should call CheckDataSource to recalculate the function series.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

vk_nomura
Newbie
Newbie
Posts: 12
Joined: Mon May 17, 2010 12:00 am

Re: realtime data subtract function

Post by vk_nomura » Wed Jun 23, 2010 3:01 pm

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: realtime data subtract function

Post by Narcís » Wed Jun 23, 2010 3:11 pm

Hi vk_nomura,

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

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

vk_nomura
Newbie
Newbie
Posts: 12
Joined: Mon May 17, 2010 12:00 am

Re: realtime data subtract function

Post by vk_nomura » Wed Jun 23, 2010 3:45 pm

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,

vk_nomura
Newbie
Newbie
Posts: 12
Joined: Mon May 17, 2010 12:00 am

Re: realtime data subtract function

Post by vk_nomura » Fri Jun 25, 2010 1:13 pm

The issue has been resolved. We had to do lot of data cleansing before we applied the it to the graph.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: realtime data subtract function

Post by Narcís » Fri Jun 25, 2010 1:36 pm

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);
        }
      }

    }
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply