The function barchart() inserts a bar chart into a report.
ReportElement barchart(array data, [array settings])
'ref.value' – Display a reference marker (vertical line) at this value'ref.color' – Color of the reference marker'ref.label' – Label of the reference marker'color' – Color for the axes and the outline of the bars'color.bars' – Color of the bars'color.values' – Color of the labels (values) within the bars'format' – Formatting for the labels of the barssprintf(), e.g., %01.2f% for a decimal number with 2 decimal places.%tsd … – Formatting with a thousands separator, e.g., %tsd € for 1.234 €.
Use barchart() within a box() to specify the size of the chart.
$data = [ 'Apples' => 800, 'Pears' => 1200, 'Clementines' => 1100, 'Dates' => 1800, 'Strawberries' => 900, 'Figs' => 1400 ]; add( box([ 'height' => 60, 'width' => 120 ], barchart( $data, [ 'ref.value' => 1000, 'ref.color' => '#00CC00', 'ref.label' => 'Reference value', 'color.bars' => '#6666FF', 'color.values' => '#FFFFFF', ] ) ) );