Points Chart Clicked Pointer

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
lilo
Newbie
Newbie
Posts: 61
Joined: Thu Sep 23, 2010 12:00 am

Points Chart Clicked Pointer

Post by lilo » Tue Nov 09, 2010 10:49 pm

Hi,

I am loading data into a points chart:

Sub PlotPoints1
Points1.Chart.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Auto
Points1.Chart.Axes.Left.Labels.Style = Steema.TeeChart.AxisLabelStyle.Auto
Points1.Clear()
Points1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.None
Points1.YValues.Order = Steema.TeeChart.Styles.ValueListOrder.None
Dim i As Long
For i = 0 To Numberofsamples
Points1.Add(XDataA(i ), YData(i), "", Colorofsample(i ))
Next i
End Sub

I plan on using the annotation callout to track pointer data. I have this feature working for the ternary plots.
Now I need a points chart.

I cannot get the Points1_ClickPointer event to fire when the pointer is clicked on a points chart. Please check. I have tried in an existing project and in a new project starting from scratch.

Private Sub Points1_ClickPointer(ByVal series As Steema.TeeChart.Styles.CustomPoint, ByVal valueIndex As Integer, ByVal x As Integer, ByVal y As Integer) Handles Points1.ClickPointer
SetCallout(valueIndex, x, y)
End Sub

Private Sub SetCallout(ByVal AIndex As Integer, ByVal x As Integer, ByVal y As Integer)
Dim tmp1 As String, tmp2 As String
tmp1 = Points1.XValues(AIndex)
tmp2 = Points1.YValues(AIndex)
tmp1 = Format(Val(tmp1), "##0")
tmp2 = Format(Val(tmp2), "##0")
AnnotationChart4.Text = String.Format("Point: {0} {4}Value: {1} {2}", AIndex.ToString() + 1, tmp1, tmp2, vbCrLf)
' Re-position annotation callout
AnnotationChart4.Callout.ArrowHead = Steema.TeeChart.Styles.ArrowHeadStyles.Line
AnnotationChart4.Active = True
With AnnotationChart4.Callout
.Visible = True
.XPosition = x
.YPosition = y
.ZPosition = 0
End With
End Sub

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Points Chart Clicked Pointer

Post by Narcís » Wed Nov 10, 2010 10:53 am

Hi lilo,

Thanks for reporting. This is a bug (TF02015273) which I have added to the defect list to be fixed.

In the meantime you can do as in the All Features\Welcome !\Tools\Annotation\Annotation Callout example in the new features demo or use series' Click event, for example:

Code: Select all

    Private Sub Points1_Click(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Points1.Click
        Dim i As Integer = Points1.Clicked(e.X, e.Y)
        SetCallout(i, e.X, e.Y)
    End Sub
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

lilo
Newbie
Newbie
Posts: 61
Joined: Thu Sep 23, 2010 12:00 am

Re: Points Chart Clicked Pointer

Post by lilo » Wed Nov 10, 2010 11:44 pm

Thanks,

After adding your code, the orginal event code is now working. This fixed it!

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Points Chart Clicked Pointer

Post by Narcís » Thu Nov 11, 2010 8:32 am

Hi lilo,

If you comment in the code in Points1_Click is still working?
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

lilo
Newbie
Newbie
Posts: 61
Joined: Thu Sep 23, 2010 12:00 am

Re: Points Chart Clicked Pointer

Post by lilo » Thu Nov 11, 2010 9:01 am

Yes, it works fine. Adding a line in Points1_Click made it work.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Points Chart Clicked Pointer

Post by Narcís » Thu Nov 11, 2010 9:09 am

Hi lilo,

Yes, so I see. Code below works fine:

Code: Select all

        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }

        private void InitializeChart()
        {
            Steema.TeeChart.Styles.Points points1 = new Steema.TeeChart.Styles.Points(tChart1.Chart);
            points1.FillSampleValues();

            points1.ClickPointer += new Steema.TeeChart.Styles.CustomPoint.ClickPointerEventHandler(points1_ClickPointer);
            tChart1.ClickSeries += new Steema.TeeChart.TChart.SeriesEventHandler(tChart1_ClickSeries);
        }

        void tChart1_ClickSeries(object sender, Steema.TeeChart.Styles.Series s, int valueIndex, MouseEventArgs e)
        {
            //throw new NotImplementedException();
        }

        void points1_ClickPointer(Steema.TeeChart.Styles.CustomPoint series, int valueIndex, int x, int y)
        {
            MessageBox.Show("Pointer clicked: " + valueIndex.ToString());
        }
Thanks for your feedback!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply