Add Real Coordinates to Annotation Rectangle
Add Real Coordinates to Annotation Rectangle
Suggestion: Please add real coordinates (axes coordinates) to position units of annotation rectangle. Same as Line Tool.
Re: Add Real Coordinates to Annotation Rectangle
All of my text positions are coded using real coordinates. Also using pixels or percent could make exact repositioning of the annotation rectangle difficult when the chart is resized.
Re: Add Real Coordinates to Annotation Rectangle
Hello lilo,
You have to recalculate the annotation or rectangular tool position with CalcXPos and CalcYPos methods every time the chart is drown or scrolled, or zoomed using AfterDraw event. You can do something similar as next example:
Could you please, tell us if previous code works as you want?
I hope will helps.
Thanks,
You have to recalculate the annotation or rectangular tool position with CalcXPos and CalcYPos methods every time the chart is drown or scrolled, or zoomed using AfterDraw event. You can do something similar as next example:
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();
}
I hope will helps.
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 |
Re: Add Real Coordinates to Annotation Rectangle
What are the units of the returned value?
Re: Add Real Coordinates to Annotation Rectangle
Hello lilo,
Please see next explanations extracted to TeeChart.Net help manual:
Method 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.
Method CalcXPos(int valueIndex): Returns the pixel Screen Horizontal coordinate of the ValueIndex Series value. This coordinate is calculated using the Series associated Horizontal Axis.
Method CalcYPos(int valueIndex): Returns the pixel Screen Vertical coordinate of the ValueIndex Series value. This coordinate is calculated using the Series associated Vertical Axis.
Thanks,
Please see next explanations extracted to TeeChart.Net help manual:
Method 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.
Method CalcXPos(int valueIndex): Returns the pixel Screen Horizontal coordinate of the ValueIndex Series value. This coordinate is calculated using the Series associated Horizontal Axis.
Method CalcYPos(int valueIndex): Returns the pixel Screen Vertical coordinate of the ValueIndex Series value. This coordinate is calculated using the Series associated Vertical Axis.
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 |
Re: Add Real Coordinates to Annotation Rectangle
Sorry, I should have checked the help.
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.