Profile Picture

Finding Legend data index on a Mouse Click

Posted By Rick Merritt 6 Years Ago
Author
Message
Rick Merritt
Posted 6 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 6 Years Ago
Posts: 3, Visits: 12
I am trying to turn line series on and off based on a user clicking on the legend data item.  Unfortunately the hit test always returns a 0 (zero) no matter which cell I click on in the legend.  Any help would be appreciated.




Tags
Nevron Support
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)

Group: Forum Members
Last Active: 1 days ago @ 7:47 AM
Posts: 2,945, Visits: 3,303
So far it looks like a bug in the control we'll investigate it further and fix it for the upcoming 2015 release.

Best Regards,
Nevron Support Team



Rick Merritt
Posted 6 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 6 Years Ago
Posts: 3, Visits: 12
Any Idea for a work-around?

Rick Merritt
Posted 6 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 6 Years Ago
Posts: 3, Visits: 12
Was this ever fixed in the latest release?

Nevron Support
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)Supreme Being (4,063 reputation)

Group: Forum Members
Last Active: 1 days ago @ 7:47 AM
Posts: 2,945, Visits: 3,303
Hi Rick,

This issue is not present in the 2015 release - we just tested with the following code and it was working OK:

private void Form1_Load(object sender, EventArgs e)
{
NChart chart = nChartControl1.Charts[0];

NBarSeries bar = new NBarSeries();
bar.Legend.Mode = SeriesLegendMode.DataPoints;

for (int i = 0; i < 10; i++)
{
bar.Values.Add(i);
}

chart.Series.Add(bar);

nChartControl1.MouseClick += new MouseEventHandler(nChartControl1_MouseClick);
}

void nChartControl1_MouseClick(object sender, MouseEventArgs e)
{
NHitTestResult result = nChartControl1.HitTest(e.X, e.Y);

if (result.ChartElement == ChartElement.LegendDataItem)
{
int index = result.LegendDataItemIndex;
}
}


Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic