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 Color | Data Set Color |
---|
Fill color of the box | Data Color for the first data set (index = 0) |
Border color of the box | Edge Color for the first data set (index = 0) |
Center line color | Data Color for the second data set (index = 1) |
Maximum value mark line color | Data Color for the third data set (index = 2) |
Minimum value mark line color | Data Color for the fourth data set (index = 3) |
Middle value mark line color | Data Color for the fifth data set (index = 4) |
Mark line color for additional mark lines | Data Color for the data set representing the additional mark line |
A
BoxWhiskerLayer object representing the box-whisker layer created.
© 2023 Advanced Software Engineering Limited. All rights reserved.