function high/low with multiple series

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
serge wautier
Newbie
Newbie
Posts: 22
Joined: Tue Dec 16, 2008 12:00 am

function high/low with multiple series

Post by serge wautier » Tue Mar 10, 2009 9:34 am

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.

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

Post by Narcís » Tue Mar 10, 2009 3:05 pm

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

serge wautier
Newbie
Newbie
Posts: 22
Joined: Tue Dec 16, 2008 12:00 am

Post by serge wautier » Tue Mar 10, 2009 3:12 pm

Thanks Narcís.
I hoped for a solution based on the functions.
Anyway, this one is less elegant yet very efficient ;-)

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

Post by Narcís » Tue Mar 10, 2009 3:21 pm

Hi Serge,

I have added your request to the wish-list to be considered for inclusion in future releases.
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

Post Reply