Page 1 of 1

Legend-click event

Posted: Wed Feb 25, 2009 6:04 am
by 13051032
I capture legendclick event of a chart and display legend editor to the user with the following code. I like to capture what color user has chosen in the editor for the series after the PenEditor is displayed to the user. How can i get the color chosen by the user from the PenEditor.

Code: Select all

Private Sub MyChart_ClickLegend(ByVal sender As Object, ByVal e As MouseEventArgs)
        Dim MyChart As Steema.TeeChart.Chart = CType(sender, Steema.TeeChart.Chart)

        Dim Index As Integer = MyChart.Legend.Clicked(e.X, e.Y)
        Dim Series As Steema.TeeChart.Styles.FastLine

        If ((Index <> -1) And (MyChart.Series.Count >= Index)) Then
            Series = CType(MyChart.Series(Index), Steema.TeeChart.Styles.FastLine)
            Steema.TeeChart.Editors.PenEditor.Edit(Series.LinePen)
            'Series.Color = Series.LinePen.Color
        End If
    End Sub

Posted: Wed Feb 25, 2009 12:23 pm
by yeray
Hi asupriya,

The color is stored at LinePen.Color. The following code tests it.

Code: Select all

If ((Index <> -1) And (MyChart.Series.Count >= Index)) Then
            Series = CType(MyChart.Series(Index), Steema.TeeChart.Styles.FastLine)
            Steema.TeeChart.Editors.PenEditor.Edit(Series.LinePen)
            TChart1.Header.Font.Color = Series.LinePen.Color
        End If