Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
WinChart - Annotation Mouse Click
posted

Hi there,

I am adding an annotation to my Gantt chart and I am using primitive.Caps = PCaps.HitTest to respond to the mouseover event.

Please can you advise how I now respond to a mouse click event on this annotation to identify the annotation that has been clicked on. 

I raised a similar question last year but can not find that answer in the forums now.

 Thanks in advance,

Matt

Parents
No Data
Reply
  • 17605
    posted

    You can try the following code:

    BoxAnnotation box = new BoxAnnotation();box.Text = "Box";

    box.Location.LocationX = 50;

    box.Location.LocationY = 50;

    this.ultraChart1.Annotations.Add(box);

    this.ultraChart1.ChartDrawItem += new Infragistics.UltraChart.Shared.Events.ChartDrawItemEventHandler(ultraChart1_ChartDrawItem);

    this.ultraChart1.ChartDataClicked += new Infragistics.UltraChart.Shared.Events.ChartDataClickedEventHandler(ultraChart1_ChartDataClicked);

    ...

     

    void ultraChart1_ChartDataClicked(object sender, Infragistics.UltraChart.Shared.Events.ChartDataEventArgs e)

    {

    Box box = e.Primitive as Box;if (box == null || box.Path != "Drill")

    {

    return;

    }

    // do something

    }

    private void ultraChart1_ChartDrawItem(object sender, Infragistics.UltraChart.Shared.Events.ChartDrawItemEventArgs e)

    {

    Box box = e.Primitive as Box;if (box == null)

    {

    return;

    }

    if (string.IsNullOrEmpty(box.Path))

    {

    box.Caps = PCaps.HitTest;

    box.Path = "Drill";

    }

    }

Children