Profile Picture

Finding Legend data index on a Mouse Click

Posted By Rick Merritt 9 Years Ago
Author
Message
Nevron Support
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
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



Rick Merritt
Posted 9 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: 9 Years Ago
Posts: 3, Visits: 12
Was this ever fixed in the latest release?

Rick Merritt
Posted 9 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: 9 Years Ago
Posts: 3, Visits: 12
Any Idea for a work-around?

Nevron Support
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
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 9 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: 9 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


Similar Topics


Reading This Topic