Hi Kasper,
Yes you can detect that the user clicked on a callout - the following sample shows how to use the Object property of the NHitTestResult object to achieve that:
using Nevron.Chart;
using System;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsFormsApp2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
NRectangularCallout m_Callout;
NChart m_Chart;
private void Form1_Load(object sender, EventArgs e)
{
m_Chart = nChartControl1.Charts[0];
NLineSeries line = new NLineSeries();
for (int i = 0; i < 10; i++)
{
line.Values.Add(i);
}
m_Chart.Series.Add(line);
m_Callout = new NRectangularCallout();
m_Callout.Text = "Some Text";
m_Callout.UseAutomaticSize = true;
m_Callout.Anchor = new NDataPointAnchor(line, 1, ContentAlignment.MiddleCenter, StringAlignment.Center);
m_Chart.ChildPanels.Add(m_Callout);
nChartControl1.MouseDown += NChartControl1_MouseDown;
}
private void NChartControl1_MouseDown(object sender, MouseEventArgs e)
{
NHitTestResult result = nChartControl1.HitTest(new Point(e.X, e.Y));
if (m_Callout == result.Object)
{
m_Chart.ChildPanels.Remove(m_Callout);
m_Callout = null;
nChartControl1.Refresh();
}
}
}
}
Hope this helps - let us know if you meet any problems or have any questions.
Best Regards,
Nevron Support Team