Box and Whisker in ASP.NET CORE Charts Component

13 Dec 202424 minutes to read

Box and whisker

To render a box and whisker series in your chart, you need to follow a few steps to configure it correctly. Here’s a concise guide on how to do this:

  • Set the series type: Define the series type as BoxAndWhisker in your chart configuration. This indicates that the data should be represented as a box and whisker chart, which will plot segments to illustrate the statistical distribution of the data.

  • Data requirements: The y field of the Box and Whisker series requires a specific number of data points, with a minimum of five values needed to plot a segment.

<ejs-chart id="container">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Department"
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.BoxAndWhisker">
            <e-series-marker visible="true" height="10" width="10"></e-series-marker>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            Double[] y1 = { 22, 22, 23, 25, 25, 25, 26, 27, 27, 28, 28, 29, 30, 32, 34, 32, 34, 36, 35, 38 };
            Double[] y2 = { 22, 33, 23, 25, 26, 28, 29, 30, 34, 33, 32, 31, 50 };
            Double[] y3 = { 22, 24, 25, 30, 32, 34, 36, 38, 39, 41, 35, 36, 40, 56 };
            Double[] y4 = { 26, 27, 28, 30, 32, 34, 35, 37, 35, 37, 45 };
            Double[] y5 = { 26, 27, 29, 32, 34, 35, 36, 37, 38, 39, 41, 43, 58 };
            Double[] y6 = { 27, 26, 28, 29, 29, 29, 32, 35, 32, 38, 53 };
            Double[] y7 = { 21, 23, 24, 25, 26, 27, 28, 30, 34, 36, 38 };
            Double[] y8 = { 26, 28, 29, 30, 32, 33, 35, 36, 52 };
            Double[] y9 = { 28, 29, 30, 31, 32, 34, 35, 36 };

            List<BoxAndWhiskerChartData> chartData = new List<BoxAndWhiskerChartData>
            {
                new BoxAndWhiskerChartData { xValue = "Development", yValue = y1 },
                new BoxAndWhiskerChartData { xValue = "Testing", yValue = y2},
                new BoxAndWhiskerChartData { xValue = "HR", yValue = y3 },
                new BoxAndWhiskerChartData { xValue = "Finance", yValue = y4 },
                new BoxAndWhiskerChartData { xValue = "R&D", yValue = y5 },
                new BoxAndWhiskerChartData { xValue = "Sales", yValue = y6 },
                new BoxAndWhiskerChartData { xValue = "Inventory", yValue = y7 },
                new BoxAndWhiskerChartData { xValue = "Graphics", yValue = y8 },
                new BoxAndWhiskerChartData { xValue = "Training", yValue = y9 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class BoxAndWhiskerChartData
        {
            public string xValue;
            public double[] yValue;
        }

Binding data with series

You can bind data to the chart using the dataSource property within the series configuration. This allows you to connect a JSON dataset or remote data to your chart. To display the data correctly, map the fields from the data to the chart series xName and yName properties.

<ejs-chart id="container">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Department"
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.BoxAndWhisker">
            <e-series-marker visible="true" height="10" width="10"></e-series-marker>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            Double[] y1 = { 22, 22, 23, 25, 25, 25, 26, 27, 27, 28, 28, 29, 30, 32, 34, 32, 34, 36, 35, 38 };
            Double[] y2 = { 22, 33, 23, 25, 26, 28, 29, 30, 34, 33, 32, 31, 50 };
            Double[] y3 = { 22, 24, 25, 30, 32, 34, 36, 38, 39, 41, 35, 36, 40, 56 };
            Double[] y4 = { 26, 27, 28, 30, 32, 34, 35, 37, 35, 37, 45 };
            Double[] y5 = { 26, 27, 29, 32, 34, 35, 36, 37, 38, 39, 41, 43, 58 };
            Double[] y6 = { 27, 26, 28, 29, 29, 29, 32, 35, 32, 38, 53 };
            Double[] y7 = { 21, 23, 24, 25, 26, 27, 28, 30, 34, 36, 38 };
            Double[] y8 = { 26, 28, 29, 30, 32, 33, 35, 36, 52 };
            Double[] y9 = { 28, 29, 30, 31, 32, 34, 35, 36 };

            List<BoxAndWhiskerChartData> chartData = new List<BoxAndWhiskerChartData>
            {
                new BoxAndWhiskerChartData { xValue = "Development", yValue = y1 },
                new BoxAndWhiskerChartData { xValue = "Testing", yValue = y2},
                new BoxAndWhiskerChartData { xValue = "HR", yValue = y3 },
                new BoxAndWhiskerChartData { xValue = "Finance", yValue = y4 },
                new BoxAndWhiskerChartData { xValue = "R&D", yValue = y5 },
                new BoxAndWhiskerChartData { xValue = "Sales", yValue = y6 },
                new BoxAndWhiskerChartData { xValue = "Inventory", yValue = y7 },
                new BoxAndWhiskerChartData { xValue = "Graphics", yValue = y8 },
                new BoxAndWhiskerChartData { xValue = "Training", yValue = y9 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class BoxAndWhiskerChartData
        {
            public string xValue;
            public double[] yValue;
        }

Series customization

The following properties can be used to customize the box and whisker series.

Fill

The fill property determines the color applied to the series.

<ejs-chart id="container">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Department"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.BoxAndWhisker" fill="#1E90FF">
            <e-series-marker visible="true" height="10" width="10"></e-series-marker>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            Double[] y1 = { 22, 22, 23, 25, 25, 25, 26, 27, 27, 28, 28, 29, 30, 32, 34, 32, 34, 36, 35, 38 };
            Double[] y2 = { 22, 33, 23, 25, 26, 28, 29, 30, 34, 33, 32, 31, 50 };
            Double[] y3 = { 22, 24, 25, 30, 32, 34, 36, 38, 39, 41, 35, 36, 40, 56 };
            Double[] y4 = { 26, 27, 28, 30, 32, 34, 35, 37, 35, 37, 45 };
            Double[] y5 = { 26, 27, 29, 32, 34, 35, 36, 37, 38, 39, 41, 43, 58 };
            Double[] y6 = { 27, 26, 28, 29, 29, 29, 32, 35, 32, 38, 53 };
            Double[] y7 = { 21, 23, 24, 25, 26, 27, 28, 30, 34, 36, 38 };
            Double[] y8 = { 26, 28, 29, 30, 32, 33, 35, 36, 52 };
            Double[] y9 = { 28, 29, 30, 31, 32, 34, 35, 36 };

            List<BoxAndWhiskerChartData> chartData = new List<BoxAndWhiskerChartData>
            {
                new BoxAndWhiskerChartData { xValue = "Development", yValue = y1 },
                new BoxAndWhiskerChartData { xValue = "Testing", yValue = y2},
                new BoxAndWhiskerChartData { xValue = "HR", yValue = y3 },
                new BoxAndWhiskerChartData { xValue = "Finance", yValue = y4 },
                new BoxAndWhiskerChartData { xValue = "R&D", yValue = y5 },
                new BoxAndWhiskerChartData { xValue = "Sales", yValue = y6 },
                new BoxAndWhiskerChartData { xValue = "Inventory", yValue = y7 },
                new BoxAndWhiskerChartData { xValue = "Graphics", yValue = y8 },
                new BoxAndWhiskerChartData { xValue = "Training", yValue = y9 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class BoxAndWhiskerChartData
        {
            public string xValue;
            public double[] yValue;
        }

The fill property can be used to apply a gradient color to the box and whisker series. By configuring this property with gradient values, you can create a visually appealing effect in which the color transitions smoothly from one shade to another.

<svg style="width:1px; height:1px">
        <defs>
            <linearGradient id="gradient">
                <stop offset="0%" style="stop-color:blue;stop-opacity:5" />
                <stop offset="50%" style="stop-color:violet;stop-opacity:5" />
            </linearGradient>
        </defs>
    </svg>

<ejs-chart id="container">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Department"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.BoxAndWhisker" fill="url(#gradient)">
            <e-series-marker visible="true" height="10" width="10"></e-series-marker>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            Double[] y1 = { 22, 22, 23, 25, 25, 25, 26, 27, 27, 28, 28, 29, 30, 32, 34, 32, 34, 36, 35, 38 };
            Double[] y2 = { 22, 33, 23, 25, 26, 28, 29, 30, 34, 33, 32, 31, 50 };
            Double[] y3 = { 22, 24, 25, 30, 32, 34, 36, 38, 39, 41, 35, 36, 40, 56 };
            Double[] y4 = { 26, 27, 28, 30, 32, 34, 35, 37, 35, 37, 45 };
            Double[] y5 = { 26, 27, 29, 32, 34, 35, 36, 37, 38, 39, 41, 43, 58 };
            Double[] y6 = { 27, 26, 28, 29, 29, 29, 32, 35, 32, 38, 53 };
            Double[] y7 = { 21, 23, 24, 25, 26, 27, 28, 30, 34, 36, 38 };
            Double[] y8 = { 26, 28, 29, 30, 32, 33, 35, 36, 52 };
            Double[] y9 = { 28, 29, 30, 31, 32, 34, 35, 36 };

            List<BoxAndWhiskerChartData> chartData = new List<BoxAndWhiskerChartData>
            {
                new BoxAndWhiskerChartData { xValue = "Development", yValue = y1 },
                new BoxAndWhiskerChartData { xValue = "Testing", yValue = y2},
                new BoxAndWhiskerChartData { xValue = "HR", yValue = y3 },
                new BoxAndWhiskerChartData { xValue = "Finance", yValue = y4 },
                new BoxAndWhiskerChartData { xValue = "R&D", yValue = y5 },
                new BoxAndWhiskerChartData { xValue = "Sales", yValue = y6 },
                new BoxAndWhiskerChartData { xValue = "Inventory", yValue = y7 },
                new BoxAndWhiskerChartData { xValue = "Graphics", yValue = y8 },
                new BoxAndWhiskerChartData { xValue = "Training", yValue = y9 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class BoxAndWhiskerChartData
        {
            public string xValue;
            public double[] yValue;
        }

Opacity

The opacity property specifies the transparency level of the fill. Adjusting this property allows you to control how opaque or transparent the fill color of the series appears.

<ejs-chart id="container">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Department"
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.BoxAndWhisker" opacity="0.5">
            <e-series-marker visible="true" height="10" width="10"></e-series-marker>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            Double[] y1 = { 22, 22, 23, 25, 25, 25, 26, 27, 27, 28, 28, 29, 30, 32, 34, 32, 34, 36, 35, 38 };
            Double[] y2 = { 22, 33, 23, 25, 26, 28, 29, 30, 34, 33, 32, 31, 50 };
            Double[] y3 = { 22, 24, 25, 30, 32, 34, 36, 38, 39, 41, 35, 36, 40, 56 };
            Double[] y4 = { 26, 27, 28, 30, 32, 34, 35, 37, 35, 37, 45 };
            Double[] y5 = { 26, 27, 29, 32, 34, 35, 36, 37, 38, 39, 41, 43, 58 };
            Double[] y6 = { 27, 26, 28, 29, 29, 29, 32, 35, 32, 38, 53 };
            Double[] y7 = { 21, 23, 24, 25, 26, 27, 28, 30, 34, 36, 38 };
            Double[] y8 = { 26, 28, 29, 30, 32, 33, 35, 36, 52 };
            Double[] y9 = { 28, 29, 30, 31, 32, 34, 35, 36 };

            List<BoxAndWhiskerChartData> chartData = new List<BoxAndWhiskerChartData>
            {
                new BoxAndWhiskerChartData { xValue = "Development", yValue = y1 },
                new BoxAndWhiskerChartData { xValue = "Testing", yValue = y2},
                new BoxAndWhiskerChartData { xValue = "HR", yValue = y3 },
                new BoxAndWhiskerChartData { xValue = "Finance", yValue = y4 },
                new BoxAndWhiskerChartData { xValue = "R&D", yValue = y5 },
                new BoxAndWhiskerChartData { xValue = "Sales", yValue = y6 },
                new BoxAndWhiskerChartData { xValue = "Inventory", yValue = y7 },
                new BoxAndWhiskerChartData { xValue = "Graphics", yValue = y8 },
                new BoxAndWhiskerChartData { xValue = "Training", yValue = y9 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class BoxAndWhiskerChartData
        {
            public string xValue;
            public double[] yValue;
        }

Border

Use the border property to customize the width, color and dasharray of the series border.

<ejs-chart id="container">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Department"
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.BoxAndWhisker">
            <e-series-border width="2" color="green" dashArray="5,5"></e-series-border>
            <e-series-marker visible="true" height="10" width="10"></e-series-marker>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            Double[] y1 = { 22, 22, 23, 25, 25, 25, 26, 27, 27, 28, 28, 29, 30, 32, 34, 32, 34, 36, 35, 38 };
            Double[] y2 = { 22, 33, 23, 25, 26, 28, 29, 30, 34, 33, 32, 31, 50 };
            Double[] y3 = { 22, 24, 25, 30, 32, 34, 36, 38, 39, 41, 35, 36, 40, 56 };
            Double[] y4 = { 26, 27, 28, 30, 32, 34, 35, 37, 35, 37, 45 };
            Double[] y5 = { 26, 27, 29, 32, 34, 35, 36, 37, 38, 39, 41, 43, 58 };
            Double[] y6 = { 27, 26, 28, 29, 29, 29, 32, 35, 32, 38, 53 };
            Double[] y7 = { 21, 23, 24, 25, 26, 27, 28, 30, 34, 36, 38 };
            Double[] y8 = { 26, 28, 29, 30, 32, 33, 35, 36, 52 };
            Double[] y9 = { 28, 29, 30, 31, 32, 34, 35, 36 };

            List<BoxAndWhiskerChartData> chartData = new List<BoxAndWhiskerChartData>
            {
                new BoxAndWhiskerChartData { xValue = "Development", yValue = y1 },
                new BoxAndWhiskerChartData { xValue = "Testing", yValue = y2},
                new BoxAndWhiskerChartData { xValue = "HR", yValue = y3 },
                new BoxAndWhiskerChartData { xValue = "Finance", yValue = y4 },
                new BoxAndWhiskerChartData { xValue = "R&D", yValue = y5 },
                new BoxAndWhiskerChartData { xValue = "Sales", yValue = y6 },
                new BoxAndWhiskerChartData { xValue = "Inventory", yValue = y7 },
                new BoxAndWhiskerChartData { xValue = "Graphics", yValue = y8 },
                new BoxAndWhiskerChartData { xValue = "Training", yValue = y9 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class BoxAndWhiskerChartData
        {
            public string xValue;
            public double[] yValue;
        }

Box Plot

To change the rendering mode of the box and whisker series, use the boxPlotMode property. The default value for boxPlotMode is Exclusive. The other available options for boxPlotMode are Inclusive and Normal.

<ejs-chart id="container">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Department"
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.BoxAndWhisker" boxPlotMode="Normal">
            <e-series-marker visible="true" height="10" width="10"></e-series-marker>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            Double[] y1 = { 22, 22, 23, 25, 25, 25, 26, 27, 27, 28, 28, 29, 30, 32, 34, 32, 34, 36, 35, 38 };
            Double[] y2 = { 22, 33, 23, 25, 26, 28, 29, 30, 34, 33, 32, 31, 50 };
            Double[] y3 = { 22, 24, 25, 30, 32, 34, 36, 38, 39, 41, 35, 36, 40, 56 };
            Double[] y4 = { 26, 27, 28, 30, 32, 34, 35, 37, 35, 37, 45 };
            Double[] y5 = { 26, 27, 29, 32, 34, 35, 36, 37, 38, 39, 41, 43, 58 };
            Double[] y6 = { 27, 26, 28, 29, 29, 29, 32, 35, 32, 38, 53 };
            Double[] y7 = { 21, 23, 24, 25, 26, 27, 28, 30, 34, 36, 38 };
            Double[] y8 = { 26, 28, 29, 30, 32, 33, 35, 36, 52 };
            Double[] y9 = { 28, 29, 30, 31, 32, 34, 35, 36 };

            List<BoxAndWhiskerChartData> chartData = new List<BoxAndWhiskerChartData>
            {
                new BoxAndWhiskerChartData { xValue = "Development", yValue = y1 },
                new BoxAndWhiskerChartData { xValue = "Testing", yValue = y2},
                new BoxAndWhiskerChartData { xValue = "HR", yValue = y3 },
                new BoxAndWhiskerChartData { xValue = "Finance", yValue = y4 },
                new BoxAndWhiskerChartData { xValue = "R&D", yValue = y5 },
                new BoxAndWhiskerChartData { xValue = "Sales", yValue = y6 },
                new BoxAndWhiskerChartData { xValue = "Inventory", yValue = y7 },
                new BoxAndWhiskerChartData { xValue = "Graphics", yValue = y8 },
                new BoxAndWhiskerChartData { xValue = "Training", yValue = y9 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class BoxAndWhiskerChartData
        {
            public string xValue;
            public double[] yValue;
        }

Show mean

In the box and whisker series, the showMean property is used to display the average value of the box and whisker. The default value of showMean is false.

<ejs-chart id="container">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Department"
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.BoxAndWhisker" boxPlotMode="Normal" showMean="false">
            <e-series-marker visible="true" height="10" width="10"></e-series-marker>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            Double[] y1 = { 22, 22, 23, 25, 25, 25, 26, 27, 27, 28, 28, 29, 30, 32, 34, 32, 34, 36, 35, 38 };
            Double[] y2 = { 22, 33, 23, 25, 26, 28, 29, 30, 34, 33, 32, 31, 50 };
            Double[] y3 = { 22, 24, 25, 30, 32, 34, 36, 38, 39, 41, 35, 36, 40, 56 };
            Double[] y4 = { 26, 27, 28, 30, 32, 34, 35, 37, 35, 37, 45 };
            Double[] y5 = { 26, 27, 29, 32, 34, 35, 36, 37, 38, 39, 41, 43, 58 };
            Double[] y6 = { 27, 26, 28, 29, 29, 29, 32, 35, 32, 38, 53 };
            Double[] y7 = { 21, 23, 24, 25, 26, 27, 28, 30, 34, 36, 38 };
            Double[] y8 = { 26, 28, 29, 30, 32, 33, 35, 36, 52 };
            Double[] y9 = { 28, 29, 30, 31, 32, 34, 35, 36 };

            List<BoxAndWhiskerChartData> chartData = new List<BoxAndWhiskerChartData>
            {
                new BoxAndWhiskerChartData { xValue = "Development", yValue = y1 },
                new BoxAndWhiskerChartData { xValue = "Testing", yValue = y2},
                new BoxAndWhiskerChartData { xValue = "HR", yValue = y3 },
                new BoxAndWhiskerChartData { xValue = "Finance", yValue = y4 },
                new BoxAndWhiskerChartData { xValue = "R&D", yValue = y5 },
                new BoxAndWhiskerChartData { xValue = "Sales", yValue = y6 },
                new BoxAndWhiskerChartData { xValue = "Inventory", yValue = y7 },
                new BoxAndWhiskerChartData { xValue = "Graphics", yValue = y8 },
                new BoxAndWhiskerChartData { xValue = "Training", yValue = y9 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class BoxAndWhiskerChartData
        {
            public string xValue;
            public double[] yValue;
        }

Events

Series render

The seriesRender event allows you to customize series properties, such as data, fill, and name, before they are rendered on the chart.

<ejs-chart id="container" seriesRender="changecolor">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Department"
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.BoxAndWhisker">
            <e-series-marker visible="true" height="10" width="10"></e-series-marker>
        </e-series>
    </e-series-collection>
</ejs-chart>

<script>
    function changeColor(args) {
        args.fill = '#ff6347';
    }
</script>
public ActionResult Index()
        {
            Double[] y1 = { 22, 22, 23, 25, 25, 25, 26, 27, 27, 28, 28, 29, 30, 32, 34, 32, 34, 36, 35, 38 };
            Double[] y2 = { 22, 33, 23, 25, 26, 28, 29, 30, 34, 33, 32, 31, 50 };
            Double[] y3 = { 22, 24, 25, 30, 32, 34, 36, 38, 39, 41, 35, 36, 40, 56 };
            Double[] y4 = { 26, 27, 28, 30, 32, 34, 35, 37, 35, 37, 45 };
            Double[] y5 = { 26, 27, 29, 32, 34, 35, 36, 37, 38, 39, 41, 43, 58 };
            Double[] y6 = { 27, 26, 28, 29, 29, 29, 32, 35, 32, 38, 53 };
            Double[] y7 = { 21, 23, 24, 25, 26, 27, 28, 30, 34, 36, 38 };
            Double[] y8 = { 26, 28, 29, 30, 32, 33, 35, 36, 52 };
            Double[] y9 = { 28, 29, 30, 31, 32, 34, 35, 36 };

            List<BoxAndWhiskerChartData> chartData = new List<BoxAndWhiskerChartData>
            {
                new BoxAndWhiskerChartData { xValue = "Development", yValue = y1 },
                new BoxAndWhiskerChartData { xValue = "Testing", yValue = y2},
                new BoxAndWhiskerChartData { xValue = "HR", yValue = y3 },
                new BoxAndWhiskerChartData { xValue = "Finance", yValue = y4 },
                new BoxAndWhiskerChartData { xValue = "R&D", yValue = y5 },
                new BoxAndWhiskerChartData { xValue = "Sales", yValue = y6 },
                new BoxAndWhiskerChartData { xValue = "Inventory", yValue = y7 },
                new BoxAndWhiskerChartData { xValue = "Graphics", yValue = y8 },
                new BoxAndWhiskerChartData { xValue = "Training", yValue = y9 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class BoxAndWhiskerChartData
        {
            public string xValue;
            public double[] yValue;
        }

Point render

The pointRender event allows you to customize each data point before it is rendered on the chart.

<ejs-chart id="container" pointRender="changecolor">
    <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Department"
            type="@Syncfusion.EJ2.Charts.ChartSeriesType.BoxAndWhisker">
            <e-series-marker visible="true" height="10" width="10"></e-series-marker>
        </e-series>
    </e-series-collection>
</ejs-chart>

<script>
    function changeColor(args) {
        if (args.point.maximum < 38) {
            args.fill = '#ff6347';
        } else {
            args.fill = '#009cb8';
        }
    }
</script>
public ActionResult Index()
        {
            Double[] y1 = { 22, 22, 23, 25, 25, 25, 26, 27, 27, 28, 28, 29, 30, 32, 34, 32, 34, 36, 35, 38 };
            Double[] y2 = { 22, 33, 23, 25, 26, 28, 29, 30, 34, 33, 32, 31, 50 };
            Double[] y3 = { 22, 24, 25, 30, 32, 34, 36, 38, 39, 41, 35, 36, 40, 56 };
            Double[] y4 = { 26, 27, 28, 30, 32, 34, 35, 37, 35, 37, 45 };
            Double[] y5 = { 26, 27, 29, 32, 34, 35, 36, 37, 38, 39, 41, 43, 58 };
            Double[] y6 = { 27, 26, 28, 29, 29, 29, 32, 35, 32, 38, 53 };
            Double[] y7 = { 21, 23, 24, 25, 26, 27, 28, 30, 34, 36, 38 };
            Double[] y8 = { 26, 28, 29, 30, 32, 33, 35, 36, 52 };
            Double[] y9 = { 28, 29, 30, 31, 32, 34, 35, 36 };

            List<BoxAndWhiskerChartData> chartData = new List<BoxAndWhiskerChartData>
            {
                new BoxAndWhiskerChartData { xValue = "Development", yValue = y1 },
                new BoxAndWhiskerChartData { xValue = "Testing", yValue = y2},
                new BoxAndWhiskerChartData { xValue = "HR", yValue = y3 },
                new BoxAndWhiskerChartData { xValue = "Finance", yValue = y4 },
                new BoxAndWhiskerChartData { xValue = "R&D", yValue = y5 },
                new BoxAndWhiskerChartData { xValue = "Sales", yValue = y6 },
                new BoxAndWhiskerChartData { xValue = "Inventory", yValue = y7 },
                new BoxAndWhiskerChartData { xValue = "Graphics", yValue = y8 },
                new BoxAndWhiskerChartData { xValue = "Training", yValue = y9 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class BoxAndWhiskerChartData
        {
            public string xValue;
            public double[] yValue;
        }

See Also