corelibraries-devexpress-dot-xtracharts-2bc71847.md
Represents a series view of the Box Plot type.
Namespace : DevExpress.XtraCharts
Assembly : DevExpress.XtraCharts.v25.2.dll
NuGet Package : DevExpress.Charts
public class BoxPlotSeriesView :
SeriesViewColorEachSupportBase,
ISideBySideBarSeriesView,
IBarSeriesView,
ISupportBorderVisibility,
IGeometryHolder,
ISupportTransparency
Public Class BoxPlotSeriesView
Inherits SeriesViewColorEachSupportBase
Implements ISideBySideBarSeriesView,
IBarSeriesView,
ISupportBorderVisibility,
IGeometryHolder,
ISupportTransparency
The following image shows a Box Plot chart and its elements:
To create a Box Plot point, you should specify the following parameters:
The following parameters are optional:
Refer to the Providing Data section for more about different approaches on how to populate a series with points.
The BoxPlotSeriesView class introduces the options that allow you to customize the appearance of Box Plot chart elements:
Use the BoxDistance and BoxDistanceFixed properties to change a gap between points of different series in the same chart.
To change series animation-related settings, use the Animation property.
This example shows how to create a Box Plot chart.
Use the BoxPlotSeriesView object to configure the series view options.
using DevExpress.XtraCharts;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace BoxPlotChart {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e) {
Series series = new Series("Box Plot", ViewType.BoxPlot);
series.DataSource = DataPoint.GetDataPoints();
series.SetBoxPlotDataMembersWithOutliers("Argument", "Min", "Quartile1", "Median", "Quartile3", "Max", "Mean", "Outliers");
chartControl1.Series.Add(series);
BoxPlotSeriesView view = series.View as BoxPlotSeriesView;
view.EqualBoxWidth = true;
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;
XYDiagram diagram = chartControl1.Diagram as XYDiagram;
diagram.AxisX.Tickmarks.MinorVisible = false;
}
}
public class DataPoint {
public string Argument { get; set; }
public double Min { get; set; }
public double Max { get; set; }
public double Quartile1 { get; set; }
public double Quartile3 { get; set; }
public double Median { get; set; }
public double Mean { get; set; }
public double[] Outliers { get; set; }
public DataPoint(string argument, double min, double max, double q1, double q3, double median, double mean, double[] outliers) {
this.Argument = argument;
this.Min = min;
this.Max = max;
this.Quartile1 = q1;
this.Quartile3 = q3;
this.Median = median;
this.Mean = mean;
this.Outliers = outliers;
}
public static List<DataPoint> GetDataPoints() {
List<DataPoint> data = new List<DataPoint> {
new DataPoint("June", 46, 94, 64, 76, 70, 73, new double[]{ 30, 96.3, 99.56 }),
new DataPoint("July", 33, 121, 66, 88, 77, 75, new double[]{ 20, 22, 132.7 }),
new DataPoint("August", 10, 90, 40, 60, 50, 55, new double[]{ 4, 5, 95.4, 99.3, 109 })
};
return data;
}
}
}
Imports DevExpress.XtraCharts
Imports System
Imports System.Collections.Generic
Imports System.Drawing
Imports System.Windows.Forms
Namespace BoxPlotChart
Public Partial Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim series As Series = New Series("Box Plot", ViewType.BoxPlot)
series.DataSource = DataPoint.GetDataPoints()
series.SetBoxPlotDataMembersWithOutliers("Argument", "Min", "Quartile1", "Median", "Quartile3", "Max", "Mean", "Outliers")
chartControl1.Series.Add(series)
Dim view As BoxPlotSeriesView = TryCast(series.View, BoxPlotSeriesView)
view.EqualBoxWidth = True
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]
Dim diagram As XYDiagram = TryCast(chartControl1.Diagram, XYDiagram)
diagram.AxisX.Tickmarks.MinorVisible = False
End Sub
End Class
Public Class DataPoint
Public Property Argument As String
Public Property Min As Double
Public Property Max As Double
Public Property Quartile1 As Double
Public Property Quartile3 As Double
Public Property Median As Double
Public Property Mean As Double
Public Property Outliers As Double()
Public Sub New(ByVal argument As String, ByVal min As Double, ByVal max As Double, ByVal q1 As Double, ByVal q3 As Double, ByVal median As Double, ByVal mean As Double, ByVal outliers As Double())
Me.Argument = argument
Me.Min = min
Me.Max = max
Me.Quartile1 = q1
Me.Quartile3 = q3
Me.Median = median
Me.Mean = mean
Me.Outliers = outliers
End Sub
Public Shared Function GetDataPoints() As List(Of DataPoint)
Dim data As List(Of DataPoint) = New List(Of DataPoint) From {
New DataPoint("June", 46, 94, 64, 76, 70, 73, New Double() {30, 96.3, 99.56}),
New DataPoint("July", 33, 121, 66, 88, 77, 75, New Double() {20, 22, 132.7}),
New DataPoint("August", 10, 90, 40, 60, 50, 55, New Double() {4, 5, 95.4, 99.3, 109})
}
Return data
End Function
End Class
End Namespace
IXtraSupportDeserializeCollectionItem
Object ChartElement SeriesViewBase XYDiagram2DSeriesViewBase XYDiagramSeriesViewBase SeriesViewColorEachSupportBase BoxPlotSeriesView
See Also