Page 1 of 1

FastLine not showing all plots

Posted: Wed Mar 21, 2018 4:16 pm
by 15682568
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?

Re: FastLine not showing all plots

Posted: Fri Mar 23, 2018 4:08 pm
by Christopher
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 9502 times

Re: FastLine not showing all plots

Posted: Thu Mar 29, 2018 7:34 am
by 15682568
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?

Re: FastLine not showing all plots

Posted: Thu Mar 29, 2018 9:28 am
by Christopher
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();
		}