Profile Picture

Is there a way to use the legend item to obtain the series where it belongs?

Posted By Paulo Silva 10 Years Ago

Is there a way to use the legend item to obtain the series where it...

Author
Message
Paulo Silva
Posted 10 Years Ago
View Quick Profile
Junior Member

Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 13, Visits: 12
I want to be able to identify a series from a legend item.

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

if (hitTestResult.ChartElement == ChartElement.LegendDataItem)
{
NLegendItemCellData legendItemCellData = hitTestResult.LegendDataItem;

int legendItemIndex = hitTestResult.LegendDataItemIndex;
int index = hitTestResult.ObjectIndex;

foreach (NSeries ser in chart.Series)
{
// find the series
}
MessageBox.Show("this legendItem belongs to the serie ...");
}
}



Nevron Support
Posted 10 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: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Paulo,

There is currently no way to track the series that generated the legend item, however we'll release a SP that allows you to get this information with code like:

NHitTestResult result = nChartControl1.HitTest(new Point(e.X, e.Y));

if (result.ChartElement == ChartElement.LegendDataItem)
{
   NLegendItemCellData legendItemCellData = result.LegendDataItem;
   NSeriesBase series = legendItemCellData.Series;
}

The SP will be available in a couple of days.

Best Regards,
Nevron Support Team



Paulo Silva
Posted 10 Years Ago
View Quick Profile
Junior Member

Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 13, Visits: 12
Hi,

Thanks.

Best Regards



Similar Topics


Reading This Topic