Search code examples
c#chartsmschart

Disable selection by mouse in Microsoft Chart in a C# windows application


When clicking and dragging my mouse within a Microsoft Chart, it selects a chart area by default. In the screenshot below you will see an example...the grey area is the part that has been selected with the mouse. Does anyone know how to disable this?

Screenshot


Solution

  • You have to set some properties on your ChartArea cursors to disable the user interactions :

    myChart.ChartArea[0].CursorX.IsUserSelection = false;
    myChart.ChartArea[0].CursorX.IsUserEnabled = false;
    
    myChart.ChartArea[0].CursorY.IsUserSelection = false;
    myChart.ChartArea[0].CursorY.IsUserEnabled = false;