Page 1 of 1

How to get clicked series in legend box?

Posted: Fri Sep 02, 2016 5:36 am
by ehdrnsep
I want get clicked series in legend box.

Code: Select all

chart.ViewXY.LegendBox.SeriesTitleMouseClick += LegendBox_SeriesTitleMouseClick;
...
private void LegendBox_SeriesTitleMouseClick(object sender, SeriesTitleMouseActionEventArgs e)
{
    //not fired
}
I regist "SeriesTitleMouseClick" event. But not fired.

How to get clicked series in legend box?

Re: How to get clicked series in legend box?

Posted: Fri Sep 02, 2016 5:40 am
by ehdrnsep
I finded answer.

http://forum.arction.com/viewtopic.php? ... lick#p1639

LegendBox.MoveFromSeriesTitle must be disabled, otherwise the Series* event's are not available.

Code: Select all

chart.ViewXY.LegendBox.MoveFromSeriesTitle = false;
chart.ViewXY.LegendBox.SeriesTitleMouseClick += LegendBox_SeriesTitleMouseClick;
...
private void LegendBox_SeriesTitleMouseClick(object sender, SeriesTitleMouseActionEventArgs e)
{
    //fired~
}

Thank you~! :lol:

Re: How to get clicked series in legend box?

Posted: Tue Sep 13, 2016 7:43 am
by ArctionNikolai
Hello,

Thank you for your question. I am very sorry for the delay.

You are doing everything right:
- Disable legend box move from series title.
- Registration an event.

Then you can access to series from SeriesTitleMouseActionEventArgs that are already as a parameter. From that you can get all the information about clicked serie.

Code: Select all

private void LegendBox_SeriesTitleMouseClick(object sender, SeriesTitleMouseActionEventArgs e)
{
    var series = e.Series as *YOUR SERIES TYPE*;
    MessageBox.Show("Amount of points in serie: " + series.PointCount.ToString());
}