Articles in this section
Category / Section

How to trigger the ChartRegionEvents in the WinForms Chart?

4 mins read

 

The ChartRegionMouseEventHandler is a crucial component used to handle mouse-related events in a WinForms Chart. These regions include Axis Labels, Chart Points, or any Custom Regions within the chart.

When a user interacts with these regions using the mouse, several mouse-related events can be triggered. Depending on the region of interaction, the following events may occur:

  • ChartRegionClick Event
  • ChartRegionMouseEnter Event
  • ChartRegionMouseHover Event
  • ChartRegionMouseMove Event
  • ChartRegionMouseLeave Event
  • ChartRegionMouseUp Event
  • ChartRegionMouseDown Event

C#

// Add the ChartRegionMouseDown event
this.chartControl1.ChartRegionMouseDown += new Syncfusion.Windows.Forms.Chart.ChartRegionMouseEventHandler(this.chartControl1_ChartRegionMouseDown);

// Specifies Action to the ChartRegionMouseDown Event
private void chartControl1_ChartRegionMouseDown(object sender, Syncfusion.Windows.Forms.Chart.ChartRegionMouseEventArgs e)
{
    if (e.Region.SeriesIndex == 0)
    {
        OutputText.Text = (String.Format("MouseDown Series 1 Bar {0} Point : {1}", e.Region.PointIndex, e.Point));
    }
}

VB

'Add the ChartRegionMouseDown Event
AddHandler columnChart.ChartRegionMouseDown, AddressOf chartControl1_ChartRegionMouseDown

'Specifies Action to the ChartRegionMouseDown Event
Private Sub chartControl1_ChartRegionMouseDown(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Chart.ChartRegionMouseEventArgs)

If e.Region.SeriesIndex = 0 Then

outputText.Text = (String.Format("MouseDown Series 1 Bar {0} Point : {1}", e.Region.PointIndex, e.Point))

End If

End Sub
Output:

trigger chart region events output

Conclusion

I hope you enjoyed learning about how to trigger the ChartRegionEvents in the WinForms Chart.

You can refer to our WinForms Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications. You can also explore our WinForms Chart examples to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you! 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied