We recently had an interesting query from a company evaluating our software. 

"We would need to show 6 values on a candle, while here only 4 values are available(Open, Close, High, Low). (the 6 values we use are: minimum, average, maximum, maximum for 95% of the data, maximum for 75% of the data and maximum for 50% of the data).   We are interested in getting all the 6 values into the same dashboard block. These are statistic values related to an attribute.  For example for a Line chart we would need only one vertical line with 6 values. "

Since our drawing mechanism is extensible for all our charts, this is possible, if you know the right extension points. For this example, we chose the HLOCChart, since it draws 4 values, we just need to repurpose it to draw 6. Although the HLOCCharrt has a specific purpose (Drawing stock charts), its quite easy to extend the drawing mechanism for it. In this case the user just wants 6 dots in a line. Turns out, not that hard to do:

  1. Extend the HLOCChart initialize the ExtendedHLOCPainter.
  2. Extend the HLOCPainter, implement the painting code on basis of the built in painting code.
  3. Extend the HLOCSeries, add the 2 fields.

The whole thing took about 15 minutes to do!

The code is attached at the bottom of this post, and here is the result:


ExtendedHLOCChart.as (1.62 kb)

ExtendedHLOCChartPainter.as (4.31 kb)

ExtendedHLOCSeries.as (1.73 kb)

HLOCCharts.mxml (3.21 kb)