FastLine not showing all plots

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
HotStage
Newbie
Newbie
Posts: 2
Joined: Thu Dec 14, 2017 12:00 am

FastLine not showing all plots

Post by HotStage » Wed Mar 21, 2018 4:16 pm

Hi ,

I have a fastline chart that loops back on itself with the following points:

var dblIndex= new double[30] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 16, 17, 18, 19,20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 };
// Temperature
var dblXData= new double[30] { 100, 110 ,120 ,130 ,140, 150 ,160 ,170, 180, 180, 170, 160, 150, 140, 130, 100, 110, 120, 130, 140, 150, 160, 170, 180, 180, 170, 160, 150, 160, 170 };
// Power
var dblYData= new double[30] { 0, 0, -3, -10, -7, -5, -3, -2, 0, 0, 2, 3, 7, 5, 3 , 0, -1, -4, -11, -8, -6, -4, -3, -1, -1, 3, 4, 8, 6, 4 };

However if I change my axis limits to 128 to 165, the chart cuts off alot of data.
I noticed that this has something to do with the X value of the last point in the series and that this behaviour can be overridden by setting the Fastline->calcVisiblePoints boolean to *false*. However this is a protected field so I cant do this programmatically.
Am I doing something incorrect here?
Attachments
Axis 128 to 165.jpg
Data missing when limits are 128 to 165
Axis 128 to 165.jpg (71.99 KiB) Viewed 9569 times
Axis 128 to 182.jpg
All data visible when x axes limits are 128 to 182
Axis 128 to 182.jpg (102.1 KiB) Viewed 9566 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: FastLine not showing all plots

Post by Christopher » Fri Mar 23, 2018 4:08 pm

Hello!
HotStage wrote: I noticed that this has something to do with the X value of the last point in the series and that this behaviour can be overridden by setting the Fastline->calcVisiblePoints boolean to *false*. However this is a protected field so I cant do this programmatically.
Am I doing something incorrect here?
I think you should be able to get what you want by setting the Order of the ValueLists to None, e.g.

Code: Select all

		private void InitializeChart()
		{
			var dblXData = new double[30] { 100, 110, 120, 130, 140, 150, 160, 170, 180, 180, 170, 160, 150, 140, 130, 100, 110, 120, 130, 140, 150, 160, 170, 180, 180, 170, 160, 150, 160, 170 };
			// Power
			var dblYData = new double[30] { 0, 0, -3, -10, -7, -5, -3, -2, 0, 0, 2, 3, 7, 5, 3, 0, -1, -4, -11, -8, -6, -4, -3, -1, -1, 3, 4, 8, 6, 4 };

			FastLine series = new FastLine(tChart1.Chart);
			series.XValues.Order = ValueListOrder.None;
			series.YValues.Order = ValueListOrder.None;
			series.Add(dblXData, dblYData);

			tChart1.Axes.Bottom.SetMinMax(128, 165);
		}
which gives me:
TeeChartPro_2018-03-23_17-07-40.png
TeeChartPro_2018-03-23_17-07-40.png (15.4 KiB) Viewed 9538 times
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

HotStage
Newbie
Newbie
Posts: 2
Joined: Thu Dec 14, 2017 12:00 am

Re: FastLine not showing all plots

Post by HotStage » Thu Mar 29, 2018 7:34 am

Hi Christopher,

Is it possible to manually define a subset of points to plot?
For example, would it be possible to only show points 4 to 7?

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: FastLine not showing all plots

Post by Christopher » Thu Mar 29, 2018 9:28 am

Hello,
HotStage wrote:
Is it possible to manually define a subset of points to plot?
For example, would it be possible to only show points 4 to 7?
Yes, it is - we can work directly with the arrays the series draws with code similar to the following:

Code: Select all

		FastLine series;
		double[] dblXData, dblYData;
		private void InitializeChart()
		{
			dblXData = new double[30] { 100, 110, 120, 130, 140, 150, 160, 170, 180, 180, 170, 160, 150, 140, 130, 100, 110, 120, 130, 140, 150, 160, 170, 180, 180, 170, 160, 150, 160, 170 };
			// Power
			dblYData = new double[30] { 0, 0, -3, -10, -7, -5, -3, -2, 0, 0, 2, 3, 7, 5, 3, 0, -1, -4, -11, -8, -6, -4, -3, -1, -1, 3, 4, 8, 6, 4 };

			series = new FastLine(tChart1.Chart);
			series.XValues.Order = ValueListOrder.None;
			series.YValues.Order = ValueListOrder.None;
			series.Add(dblXData, dblYData);

			tChart1.Axes.Bottom.SetMinMax(128, 165);
		}

		private void button1_Click(object sender, EventArgs e)
		{
			var newX = dblXData.Skip(3).Take(4).ToArray();
			var newY = dblYData.Skip(3).Take(4).ToArray();

			series.XValues.Count = newX.Count();
			series.YValues.Count = newY.Count();
			series.XValues.Value = newX;
			series.YValues.Value = newY;

			tChart1.Invalidate();
		}
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply