I have a chart and I whant to draw a horizontal line within chart painting area (I mean rectangle between axes) from left to right. Printing area left coordinate I can calculate as tChart1.Axes.Left.Position.
How can I get prinring area rigth coordinate?
BTW using tChart1.Axes.Right.Position returnes position even more left than tChart1.Axes.Left.Position and using tChart1.ClientRectangle.Right returnes right coordinate of whole chart but not painting area.
Howto get painting area right screen coordinate
Re: Howto get painting area right screen coordinate
Hello bairog,
I made a simple example that you can use in your application, using after draw event and chart rect. Please see next code and check that works as you want:
I hope will helps.
Thanks
I made a simple example that you can use in your application, using after draw event and chart rect. Please see next code and check that works as you want:
Code: Select all
private void InitializeChart()
{
Steema.TeeChart.Styles.Bar bar = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
bar.FillSampleValues();
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
Rectangle rect = new Rectangle();
//------Calculate depth position----------------//
int wall1 = (int)((-(Math.Cos(60)) * (tChart1.Axes.Depth.IAxisSize)) + tChart1.Axes.Depth.Maximum);
rect = tChart1.Chart.ChartRect;
//-------If tChart.Aspect.view3D=true use wall1 but if false not.//
if (tChart1.Aspect.View3D)
{
g.HorizontalLine(rect.Left, rect.Right + wall1, rect.Height / 2);
}
else
{
g.HorizontalLine(rect.Left, rect.Right, rect.Height / 2);
}
}
Thanks
Best Regards,
Sandra Pazos / 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 |