ChartDirector 6.1 (Java Edition)

XYChart.addBoxWhiskerLayer


Usage

public BoxWhiskerLayer addBoxWhiskerLayer(double[] boxTop, double[] boxBottom [, double[] maxData [, double[] minData [, double[] midData [, int fillColor [, int whiskerColor [, int edgeColor ]]]]]])

Description

Adds a box-whisker layer to the XYChart, and specify the data sets to use for drawing the layer.

A standard box-whisker symbol represents 5 values. In this documentation, they are called maxData, boxTop, midData, boxBottom and minData. The 5 values should be in descending order. The symbol consists of a line joining the maxData and minData, a box from boxTop to boxBottom, and 3 mark lines at maxData, midData and minData.

You may use empty arrays to disable showing some parts of the box-whisker symbol.

For example, to show the box only, simply set the maxData, minData and midData to empty arrays.

Similarly, if the boxTop, boxBottom and midData are set to empty arrays, only the maxData and minData mark lines and the joining lines are visible. This symbol is often used to represent "error bands" together with other chart layers.

In addition to maxData, midData and minData mark lines, you may add additional mark lines by adding more data sets using Layer.addDataSet.

By default, the box-whisker symbol will be drawn using the colors specified in the fillColor, whiskerColor and edgeColor argument. The fillColor and edgeColor are used as the fill and border colors of the box, while the whiskerColor is used as the color of the center line and the mark lines.

Internally, ChartDirector maps the colors of different parts of the box-whisker symbol to data set colors as shown in the following table. You may control the colors of the box-whisker symbol in more details by setting the data set colors directly. The data set objects can be obtained using Layer.getDataSet, and the colors can be changed using DataSet.setDataColor.

Box-Whisker Symbol ColorData Set Color
Fill color of the boxData Color for the first data set (index = 0)
Border color of the boxEdge Color for the first data set (index = 0)
Center line colorData Color for the second data set (index = 1)
Maximum value mark line colorData Color for the third data set (index = 2)
Minimum value mark line colorData Color for the fourth data set (index = 3)
Middle value mark line colorData Color for the fifth data set (index = 4)
Mark line color for additional mark linesData Color for the data set representing the additional mark line

Arguments

ArgumentDefaultDescription
boxTop(Mandatory)An array of numbers representing the top edge of the box.
boxBottom(Mandatory)An array of numbers representing the bottom edge of the box.
maxData[Empty_Array]An array of numbers representing the maximum value mark lines.
minData[Empty_Array]An array of numbers representing the minimum value mark lines.
midData[Empty_Array]An array of numbers representing the middle value mark lines.
fillColor-1The color used to fill the box. -1 means that the color is automatically selected from the palette.
whiskerColorLineColorThe color used to draw the central line and mark lines.
edgeColorLineColorThe color used to draw the border of the box.

Return Value

A BoxWhiskerLayer object representing the box-whisker layer created.