Colors by value
->cellColor() colors each cell from its value: red when fewer than 5 are left (or none), amber when fewer than 10. ->emptyCellText('0') writes 0 in a cell with no row.
Note: What you see
XL × White has 1 left and is red. S × Black has 6 and is amber. The chino pants are not made in XS, so the XS row has no rows in the stocks table: every cell of it shows 0 in red.
|
Size
|
Black
|
White
|
Navy
|
Olive
|
|---|---|---|---|---|
|
XS
|
0 | 0 | 0 | 0 |
|
S
|
6 | 3 | 5 | 8 |
|
M
|
11 | 4 | 9 | 12 |
|
L
|
9 | 3 | 7 | 10 |
|
XL
|
3 | 1 | 2 | 4 |
Heatmap
->heatmap() shades each cell by its value: the bigger the number, the darker the cell.
Note: What you see
The biggest counts are the darkest cells: M × Olive (12), M × Black (11) and L × Olive (10). XL is the lightest row. The XS row has no rows in the stocks table, so its cells show a dash.
|
Size
|
Black
|
White
|
Navy
|
Olive
|
|---|---|---|---|---|
|
XS
|
— | — | — | — |
|
S
|
6 | 3 | 5 | 8 |
|
M
|
11 | 4 | 9 | 12 |
|
L
|
9 | 3 | 7 | 10 |
|
XL
|
3 | 1 | 2 | 4 |
Totals
->totals() adds a total for each size on the right and for each color at the bottom, with the grand total in the corner.
Note: What you see
The corner is the number of chino pants in stock, all sizes and colors together. Click “Change this stock”, change a count, save and come back: the totals follow.
|
Size
|
Black
|
White
|
Navy
|
Olive
|
Total |
|---|---|---|---|---|---|
|
XS
|
— | — | — | — | 0 |
|
S
|
6 | 3 | 5 | 8 | 22 |
|
M
|
11 | 4 | 9 | 12 | 36 |
|
L
|
9 | 3 | 7 | 10 | 29 |
|
XL
|
3 | 1 | 2 | 4 | 10 |
| Total | 29 | 11 | 23 | 34 | 97 |