CursorTool hit points.
CursorTool hit points.
Hi,
I want to display all cursortool hitpoints(with series) in my chart and want to show the X and Y values as annotations.
Is there any support in CursorTool ?
Thanks,
Vijay.
I want to display all cursortool hitpoints(with series) in my chart and want to show the X and Y values as annotations.
Is there any support in CursorTool ?
Thanks,
Vijay.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Vijay,
Yes, you can do something like this:
Also notice there's MarksTip tool which already does something like this.
If you want to use a collection of Annotation tools you can do this:
Hope this helps!
Yes, you can do something like this:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.Styles.Points points1;
private Steema.TeeChart.Tools.Annotation annotation1;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
points1 = new Points(tChart1.Chart);
points1.FillSampleValues();
Steema.TeeChart.Tools.CursorTool cursor1 = new CursorTool(tChart1.Chart);
cursor1.FollowMouse = true;
cursor1.Series = points1;
cursor1.Change += new CursorChangeEventHandler(cursor1_Change);
annotation1 = new Annotation(tChart1.Chart);
}
void cursor1_Change(object sender, CursorChangeEventArgs e)
{
int index = points1.Clicked(e.x, e.y);
if (index != -1)
{
annotation1.Text = points1.XValues[index].ToString() + " - " +
points1.YValues[index].ToString();
annotation1.Shape.CustomPosition = true;
annotation1.Shape.Left = e.x;
annotation1.Shape.Top = e.y;
annotation1.Active = true;
}
else
{
annotation1.Active = false;
}
}
If you want to use a collection of Annotation tools you can do this:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.Styles.Points points1;
private Steema.TeeChart.Tools.Annotation[] annotations;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
points1 = new Points(tChart1.Chart);
points1.FillSampleValues();
Steema.TeeChart.Tools.CursorTool cursor1 = new CursorTool(tChart1.Chart);
cursor1.FollowMouse = true;
cursor1.Series = points1;
cursor1.Change += new CursorChangeEventHandler(cursor1_Change);
annotations = new Annotation[points1.Count];
for (int i = 0; i < annotations.Length; i++)
{
annotations[i] = new Steema.TeeChart.Tools.Annotation(tChart1.Chart);
annotations[i].Active = false;
}
}
void cursor1_Change(object sender, CursorChangeEventArgs e)
{
int index = points1.Clicked(e.x, e.y);
if (index != -1)
{
annotations[index].Text = points1.XValues[index].ToString() + " - " +
points1.YValues[index].ToString();
annotations[index].Shape.CustomPosition = true;
annotations[index].Shape.Left = e.x;
annotations[index].Shape.Top = e.y;
annotations[index].Active = 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 |
Hi Narcís,
Thank you for your help.
I have a number of series in my chart and i cannot associate CursorTool with any series.
And i tried and found the series hit points by,
DateTime tmp;
int index = tChart.Series[0].XValues.IndexOf(Math.Round(e.XValue, 0));
if (index >= 0)
{
tmp = DateTime.FromOADate(tChart.Series[0].YValues[index]);
}
and displayed the values using a RectangleTool.
But what i actually required is to display those values in something like a draggable marker.
Is it possible to implement DragMarks tool like support? So that i can drag those markers.
Thanks,
Vijay
Thank you for your help.
I have a number of series in my chart and i cannot associate CursorTool with any series.
And i tried and found the series hit points by,
DateTime tmp;
int index = tChart.Series[0].XValues.IndexOf(Math.Round(e.XValue, 0));
if (index >= 0)
{
tmp = DateTime.FromOADate(tChart.Series[0].YValues[index]);
}
and displayed the values using a RectangleTool.
But what i actually required is to display those values in something like a draggable marker.
Is it possible to implement DragMarks tool like support? So that i can drag those markers.
Thanks,
Vijay
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Vijay,
Ok, in that case, RectangleTool already supports dragging:
Ok, in that case, RectangleTool already supports dragging:
Code: Select all
rectangle1.AllowDrag = 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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Vijay,
You can use RectangleTool's Callout and Arrow properties as shown for Annotation tool in the examples here:
http://www.teechart.net/support/viewtopic.php?t=8568
http://www.teechart.net/support/viewtopic.php?t=5786
Hope this helps!
You can use RectangleTool's Callout and Arrow properties as shown for Annotation tool in the examples here:
http://www.teechart.net/support/viewtopic.php?t=8568
http://www.teechart.net/support/viewtopic.php?t=5786
Hope this helps!
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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi vijay,
Try this:
Try this:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.Styles.Points points1;
private Steema.TeeChart.Tools.RectangleTool rectangle1;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
points1 = new Steema.TeeChart.Styles.Points(tChart1.Chart);
points1.FillSampleValues();
Steema.TeeChart.Tools.CursorTool cursor1 = new Steema.TeeChart.Tools.CursorTool(tChart1.Chart);
cursor1.FollowMouse = true;
cursor1.Series = points1;
cursor1.Change += new Steema.TeeChart.Tools.CursorChangeEventHandler(cursor1_Change);
rectangle1 = new Steema.TeeChart.Tools.RectangleTool(tChart1.Chart);
rectangle1.AutoSize = true;
}
void cursor1_Change(object sender, Steema.TeeChart.Tools.CursorChangeEventArgs e)
{
int index = points1.Clicked(e.x, e.y);
if (index != -1)
{
rectangle1.Text = points1.XValues[index].ToString() + " - " +
points1.YValues[index].ToString();
rectangle1.Shape.CustomPosition = true;
rectangle1.Shape.Left = e.x + 30;
rectangle1.Shape.Top = e.y - 30;
//rectangle1.Callout.Visible = true; //This plots arrow's pointer.
rectangle1.Callout.Arrow.Visible = true;
rectangle1.Callout.Arrow.Color = Color.Black;
rectangle1.Callout.XPosition = e.x;
rectangle1.Callout.YPosition = e.y;
rectangle1.Active = true;
}
else
{
rectangle1.Active = false;
}
}
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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi vijay,
Yes, but you'll need to update Rectangle's positions in the Zoomed, UndoneZoom and Scroll events. For example:
http://www.teechart.net/support/viewtopic.php?t=8568
Yes, but you'll need to update Rectangle's positions in the Zoomed, UndoneZoom and Scroll events. For example:
http://www.teechart.net/support/viewtopic.php?t=8568
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 |