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