Page 1 of 1

Points Chart Clicked Pointer

Posted: Tue Nov 09, 2010 10:49 pm
by 15057312
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

Re: Points Chart Clicked Pointer

Posted: Wed Nov 10, 2010 10:53 am
by narcis
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

Re: Points Chart Clicked Pointer

Posted: Wed Nov 10, 2010 11:44 pm
by 15057312
Thanks,

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

Re: Points Chart Clicked Pointer

Posted: Thu Nov 11, 2010 8:32 am
by narcis
Hi lilo,

If you comment in the code in Points1_Click is still working?

Re: Points Chart Clicked Pointer

Posted: Thu Nov 11, 2010 9:01 am
by 15057312
Yes, it works fine. Adding a line in Points1_Click made it work.

Re: Points Chart Clicked Pointer

Posted: Thu Nov 11, 2010 9:09 am
by narcis
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!