[]
Box-and-Whisker charts are statistical charts that display the distribution of numerical data through quartiles, means, and outliers. As the name suggests, these charts use boxes and whiskers to represent these values. The boxes illustrate the range of quartiles, including the lower quartile, upper quartile, and median, while the whiskers indicate the variability beyond the upper and lower quartiles. Any data point that falls outside the whiskers is considered an outlier.
These charts are particularly helpful for comparing distributions across multiple groups or data sets. For example, they can effectively show the variation in monthly temperatures between two cities.
Sample Image | Description |
|---|---|
| ChartType.BoxWhisker Represents a Box and Whisker chart. It is used to display the variation within a set of data. |
Refer to the following example code to add a boxwhisker chart.
C#
// Enable enhanced shape and chart engines.
fpSpread1.Features.EnhancedShapeEngine = true;
fpSpread1.Features.EnhancedChartEngine = true;
// BoxWhisker chart.
object[,] dataArray ={
{ "Course A", "School A", "School B", "School C" },
{ "English", 63, 53, 45},
{ "Physics", 61 ,54 ,65},
{ "English", 62 ,55, 58},
{ "Math", 63 , 56 ,57},
{ "English", 59, 57 ,65},
{ "English", 58 ,53 ,64},
{ "Math", 60 , 54 ,63},
{ "Math", 61 ,55 ,58},
{ "English", 62 , 56 ,57},
{ "English", 63 , 57 ,59},
{ "Physics", 59 ,58 , 60},
{ "English", 58 ,59, 54},
{ "Math", 57 ,59, 45},
{ "Math", 60, 58, 40},
{ "English", 61, 57, 49}
};
for (int i = 0; i < dataArray.GetLength(0); i++)
for (int j = 0; j < dataArray.GetLength(1); j++)
fpSpread1.AsWorkbook().ActiveSheet.Cells[i, j].Value = dataArray[i, j];
fpSpread1.AsWorkbook().ActiveSheet.Cells["A1:D16"].Select();
fpSpread1.AsWorkbook().ActiveSheet.Shapes.AddChart(GrapeCity.Spreadsheet.Charts.ChartType.BoxWhisker, 100, 150, 400, 300, false);VB
' Enable enhanced shape and chart engines.
fpSpread1.Features.EnhancedShapeEngine = True
fpSpread1.Features.EnhancedChartEngine = True
' BoxWhisker chart.
Dim dataArray As Object(,) = {
{ "Course A", "School A", "School B", "School C" },
{ "English", 63, 53, 45},
{ "Physics", 61, 54, 65},
{ "English", 62, 55, 58},
{ "Math", 63, 56, 57},
{ "English", 59, 57, 65},
{ "English", 58, 53, 64},
{ "Math", 60, 54, 63},
{ "Math", 61, 55, 58},
{ "English", 62, 56, 57},
{ "English", 63, 57, 59},
{ "Physics", 59, 58, 60},
{ "English", 58, 59, 54},
{ "Math", 57, 59, 45},
{ "Math", 60, 58, 40},
{ "English", 61, 57, 49}
}
For i As Integer = 0 To dataArray.GetLength(0) - 1
For j As Integer = 0 To dataArray.GetLength(1) - 1
fpSpread1.AsWorkbook().ActiveSheet.Cells(i, j).Value = dataArray(i, j)
Next
Next
fpSpread1.AsWorkbook().ActiveSheet.Cells("A1:D16").Select()
fpSpread1.AsWorkbook().ActiveSheet.Shapes.AddChart(GrapeCity.Spreadsheet.Charts.ChartType.BoxWhisker, 100, 150, 400, 300, False)