By Rick Merritt - 9 Years Ago
|
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.
|
By Nevron Support - 9 Years Ago
|
So far it looks like a bug in the control we'll investigate it further and fix it for the upcoming 2015 release.
|
By Rick Merritt - 9 Years Ago
|
Any Idea for a work-around?
|
By Rick Merritt - 9 Years Ago
|
Was this ever fixed in the latest release?
|
By Nevron Support - 9 Years Ago
|
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; } }
|