Add Real Coordinates to Annotation Rectangle
Posted: Fri Oct 15, 2010 2:27 pm
Suggestion: Please add real coordinates (axes coordinates) to position units of annotation rectangle. Same as Line Tool.
Steema Software - Customer Support Forums
http://teechart.com/support/
Code: Select all
Steema.TeeChart.TChart tChart1;
public Form1()
{
InitializeComponent();
tChart1 = new Steema.TeeChart.TChart();
this.Controls.Add(tChart1);
tChart1.Dock = DockStyle.Fill;
InitializeChart();
}
Steema.TeeChart.Styles.Line series1;
Steema.TeeChart.Tools.RectangleTool tool1;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
series1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
Random rnd = new Random();
series1.Add(1000);
for (int i = 1; i < 25; i++)
{
series1.Add(series1.YValues.Value[i - 1] + rnd.Next(10));
}
tool1 = new Steema.TeeChart.Tools.RectangleTool(tChart1.Chart);
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
tChart1.Zoomed += new EventHandler(tChart1_Zoomed);
tChart1.Scroll += new EventHandler(tChart1_Scroll);
tChart1.UndoneZoom += new EventHandler(tChart1_UndoneZoom);
tChart1.Draw();
}
void tChart1_UndoneZoom(object sender, EventArgs e)
{
tChart1.Draw();
}
void tChart1_Scroll(object sender, EventArgs e)
{
tChart1.Draw();
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
tool1.Left = tChart1.Axes.Bottom.CalcXPosValue(10);
tool1.Top = tChart1.Axes.Left.CalcYPosValue(1070);
}
void tChart1_Zoomed(object sender, EventArgs e)
{
tChart1.Draw();
}
This is exactly the solution...works fine...Thank youMethod CalcXPosValue(double valueIndex): Returns the pixel Screen Horizontal coordinate of the specified Value. This coordinate is calculated using the Series associated Horizontal Axis.
Method CalcXPosValueI(double valueIndex): Returns the pixel Screen Vertical coordinate of the specified Value. This coordinate is calculated using the Series associated Vertical Axis.