Search code examples
c#winformschartsmschart

Bubble chart - how to disable or hide all values below a Y-Axis value dynamically


How is it possible to disable all value below a particular given Y-Axis value, so every point in a Bubble Chart is going to be disabled under this Y-Value. I only want to disable these values, not delete them, because I need to show that disabled points later on.

I only saw approaches with deleting the points, the bubble points getting re-sized in the chart, which I don't want to. I want to fix the size of the bubbles in the chart, regardless to the other bubble points.

I am working with Visual Studio Windows Form Application.


Solution

  • DataPoints don't have a Visible property.

    To make all DataPoints with some condition invisible you set their Color to Transparent.

    Here is an example:

    foreach (Series series in chart1.Series)
        foreach (DataPoint dp in series.Points)
             dp.Color = dp.YValues[0] < 0 ? Color.Transparent : series.Color;