I have just started developing my first app with TChart and am finding it a great product!! I do, however, have a couple of questions on the cursor tool:
1. I have a menu option to turn on and off the cursor (In my app this is just the vertical line). When the cursor is turned on, i want it to appear in the middle of my TChart, how do i do this.
2. When the TChart is scrolled (Panned) or zoomed, if the cursor is no longer on the currently displayed graph I want to be able to put it back in the middle of the chart again.
3. I want to be able to get the current X axis series index at the cursor position, so I can retreive the Y value of all my series at the cursor position. (They are all fast lines).
I am sure these are all fairly simple tasks, but I have not been able to find out how just yet.
Martin
Cursor tool
Re: Cursor tool
Hello Martin,
There is another option, if you want you can save initial Xvalue of cursorTool and assign when you believe necessary.
I hope will helps.
Thanks,
You can use XValue for change position of cursortool, you can do something similar as next code:1. I have a menu option to turn on and off the cursor (In my app this is just the vertical line). When the cursor is turned on, i want it to appear in the middle of my TChart, how do i do this.
Code: Select all
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
cursor = new Steema.TeeChart.Tools.CursorTool(tChart1.Chart);
line1.FillSampleValues();
cursor.Style = Steema.TeeChart.Tools.CursorToolStyles.Vertical;
checkBox1.Checked = true;
tChart1.Draw();
Middlepos = tChart1.Axes.Bottom.CalcPosPoint((tChart1.Axes.Bottom.IAxisSize) / 2 + tChart1.Axes.Bottom.IStartPos);
cursor.XValue = Middlepos;
}
void checkBox1_CheckedChanged(object sender, EventArgs e)
{
cursor.Active = checkBox1.Checked;
if (!cursor.Active)
{
cursor.XValue = Middlepos;
}
}
I suggest use event UndoneZoom of Chart and in the event do something as below code:2. When the TChart is scrolled (Panned) or zoomed, if the cursor is no longer on the currently displayed graph I want to be able to put it back in the middle of the chart again.
Code: Select all
void tChart1_UndoneZoom(object sender, EventArgs e)
{
cursor.XValue = Middlepos;
}
I suggest you take a look in Demo project concretely All Features\Welcome !\Chart styles\Standard\Line(Strip)\Interpolating line series.3. I want to be able to get the current X axis series index at the cursor position, so I can retreive the Y value of all my series at the cursor position. (They are all fast lines).
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 |