Page 1 of 1

function high/low with multiple series

Posted: Tue Mar 10, 2009 9:34 am
by 13051164
v 3.5.3225.32185 / VS 2008 / .NET 2.0

Hi,

First, I'm trying to have a series which draws a flat lineshowing the max value of a series. Easy: Use the high function. Data source = the series. Function period = 0. Works fine.

Now, I want the same (one) flat line to show the max value of all points in 2 series -> I add the 2nd series to the data source.

Unfortunately, it doesn't behave the same way: My High series receives a point for each XValue of the 2 other series. Such as if Period = 1.

How can I solve this?

TIA,
Serge.

Posted: Tue Mar 10, 2009 3:05 pm
by narcis
Hi Serge,

In that case you can do this:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
			bar1.FillSampleValues();

			Steema.TeeChart.Styles.Bar bar2 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
			bar2.FillSampleValues();

			double tmpMax = tChart1[0].MaxYValue();
			double tmpMin = tChart1[0].MinYValue();

			for (int i = 1; i < tChart1.Series.Count; i++)
			{
				tmpMax = Math.Max(tmpMax, tChart1[i].MaxYValue());
				tmpMin = Math.Min(tmpMax, tChart1[i].MinYValue()); 
			}
			
			Steema.TeeChart.Styles.Line maxLine = new Steema.TeeChart.Styles.Line(tChart1.Chart);
			Steema.TeeChart.Styles.Line minLine = new Steema.TeeChart.Styles.Line(tChart1.Chart);

			maxLine.Add(tChart1[0].MinXValue(), tmpMax);
			maxLine.Add(tChart1[0].MaxXValue(), tmpMax);

			minLine.Add(tChart1[0].MinXValue(), tmpMin);
			minLine.Add(tChart1[0].MaxXValue(), tmpMin);
		}

Posted: Tue Mar 10, 2009 3:12 pm
by 13051164
Thanks NarcĂ­s.
I hoped for a solution based on the functions.
Anyway, this one is less elegant yet very efficient ;-)

Posted: Tue Mar 10, 2009 3:21 pm
by narcis
Hi Serge,

I have added your request to the wish-list to be considered for inclusion in future releases.