Hi there,
I am trying to work out how to position the x / bottom axis at position 0 on the y axis. The documentation says you can position it using a percentage of the way along / up the y axis but this seems completely wrong for my needs.
I am doing quite a simple bar chart with year (datetime) data along the x axis and numerical values up the y axis. At present the axis seems to be located at the minimum end of the y axis.
Thanks
Matt Wilkinson
British Land
Positioning x axis absolutely
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Matt,
You can implement the following code at the BeforeDrawSeries event to get this behaviour.
You can implement the following code at the BeforeDrawSeries event to get this behaviour.
Code: Select all
private void tChart1_BeforeDrawSeries(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
int posaxis;
if (tChart1.Axes.Left.Maximum > 0)
{
posaxis = (tChart1.Axes.Left.CalcYPosValue(0));
tChart1.Axes.Bottom.Draw (posaxis + 10, posaxis + 40, posaxis, true);
}
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Thanks Narcis,
This event doesn't seem to fire for some reason. I have added this to the InitializeComponent() method of the code behind:
this.WebChart1.BeforeDraw += new Steema.TeeChart.PaintChartEventHandler(this.WebChart1_BeforeDraw);
Also, when you look at the control properties in design view the event seems to have wired up properly. I am testing it by putting a break point on the first line of the event code.
Is there some weird secret to making this work?
event code:
private void WebChart1_BeforeDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
int posaxis;
if (this.WebChart1.Chart.Axes.Left.Maximum > 0)
{
posaxis = (WebChart1.Chart.Axes.Left.CalcYPosValue(0));
WebChart1.Chart.Axes.Bottom.Draw (posaxis + 10, posaxis + 40, posaxis, true);
}
}
Matt
This event doesn't seem to fire for some reason. I have added this to the InitializeComponent() method of the code behind:
this.WebChart1.BeforeDraw += new Steema.TeeChart.PaintChartEventHandler(this.WebChart1_BeforeDraw);
Also, when you look at the control properties in design view the event seems to have wired up properly. I am testing it by putting a break point on the first line of the event code.
Is there some weird secret to making this work?
event code:
private void WebChart1_BeforeDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
int posaxis;
if (this.WebChart1.Chart.Axes.Left.Maximum > 0)
{
posaxis = (WebChart1.Chart.Axes.Left.CalcYPosValue(0));
WebChart1.Chart.Axes.Bottom.Draw (posaxis + 10, posaxis + 40, posaxis, true);
}
}
Matt