Skip to main content
The code for these examples can be used in the Markdown visualization to create a series of cards that show a consistently sized chart across ‘tests’ that can have a variety of ranges. Inspiration for these charts were taken from blood test results where measurements for a “normal” range vary in units and min and max values.

Setup

This query used for this example has the following structure:
  • Test name - Title for the card
  • Normal min - Value for the minimum “normal” range
  • Normal max - Value for the maximum “normal” range
  • Measurement - The current “test” result/value to plot on the chart
  • Chart min (calc_4) - Calculated “min” of the whole chart using the (=B1 - ((C1 - B1) / 2))
  • Chart max (calc_1) - Calculated “max” of the whole chart using the (=(C1 - B1) / 2 + C1)
  • % position (calc_2) -
  • Result classification (calc_5) - calculation to use for coloring (=IF(D1 < B1, "low", IF(D1 > C1, "high", "normal")))
  • Units - For labeling
  • Notes (calc_3) - Additional context for the card
The calculations for the full range of the chart are done positioning the “Normal min” at the 25% mark of the bar and the “Normal max” at the 75% mark. If your data can start at 0 or go below zero, you may need to adjust these calculations.

Example code