Rebuild a misleading chart honestly
Task
Draw the same monthly order counts twice: once the misleading way -- two months, an axis starting at 140 -- and once honestly, with the whole year on a zero baseline. Then write the caption the honest chart supports.
Steps
- Count orders per month in
data/orders.csv. - Write
lab/honest/svgbars.pywith a function taking labels, values and an axis minimum. It returns an SVG with one<rect class="bar" data-label="LABEL" data-value="VALUE" height="H">per value, where H is (value minus the minimum) divided by (the largest value minus the minimum) times 300, and a<text class="axis-min">MINIMUM</text>element. - Write
lab/honest/misleading.svgfor February and March only, with an axis minimum of 140. - Write
lab/honest/honest.svgfor all twelve months with an axis minimum of 0. - Write
lab/honest/caption.txtwith the linesyear change: N%(January to December, to one decimal place) andmonths ranged from MIN to MAX orders.
Verify
These checks run in a POSIX shell with Python 3: Terminal on macOS or Linux, and on Windows Git Bash (it comes with Git for Windows) or WSL. On Windows, python3 is often a Microsoft Store placeholder that prints “Python was not found”; run alias python3=py in Git Bash first.
for f in misleading honest; do echo "$f: $(grep -o '<rect class="bar"' lab/honest/$f.svg | wc -l) bars, axis from $(grep -o 'class="axis-min">[0-9]*' lab/honest/$f.svg | cut -d'>' -f2)"; done
grep -E '^(year change|months ranged)' lab/honest/caption.txt
The misleading chart has 2 bars on an axis from 140; the honest one has 12 bars from 0. The year change is 4.7% and the months ranged from 147 to 178 orders: a flat year with month-to-month noise. Both charts draw true numbers. The misleading one lies through its window and its axis, which is why a reviewer checks both.
This is an independent study companion for CompTIA Data+ DA0-002 and is not produced by or endorsed by CompTIA.