Page 1 of 1

Multiple Custom Axes user-resize

Posted: Tue Aug 25, 2009 7:57 am
by 13052926
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

Re: Multiple Custom Axes user-resize

Posted: Wed Aug 26, 2009 2:17 pm
by narcis
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;
		}

Re: Multiple Custom Axes user-resize

Posted: Wed Aug 26, 2009 2:32 pm
by 13052926
You don't perhaps have that sample in VB.NET?

Re: Multiple Custom Axes user-resize

Posted: Wed Aug 26, 2009 3:07 pm
by narcis
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.

Re: Multiple Custom Axes user-resize

Posted: Thu Aug 27, 2009 6:22 am
by 13052926
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!