Bars
->bar() is the default type.
Note: Try it
Point at a bar: the month and its value appear beside the pointer. With the keyboard, press Tab until a bar is outlined, then the arrow keys to move from month to month.
Values on the bars
->dataLabels() writes each value at the end of its bar, in the short form of the axis.
Note: Try it
Read the values without pointing at the bars. The tooltip still gives the exact amount.
Horizontal bars
->horizontal() turns the bars on their side. Long names fit, so it suits rankings.
Note: Try it
Point at a bar to read its value.
Stacked bars
->stacked() puts the series on top of each other, so each bar is the total.
Note: Try it
Click “Paper” in the legend under the chart: that series is taken out and the bars get shorter. Click it again to bring it back.
Lines
->line() draws one line per series.
Note: Try it
Point anywhere above a month: the tooltip lists both regions for that month. You do not need to hit the line itself.
Area
->area() fills the space under the line.
Note: Try it
Point at a month to read the number of orders.
Bars and a line together
Give one series its own type in the data: ->series('Plan', [...], type: 'line').
Note: Try it
The bars are the sales of each month, the line is the plan. Point at a month to read both.
Pie
->pie() shows the first series as shares of the whole.
Note: Try it
Point at a slice: the tooltip shows its amount and its share. The legend lists the share of every category. Click a category in the legend to take it out; the other shares are worked out again.
Donut
->donut() is a pie with the total in the middle.
Note: Try it
Read the total in the middle, then point at a slice for the amount of one region.
A number
->stat() adds the series up into one big number, with a small line that shows how the values moved.
Note: Try it
The number is the sum of the six months in the code. The page “Last year and budget” shows it with the change against last year and a budget.