FastLine skipping null data points

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Charles Cruden
Newbie
Newbie
Posts: 9
Joined: Wed Nov 18, 2009 12:00 am

FastLine skipping null data points

Post by Charles Cruden » Wed Feb 10, 2010 6:20 pm

Using TeeChart.WPF.dll 4.0.2009.35592, we are trending data which occasionally has null points which we want to represent by blanks on the drawn line. We're finding that if we use FastLine (in an attempt to improve rendering performance), these null points are occasionally skipped: the rendered series appears to include data. As it's important that the line displayed be accurate, that's a big problem. If we switch to a Line instead of a FastLine, the problem disappears (all the points are properly rendered) but there's a performance drop at the same time. Is FastLine meant to do that or is this a bug? I realise that FastLine is meant to compact the amount of data rendered, but in this case its rendering is generating line segments which are occasionally quite long (several dozen pixels) and quite clearly going through areas where there should be no data.

The following code demonstrates the problem. Generate a standard WPF app with a single TChart as the only control (named "chart"). The code below generates a sine wave with no interruptions for the first half and regular interruptions on the second. If I maximize the application, all the data renders correctly. If I make it a little smaller (say 1024x768 pixels), the data begins to become inaccurate, particularly around the cusp of the low part of the sine wave. If I change the FastLine to a Line, the rendering is correct at all application sizes.

Code: Select all

        void GenerateLine(out List<double> xValues, out List<double> yValues)
        {
            xValues = new List<double>();
            yValues = new List<double>();

            for (int i = 0; i < 1000; i++)
            {
                xValues.Add(i);
                yValues.Add(System.Math.Sin(3.1415926535 * i / 500) * 100);
            }
        }

        public Window1()
        {
            InitializeComponent();

            chart.Aspect.ApplyZOrder = false;
            chart.Aspect.Chart3DPercent = 0;

            Axis axis = new Axis(false, false, chart.Chart);
            chart.Axes.Custom.Add(axis);

            FastLine line = new FastLine();
            line.DrawAllPoints = false;
            line.Title = "Line";
            chart.Series.Add(line);
            line.TreatNulls = TreatNullsStyle.DoNotPaint;

            List<double> xValues;
            List<double> yValues;

            GenerateLine(out xValues, out yValues);

            line.BeginUpdate();

            line.XValues.Clear();
            line.XValues.Value = xValues.ToArray();
            line.XValues.Count = xValues.Count;

            line.YValues.Clear();
            line.YValues.Value = yValues.ToArray();
            line.YValues.Count = yValues.Count;

            for (int i = 500; i < 1000; i += 20)
                for (int j = 0; j < 10; j++)
                    line.SetNull(j + i);

            line.Invalidate();
            line.EndUpdate();
        }

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

Re: FastLine skipping null data points

Post by Narcís » Wed Feb 10, 2010 7:41 pm

Hi Charles,

If I understood the problem correctly I think I can't reproduce it here using latest TeeChart for .NET v2009 release which is build 4.0.2009.42281/2/3. Below there are two images 1024*768 I get here using your code. Can you see the differences you speak about with those images? If so, can you please indicate them to us? If not, can you please try if latest build available solves the problem at your end?

FastLine:
SineFastLine.jpg
SineFastLine.jpg (289.42 KiB) Viewed 4913 times
Line:
SineLine.jpg
SineLine.jpg (294.51 KiB) Viewed 4914 times
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

Charles Cruden
Newbie
Newbie
Posts: 9
Joined: Wed Nov 18, 2009 12:00 am

Re: FastLine skipping null data points

Post by Charles Cruden » Thu Feb 11, 2010 7:12 pm

Yes, it looks like this problem is corrected by moving to the most recent version of TeeChart.

Post Reply