Multiple Custom Axes user-resize

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
rossmc
Newbie
Newbie
Posts: 57
Joined: Wed Apr 08, 2009 12:00 am

Multiple Custom Axes user-resize

Post by rossmc » Tue Aug 25, 2009 7:57 am

Hi

I have multiple Y-Axis on a single chart. Very much like Examples\All Features\Axes\Scrolling multiple axes

I would like to have a solid horizontal line across the chart between each Y-Axis. The user can then use mouse to grab and re-position this line, allowing them to re-size the visible charts. I vaguely remember doing this with the ActiveX control so I'm sure this a built in way?

Thanks for your help
Ross

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

Re: Multiple Custom Axes user-resize

Post by Narcís » Wed Aug 26, 2009 2:17 pm

Hi Ross,

Ok, you can use ColorLine tool and use its DragLine event, for example:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}
		
		private void InitializeChart()
		{
			tChart1.Aspect.View3D = false;
			tChart1.Legend.Visible = false;
			tChart1.Panel.MarginLeft = 12;

			for (int i = 0; i < 3; i++)
			{
				tChart1.Axes.Custom.Add(new Steema.TeeChart.Axis());

				tChart1.Series.Add(new Steema.TeeChart.Styles.FastLine());
				tChart1[i].FillSampleValues();				
				tChart1[i].CustomVertAxis = tChart1.Axes.Custom[i];				
				tChart1[i].GetVertAxis.StartPosition = 33 * i;
				tChart1[i].GetVertAxis.EndPosition = 33 * (i + 1);

				Steema.TeeChart.Tools.ColorLine colorLine = new Steema.TeeChart.Tools.ColorLine(tChart1.Chart);
				colorLine.Axis = tChart1[i].GetVertAxis;
				colorLine.Value = tChart1[i].MinYValue();
				colorLine.NoLimitDrag = true;
				colorLine.DragLine += new EventHandler(colorLine_DragLine);
			}
		}

		void colorLine_DragLine(object sender, EventArgs e)
		{
			Steema.TeeChart.Tools.ColorLine colorLine = ((Steema.TeeChart.Tools.ColorLine)sender);

			int linePos = colorLine.Axis.CalcPosValue(colorLine.Value);

			Rectangle chartRect = tChart1.Chart.ChartRect;
			double pos = ((double)(linePos - chartRect.Top) / chartRect.Height) * 100;
			colorLine.Axis.EndPosition = pos;
		}
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

rossmc
Newbie
Newbie
Posts: 57
Joined: Wed Apr 08, 2009 12:00 am

Re: Multiple Custom Axes user-resize

Post by rossmc » Wed Aug 26, 2009 2:32 pm

You don't perhaps have that sample in VB.NET?

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

Re: Multiple Custom Axes user-resize

Post by Narcís » Wed Aug 26, 2009 3:07 pm

Hi Ross,

I'm afraid not. You can use automatic C# to VB.NET conversors I mentioned here. If this doesn't help don't hesitate to let us know.
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

rossmc
Newbie
Newbie
Posts: 57
Joined: Wed Apr 08, 2009 12:00 am

Re: Multiple Custom Axes user-resize

Post by rossmc » Thu Aug 27, 2009 6:22 am

No problem. Honestly I was just being a little lazy since it should be easy enough to convert what you posted. Thanks. As ever, you guys are incredibly helpful!

Post Reply