How to get clicked series in legend box?

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

ehdrnsep
Posts: 48
Joined: Mon Jan 12, 2015 6:52 am

How to get clicked series in legend box?

Post by ehdrnsep » Fri Sep 02, 2016 5:36 am

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?
Attachments
1.png
1.png (173.25 KiB) Viewed 4653 times

ehdrnsep
Posts: 48
Joined: Mon Jan 12, 2015 6:52 am

Re: How to get clicked series in legend box?

Post by ehdrnsep » Fri Sep 02, 2016 5:40 am

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:

User avatar
ArctionNikolai
Posts: 38
Joined: Fri Feb 05, 2016 11:37 am
Location: Finland

Re: How to get clicked series in legend box?

Post by ArctionNikolai » Tue Sep 13, 2016 7:43 am

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());
}
Nikolai Arsenov
Software developer
Arction Ltd
Microkatu 1, 70210 Kuopio, Finland