WPF Downsampling - Problem with CalcPosPoint

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
ltang
Newbie
Newbie
Posts: 8
Joined: Mon Sep 15, 2008 12:00 am
Contact:

WPF Downsampling - Problem with CalcPosPoint

Post by ltang » Tue Oct 07, 2008 12:11 am

Hi,

I setup two series as below:

DownSampling sampling = new DownSampling();

Point s1 = new Point();
Line s2 = new Line();

chart.Add(s1);
chart.Add(s2);

s1.Add(xValues, yValues)
s2.DataSource = s1;
s2.Function = sampling;

Should I change the the bold code to s1.DataSource = yValues (i.e. not to specify xValues), downsampling would work properly.

In my investigation, it seems that when both xValues and yValues are specified explicitly, the function CalcPosPoint not returning the right value. Would it be possible that bold code have problem:

tmp *= iRange / IAxisSize;

The code above does not consider xValues when it is specified specifically.

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

Post by Narcís » Tue Oct 07, 2008 9:13 am

Hi ltang,

Could you please let us know the TeeChart build number you are using and the exact code that works fine for you?

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

ltang
Newbie
Newbie
Posts: 8
Joined: Mon Sep 15, 2008 12:00 am
Contact:

Post by ltang » Tue Oct 07, 2008 9:49 pm

I am using:
Release Notes 23rd September 2008
TeeChart.NET version 3
Build 3.5.3188.18562

Code: Select all

Points rawSeries = new Points();                   
Line reduceSeries = new Line();

tChart.Series.Add(rawSeries );
tChart.Series.Add(reduceSeries);

DownSampling sampling = new DownSampling(tChart.Chart);                    
sampling.DisplayedPointCount = 500;
reduceSeries .Function = sampling;
reduceSeries .DataSource = rawSeries ;

Array xPoints, yPoints;
....
//Populate X and Y with 3000 points
...

rawSeries.Add(yPoints);
reduceSeries .CheckDataSource();
The above code works fine.

When I change from rawSeries.Add(yPoints); to rawSeries.Add(xPoints, yPoints);, DownSampling no longer gives the same output as before.

ltang
Newbie
Newbie
Posts: 8
Joined: Mon Sep 15, 2008 12:00 am
Contact:

Post by ltang » Wed Oct 08, 2008 7:12 am

Actually I have found that the problem in DownSampling.cs where Tolerance is calculated based on DisplayedPointCount.

Code: Select all

if (DisplayedPointCount > 0)
 {                    
      tmpTol = DisplayedPointCount / 4.0;
      tmpTol = N / tmpTol;
 }
when the array XValues is not specified, e.g, series.Add(YValues), the N in the code above would work.

When XValues is set, e.g., series.Add(XValues, YValues), the calculation of tolerance does not take into account XValues and hence the output of downsampling is no longer valid (under sampling or over sampling).

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

Post by Narcís » Wed Oct 08, 2008 10:33 am

Hi ltang,

Thanks for the information but we are not able to reproduce the issue here. Would you be so kind to send us a simple example project we can run "as-is" to reproduce the issue here?

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

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

ltang
Newbie
Newbie
Posts: 8
Joined: Mon Sep 15, 2008 12:00 am
Contact:

Post by ltang » Wed Oct 15, 2008 7:29 am

narcis wrote:Hi ltang,

Thanks for the information but we are not able to reproduce the issue here. Would you be so kind to send us a simple example project we can run "as-is" to reproduce the issue here?

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.
Hi Narcis

I have uploaded a zip file containing screen captures describing when DownSampling's OK and when it is NOT ok.

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

Post by Narcís » Wed Oct 15, 2008 9:30 am

Hi ltang,

Thanks for the images but could you please arrange a simple example project we can run "as-is" and let us know the exact steps we should follow to 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

ltang
Newbie
Newbie
Posts: 8
Joined: Mon Sep 15, 2008 12:00 am
Contact:

Post by ltang » Mon Oct 20, 2008 11:46 pm

I have sent source code to public.attachments.

The code tries to show problem of downsampling. Look forwards to your comments. Thanks.
narcis wrote:Hi ltang,

Thanks for the images but could you please arrange a simple example project we can run "as-is" and let us know the exact steps we should follow to reproduce the problem here?

Thanks in advance.

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

Post by Narcís » Tue Oct 21, 2008 1:42 pm

Hi ltang,

Thanks for the example project.

The problem there is that your X values are descending. While when only adding Y values TeeChart automatically adds sequential ascending X values. DownSampling was not designed to work with ValueLists that were not ascending. I'll add your request to the wish-list to be considered for inclusion in future release.
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

ltang
Newbie
Newbie
Posts: 8
Joined: Mon Sep 15, 2008 12:00 am
Contact:

Post by ltang » Tue Dec 23, 2008 7:46 pm

narcis wrote:Hi ltang,

Thanks for the example project.

The problem there is that your X values are descending. While when only adding Y values TeeChart automatically adds sequential ascending X values. DownSampling was not designed to work with ValueLists that were not ascending. I'll add your request to the wish-list to be considered for inclusion in future release.
Hi narcis,

Is there a tracking number so that I would know when problem would be resolved? Thanks.

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

Post by Narcís » Wed Dec 24, 2008 8:29 am

Hi ltang,

Yes, it's TF02013471. However we don't consider this a bug, it's a feature request.
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