Class Kata “Box Plot”
Develop a graphical control to show box plots .
A box plot visualizes a list of numbers. To quickly get an overview several values are displayed for each number:
- Lower quartile
- Upper quartile
The minimum value of a list of numbers is its smallest value; the maximum value is the largest number respectively.
The median is the number right in the middle of the sorted (!) list. If the list has an even number of elements the numbers “surrounding” the middle will be used to calculate an average. Example:
Original list: 2, 4, 1, 3
Sorted list: 1, 2, 3, 4 => 2 and 3 “surround” the middle of the list. (2+3)/2=2,5 then is the median.
To calculate the lower/upper quartile the list has to be sorted as well. Then the list is split into two halves. The lower quartile is the median of the lower half, the upper quartile is the median of the upper half.
The following figure shows how to calculate median as well as lower/upper quartile:
The result then should be displayed as follows:
The custom control should provide a property Orientation to choose whether the box is shown horizontally (as above) or vertically.
Wikipedia, Box plot, https://en.wikipedia.org/wiki/Box_plot
“I am the founder of Majer Consulting and Majer Training and an experienced software developer, trainer and consultant. I have been on the road in the SAP world since 1998, supporting numerous projects, and have developed a passion for software engineering, software testing and agile development methods such as TDD. When I am not servicing customers or holding seminars, I am speaking at conferences or writing my next book.”