Hi David,
Fruits and vegetables are fine
- actually there are many examples in the control that use them...
You have to intercept the click event of the control and then perform a hit test. The following code snippet shows how to do this:
private void Form1_Load(object sender, EventArgs e)
{
NChart chart = nChartControl1.Charts[0];
chart.BoundsMode = BoundsMode.Stretch;
// add some sample data
NBarSeries apples = new NBarSeries();
NBarSeries oranges = new NBarSeries();
Random rand = new Random();
for (int i = 0; i < 10; i++)
{
apples.Values.Add(rand.Next(100));
oranges.Values.Add(rand.Next(100));
}
apples.MultiBarMode = MultiBarMode.Clustered;
oranges.MultiBarMode = MultiBarMode.Clustered;
chart.Series.Add(apples);
chart.Series.Add(oranges);
nChartControl1.Refresh();
}
private void nChartControl1_MouseClick(object sender, MouseEventArgs e)
{
NHitTestResult result = nChartControl1.HitTest(e.X, e.Y);
if (result.ChartElement == ChartElement.DataPoint)
{
NBarSeries bar = (NBarSeries)result.Series;
MessageBox.Show(bar.Values[result.DataPointIndex].ToString());
}
}
Hope this helps - let me know if you meet any problems or have any questions.
Bob