windowsforms-401311-controls-and-libraries-chart-control-series-views-2d-series-views-box-plot-chart.md
The Box Plot (also called Box-and-Whisker Plot) chart is used to analyze statistic-driven data points. To draw a Box Plot point, you must pass the Min, Quartile1, Median, Quartile3 and Max parameters. You can optionally display a set of Outliers and a Mean value.
The table below lists the main box plot chart characteristics:
| Feature | Value |
|---|---|
| Series view type | BoxPlotSeriesView |
| Diagram type | 2D XYDiagram |
| Number of arguments per series point | 1 |
| Number of values per series point | 7 |
The following image shows the Box Plot chart elements:
You can also display the series Mean line. Set the BoxPlotSeries2D.MeanLineVisible property to true for this:
The following example creates a Box Plot chart with three points:
Use the SeriesBase.CrosshairLabelPattern property to format the crosshair label text.
The Chart Control provides the following placeholders that you can use in patterns:
| Placeholder | Description |
|---|---|
| {BP_MIN} | Displays the Box Plot point’s Minimum value. |
| {BP_Q1} | Displays the Box Plot point’s First Quartile value. |
| {BP_MDN} | Displays the Box Plot point’s Median value. |
| {BP_AVG} | Displays the Box Plot point’s Mean value. |
| {BP_Q3} | Displays the Box Plot point’s Third Quartile value. |
| {BP_MAX} | Displays the Box Plot point’s Maximum value. |
series.CrosshairLabelPattern = "{A}" + Environment.NewLine +
"Min: {BP_MIN}" + Environment.NewLine +
"Q1: {BP_Q1}" + Environment.NewLine +
"Q3: {BP_Q3}" + Environment.NewLine +
"Max: {BP_MAX}";
series.CrosshairLabelPattern = "{A}" & Environment.NewLine & "Min: {BP_MIN}" + Environment.NewLine & "Q1: {BP_Q1}" + Environment.NewLine & "Q3: {BP_Q3}" + Environment.NewLine & "Max: {BP_MAX}"
You can use format specifiers to format values that the placeholders show. For example, the “{BP_Q1:f1}” pattern displays the First Quartile value with one digit after a comma.
This section explains how to modify the Box Plot chart appearance as follows:
The BoxPlotSeriesView class exposes the following appearance settings for the Box Plot chart:
SeriesViewBase.Color - Gets or sets the color of the series.
BoxPlotSeriesView.CapWidthPercentage - Gets or sets the cap width of a Box Plot series point as percentage.
BoxPlotSeriesView.MeanAndMedianColor - Gets or sets a color of the Mean symbol and Median line.
BoxPlotSeriesView.MeanMarkerKind - Gets or sets the Mean value’s marker kind.
BoxPlotSeriesView.MeanMarkerSize - Gets or sets the Mean value’s marker size in pixels.
BoxPlotSeriesView.Border - Returns the border settings for a Box Plot series point.
BoxPlotSeriesView.LineThickness - Gets or sets the thickness of the line used to draw the box plot whiskers, median line and caps.
BoxPlotSeries2D.MeanLineStyle - Specifies Mean line style settings. See the following help topic for more information about line style settings: LineStyle.
BoxPlotSeriesView view = series.View as BoxPlotSeriesView;
view.Color = Color.CadetBlue;
view.CapWidthPercentage = 50;
view.MeanAndMedianColor = Color.Black;
view.MeanMarkerKind = MarkerKind.ThinCross;
view.MeanMarkerSize = 10;
view.Border.Color = Color.Black;
view.Border.Thickness = 1;
view.Border.Visibility = DevExpress.Utils.DefaultBoolean.True;
view.LineThickness = 1;
view.MeanLineVisible = true;
view.MeanLineStyle.Thickness = 2;
view.MeanLineStyle.DashStyle = DashStyle.Dash;
Dim view As BoxPlotSeriesView = TryCast(series.View, BoxPlotSeriesView)
view.Color = Color.CadetBlue
view.CapWidthPercentage = 50
view.MeanAndMedianColor = Color.Black
view.MeanMarkerKind = MarkerKind.ThinCross
view.MeanMarkerSize = 10
view.Border.Color = Color.Black
view.Border.Thickness = 1
view.Border.Visibility = DevExpress.Utils.DefaultBoolean.[True]
view.LineThickness = 1
view.MeanLineVisible = True
view.MeanLineStyle.Thickness = 2
view.MeanLineStyle.DashStyle = DashStyle.Dash