Articles in this section
Category / Section

How to implement drill down effect in WinForms Chart?

Drill-down functionality in charts allows users to interact with a data point and view more detailed information related to that point. In Syncfusion WinForms Chart, this can be achieved by handling the ChartRegionClick event, identifying the clicked data point, and dynamically updating the chart with a new series that presents detailed data.

Steps to implement the drill down effect in WinForms Chart:

  1. Create an initial chart series of any chart type (e.g., Column, Line)
  2. Handle the ChartRegionClick event to detect which data point was clicked.
chartControl1.ChartRegionClick += ChartControl1_ChartRegionClick;
   3. Retrieve the PointIndex from the event arguments to identify the selected data point.
private void chartControl1_ChartRegionClick(object sender, Syncfusion.Windows.Forms.Chart.ChartRegionMouseEventArgs e)
{
    if (e.Region.IsChartPoint)
    {
        if (!isDrilledDown)
        {
            InitializeDrillDownChart(e.Region.PointIndex);
        }
        else
        {
            InitializeChart();
        }

        isDrilledDown = !isDrilledDown;
    }

    this.chartControl1.Refresh();
}
   4. Generate a new chart series (can be of a different chart type) based on the selected point.
private void InitializeDrillDownChart(int index)
{
    ChartSeries series1 = new ChartSeries("Market Breakdown");

    // ...
    // ...

    int count = this.chartControl1.Series[0].Points[index].YValues.Length - 1;
    for (int i = 0; i < count; i++)
    {
        series1.Points.Add(i, this.chartControl1.Series[0].Points[index].YValues[i + 1]);
        series1.Styles[i].Text = labelArray[i] + " - " + this.chartControl1.Series[0].Points[index].YValues[i + 1].ToString() + " %";
    }

   // ...
   // ...

    series1.Type = ChartSeriesType.Pie;
}
5. Update the chart control with the new series and labels to reflect the drill-down data:
private void InitializeDrillDownChart(int index)
{
    // ...
    // ...
    this.chartControl1.Series.Clear();
    this.chartControl1.Series.Add(series1);
}

Output:


Drill down effect in WinForms Chart


For more details, please refer to the project on GitHub sample.


Conclusion

I hope you enjoyed learning about how to implement drill down effect in 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)
Access denied
Access denied