The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....

Using TBoxPlot

The TBoxplot component is a chart component which creates statistical charts called box plots. For background information on box plots please visit Fundamentals of Statistics. The boxplot summarizes the following parameters (see figure at the right):
  • minimum and maximum
  • 10-percentile: 10 percent of all data are below this value
  • 1st quartile: 1 quarter of the data is less than this threshold
  • mean
  • median
  • 3rd quartile: 3 quarters of the data are less than the 3rd quartile
  • 90-percentile: 90 percent of the data are below this threshold

Please note that the range between the 1st and the 3rd quartile contain 50% of the data, and the range between the 10-percentile and the 90-percentile covers 80% of the data.

The principle of generating one or several box plots is quite simple: a data table (property Data) contains the data to be summarized as box plots. Each column of the data table forms the basis of a box plot, thus a table with, for example, 5 columns results in 5 box plots which are arranged in the same order as the columns. In order to allow for a different number of data cells in each box plot, the data cells whose cell state (property Data.CellState) is either csNAN or csUndefined are excluded from the calculation of the box plot (the red cells in the figure below).

In general, the box plots are updated automatically whenever any data cell changes. While this feature is desired for changes in a few data cells, it may become counterproductive when many cells are changed at once, since this will trigger as many repaint and recalculation requests as changed cells. In such cases you should set the property SuppressPaint to TRUE before changing any cell, and set it to FALSE after the last cell has been changed. In order to force a recalculation of the box plots when SuppressPaint is TRUE, you can call the method Update.

The generated box plot chart can be zoomed in and out by using the method SetRange or the properties Scale1X and Scale1Y. By default the x-axis spans a range from 0.5 to Data.NrOfColumns+0.5 and the y-axis spans a range so that all box plots are visible (if the property Orientation is set to bpltHorizontal the roles of the x- and the y-axis are exchanged). Zooming in and out can also performed interactively by setting the property MouseAction to maPan, maPanHoriz, maPanVert, maZoomWind, maZoomWindPos, or maZoomDrag.

Each box plot has an associated label whose text is taken from the column header of the data table (property Data.ColName). All labels share the same style which can be adjusted by setting the sub-properties of the Labels property.

The colors, the symbols and the visibility of parts of the box plots can be adjusted by using the properties Color90Perc, ColorBody, ColorLines, ColorMean, ColorMedian, ColorMinMax for the colors, SymbolMax, SymbolMean, SymbolMedian, SymbolMin, SymbolPerc90 for the symbols, and Show90Perc, ShowMean, ShowMedian, ShowMinMax for the visibility. Please note that the colors of the box plots can be adjusted on an individual basis by using the event OnBeforeBoxDraw.

Last Update: 2016-Jun-26