Page 1 of 1

WPF Downsampling - Problem with CalcPosPoint

Posted: Tue Oct 07, 2008 12:11 am
by 14050296
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.

Posted: Tue Oct 07, 2008 9:13 am
by narcis
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.

Posted: Tue Oct 07, 2008 9:49 pm
by 14050296
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.

Posted: Wed Oct 08, 2008 7:12 am
by 14050296
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).

Posted: Wed Oct 08, 2008 10:33 am
by narcis
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.

Posted: Wed Oct 15, 2008 7:29 am
by 14050296
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.

Posted: Wed Oct 15, 2008 9:30 am
by narcis
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.

Posted: Mon Oct 20, 2008 11:46 pm
by 14050296
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.

Posted: Tue Oct 21, 2008 1:42 pm
by narcis
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.

Posted: Tue Dec 23, 2008 7:46 pm
by 14050296
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.

Posted: Wed Dec 24, 2008 8:29 am
by narcis
Hi ltang,

Yes, it's TF02013471. However we don't consider this a bug, it's a feature request.