vertical axe in a Horizontal bar graph

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Thu Dec 14, 2006 10:01 am

Hi, Ricky.

Another way to have vertical axis at specific x position (in your case 0.0) is to use the following code:

Code: Select all

...
  horizBar1.Add(-5);
  horizBar1.Add(5);
  horizBar1.Add(-2);
  horizBar1.Add(-1);
  horizBar1.GetVertAxis.Visible = false;
...

private void tChart2_BeforeDrawSeries(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
  // #1 : calculate x screen position for vertical axis
  int xpos = horizBar1.GetHorizAxis.CalcXPosValue(0.0);
  // #2 : Draw axis
  horizBar1.GetVertAxis.AxisPen.Visible = true;
  horizBar1.GetVertAxis.Draw(xpos - 10, xpos - 20, xpos, false);
}
I've tested this with TC.NET v2, but it should work with v1.x as well. I've paced the drawing code in the tChart::BeforeDrawSeries event (so that the axis is drawn behind series), but you can move it to AfterDraw event in case you want the axis to be drawn over the series.
Marjan Slatinek,
http://www.steema.com

Post Reply