SmallMultiple
SmallMultiple draws one base component once per panel: one panel per value of a dataset column, plus panels you list yourself. All panels use the same dataset, each with its own filter, and all share one scale. This is the IBCS “small multiples” chart template: one measure for many locations, products or regions, where the reader compares the panels.
bino builds the panels when it renders, from the data. A location that is added to the data gets its panel without a change to the manifest. The panels are laid out as a Grid with equal rows and columns, and the axes of each row and column are lined up (see Cell size and alignment).
Minimal definition
Section titled “Minimal definition”This gives one ChartTime per distinct rowGroup value, each filtered to [rowGroup] = '<value>', with the value as the caption of its panel.
When to use it
Section titled “When to use it”- Use
SmallMultiplewhen every panel is the same chart or table on a slice of one dataset, and the panels must be comparable: same scale, same size, axes on one line. - Use a
Gridwhen the cells show different things. - For a scatter or bubble chart split by
rowGrouporcategory, thefacetfield ofChartScatterandChartBubbleis the better fit: it draws all panels in one chart with shared axes. Lint says so (small-multiple-xy-facet). When you need the SmallMultiple for them, setseriesNamesin theComponentStyleso that a series has the same color in every panel.
The panels
Section titled “The panels”panels.by names a column of the dataset. Its distinct values become the panels. Column names are case-sensitive: rowGroup, not rowgroup, and must not contain ]. A value with an apostrophe, such as O'Hare, is quoted for the filter.
ordersorts thebypanels:dataset(default) sorts by the<by>Indexcolumn when it exists (rowGroupIndexforrowGroup), else by label.labelsorts by label, numbers as numbers. Any other name, such asac1, sorts by the sum of that column per panel. Adddescto reverse.limitkeeps the first panels after sorting.itemsare panels you define yourself. They come after thebypanels. An item selects its rows withfilter, can use another DataSet withdataset, and can change its panel withspec.panelsneedsby,items, or both.paramalso passes the panel value to a referenced base as a parameter, for a base that uses it in its text or filter:param: LOCATIONgives${LOCATION}. The value is escaped like${panel.label}(see below). Aselectparameter gets the value as its_LABELtoo, not the label of the option.
The filter of a panel is the filter of the SmallMultiple, the filter of the base and the panel part ([<by>] = '<value>', or the item’s filter), joined with AND. A panel without any of them has no filter, also when its dataset sets a default filter.
The panels, their order and limit come from all rows of the dataset. The filters only apply inside each panel, so a location that a filter removes still gets an empty panel, and the build log says so. To leave panels out, filter the DataSet itself.
The base
Section titled “The base”base is the component in every panel: a ChartStructure, ChartTime, ChartScatter, ChartBubble, ChartBullet or Table. It is either inline (kind + spec) or a reference (kind + ref, with params, and spec to override fields of the referenced document).
The SmallMultiple sets these fields in every panel, over the base and over the spec of an item, so no panel can leave the shared scale:
dataset(or thedatasetof an item),unitScalingandpercentageScaling(ChartStructure, ChartTime and Table),scale,filter.
A dataset in base.spec has no effect, and lint says so. A default filter from the _spec_ columns of the dataset is replaced by the panel filter, and the build log says so.
In the base spec, the caption and the item specs, ${panel.label}, ${panel.value} and ${panel.index} (1-based) are replaced per panel. The values are escaped for where they land: as SQL text in the filter of the base (write '${panel.label}'), as JSON text everywhere else. A label with quotes is safe in both.
One scale
Section titled “One scale”IBCS small multiples are only useful when the reader can compare the panels. That needs two things:
unitScaling: the number of data units per em, or aScalingGroup. It is required for ChartStructure, ChartTime and Table, and must not beauto.scale: a fixed font factor such as"0.5", or"none". It is required and must not beauto. Withauto, each panel picks its own factor, and the sameunitScalinggives bars of different lengths.
Start with scale: "0.5" for a four-column grid on one page, and adjust it until the panels fit. The rule small-multiple-scale and the build both reject a missing or auto value.
Captions
Section titled “Captions”Each panel gets a caption at its top left. The default is ${panel.label}. Set caption to change it, or to "" to turn the captions off:
An empty chartTitle in the base is usual, as the caption names the panel. The font of the captions is set with the caption* keys of the grid style.
card puts every panel in a LayoutCard. Use it when a panel needs more than a caption: a logo, a footer, or a card title in IBCS form.
- The card title names the panel:
titleBusinessUnitis${panel.label}unless you set it. Set it to""for a card without a title line. - The card has no border. Set
cardShowBorder: truefor one. - The captions are off. A
captionnext to acardnames each panel twice, and lint warns (small-multiple-card). cardtakes these fields of aLayoutCard:titleImage,titleBusinessUnit,titleScenarios,titleVariances,titleMeasures,titleDateStart,titleDateEnd,titleDateFormat,titleDateLink,footerText,cardShowBorder,cardFitToContent,selectedStyle,rulesetandi18nNamespace. The card holds exactly the one panel component, so it has nochildrenand no card layout.${panel.label},${panel.value}and${panel.index}are replaced in every field.- An entry of
panels.itemscan change the card of its panel with its owncard, over the shared one. It needscardon the SmallMultiple. - With
cellHeight: auto,cardFitToContentistrueunless you set it.
The page title already names the measure and the period. Repeat titleMeasures or the dates in the card only when the panels differ in them.
The axes stay on one line also when the cards have titles of different height, for example when only some panels have a logo. This needs template engine v1.0.0-next.33 or newer.
Layout
Section titled “Layout”columns: number of panel columns. Default: the square root of the panel count, rounded up (16 panels give 4 columns).cellHeight,cellWidth:equal(default) orauto.cellGap,showBorders(defaultfalse),selectedStyle,i18nNamespace,chartTitle: as on aGrid.
The panels are always aligned on their baselines, in both directions.
Larger panels and backgrounds
Section titled “Larger panels and backgrounds”A panel can take more than one position of the grid, and it can have a background color. Use this for the one location that needs more room, or to set a panel apart.
rowSpanandcolumnSpanare whole numbers from 1. Default: 1.backgroundis a CSS color for the cell of the panel. It wins overcellBackgroundof the grid style, which colors every cell.- An entry of
panels.itemstakes the three fields directly. - A
bypanel comes from the data, so it has no entry of its own.panels.overridesnames it by its value: the same text as${panel.value}.overridesneedsby. The value is compared with the value of the column as it is: text is case-sensitive, and spaces count. A value may have only one entry: put all fields of a panel in it. Lint reports a second entry (small-multiple-override-duplicate), and the build uses the first one and warns. A value that no panel has does nothing. The build log says so, andbino lint --execute-queriesreports it (small-multiple-override-unmatched).
Bino places the panels row by row, in their order. Each panel goes to the next free position where its span has room. A position that a panel skips stays empty, and later panels do not go back to fill it. The grid gets as many rows as the panels need.
A columnSpan larger than columns cannot be placed. The build fails, and lint reports it (small-multiple-span). Without columns, the default is the square root of the number of positions that the panels take, rounded up, and never less than the widest columnSpan.
With cellHeight: equal a panel over two rows is as tall as two rows. The scale does not change: the panel has more room, not larger bars.
Axis titles at the end of a row
Section titled “Axis titles at the end of a row”A ChartTime prints an axis title next to each of its axes: the chart title at the scenario axis, and the name of the variance at a variance axis. In a row of panels this repeats the same name in every panel. IBCS small multiples print it once, right of the last panel of a row.
each(default): every panel has its own axis titles.rowEnd: only the last panel of each row has them, at its right. Bino setsaxisTitlePositionof this panel torightand of all other panels tonone. AnaxisTitlePositioninbase.specis replaced.- A panel that spans rows counts for the row it starts in.
- An entry of
panels.itemsthat setsaxisTitlePositionin itsspeckeeps its own value.
rowEnd needs a ChartTime base. With another base kind the build fails, and lint reports it (small-multiple-axis-titles).
Shared axes for scatter and bubble charts
Section titled “Shared axes for scatter and bubble charts”A SmallMultiple draws one chart per panel. For a ChartScatter or a ChartBubble this repeats the tick labels, both axis titles and the legend in every panel.
With axisTitles: shared the panels are one chart: Bino sets the facet of the base to the level of panels.by and draws it once. So there is one title per axis, tick labels at the outer panels only, one legend, one number format, and the name of a panel stands inside its plot. dataset, filter, scale, chartTitle, selectedStyle and i18nNamespace of the SmallMultiple go to the chart. scale does not need a fixed value here. columns works as in the grid, also its default. cellHeight, cellWidth, cellGap and showBorders belong to the grid and have no effect.
It needs a ChartScatter or ChartBubble base and panels.by: rowGroup or category. It does not work with card, caption, panels.items, panels.overrides, panels.order, panels.limit or panels.param, and not with a base that sets facet itself or uses a ${panel...} placeholder: the build fails, and lint reports it (small-multiple-axis-titles). The level of panels.by must be above the series level of the base, as for facet: a base that colors its points by rowGroup cannot have panels by rowGroup. The chart is then empty and the build reports layout-component-error with the message of the engine. A panel is no target of an Annotation here: the build warns about an annotation with panel and draws no mark for it. Target the SmallMultiple as a whole.
Spans, backgrounds and axisTitles: rowEnd need template engine v1.0.0-next.46 or newer. With an older engine bino build and bino lint stop with small-multiple-span-engine-version.
Annotations on a panel
Section titled “Annotations on a panel”An Annotation can point at one panel, or at a data point in it: name the SmallMultiple and set panel to the label of the panel.
Using it in a layout
Section titled “Using it in a layout”A SmallMultiple is a standalone document, or a child of a LayoutPage or LayoutCard, inline or by ref. It cannot be a cell of a Grid or a node of a Tree, and a ScreenshotArtefact cannot target it directly: wrap it in a LayoutCard.
SmallMultiple needs template engine v1.0.0-next.32 or newer, and v1.0.0-next.33 with card. With an older engine bino build and bino lint stop with grid-cell-layout-engine-version.
Attribute Reference
Section titled “Attribute Reference”| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
spec.dataset |
string or object | yes | - | Dataset of every panel: a DataSet name, an inline DataSet, or a list. With panels.by the first entry must be a DataSet. |
spec.filter |
string | no | - | AlaSQL WHERE fragment ANDed into every panel filter. |
spec.unitScaling |
string or number | conditional | - | Shared unit scaling. Required for ChartStructure, ChartTime and Table bases, never auto. |
spec.percentageScaling |
string or number | no | - | Shared percentage scaling, never auto. |
spec.scale |
string or number | yes | - | Shared font scale: a fixed factor or none, never auto. |
spec.base.kind |
string | yes | - | ChartStructure, ChartTime, ChartScatter, ChartBubble, ChartBullet or Table. |
spec.base.ref |
string | conditional | - | Name of a document of that kind. Without it, base.spec is the inline spec. |
spec.base.params |
object of string | no | - | Parameters of the referenced document. Only with ref. |
spec.base.spec |
object | conditional | - | Inline spec, or overrides of the referenced spec. Required without ref. |
spec.caption |
string | no | "${panel.label}" |
Caption of each panel. "" turns captions off. Off by default with card. |
spec.card |
object | no | - | Put every panel in a borderless LayoutCard. See Cards. |
spec.panels.by |
string | conditional | - | Column whose distinct values become panels. panels needs by or items. |
spec.panels.order |
string | no | dataset |
dataset, label, or a column name, optionally followed by desc. |
spec.panels.limit |
integer | no | - | Most panels from by. |
spec.panels.param |
string | no | - | Pass the panel value to the referenced base as this parameter. Needs base.ref. |
spec.panels.items |
array | conditional | - | Explicit panels after the by panels: label (required), filter, dataset, spec, card, rowSpan, columnSpan, background. |
spec.panels.items[].rowSpan |
integer | no | 1 |
Number of grid rows the panel takes. Minimum: 1. Needs engine v1.0.0-next.46. |
spec.panels.items[].columnSpan |
integer | no | 1 |
Number of grid columns the panel takes. Minimum: 1, not more than columns. Needs engine v1.0.0-next.46. |
spec.panels.items[].background |
string | no | - | Background color of the cell of the panel (CSS color). Needs engine v1.0.0-next.46. |
spec.panels.overrides |
array | no | - | Span and background of single by panels: value (required), rowSpan, columnSpan, background. Needs by. |
spec.panels.overrides[].value |
string, number or boolean | yes | - | The value of the by column that names the panel. |
spec.panels.overrides[].rowSpan, columnSpan, background |
no | - | As on an entry of panels.items. |
|
spec.axisTitles |
string | no | each |
each, rowEnd (axis titles only right of the last panel of a row) or shared (one chart with shared axes and legend). rowEnd needs a ChartTime base and engine v1.0.0-next.46. shared needs a ChartScatter or ChartBubble base. |
spec.columns |
integer | no | square root | Number of panel columns. |
spec.cellHeight |
string | no | equal |
equal or auto. |
spec.cellWidth |
string | no | equal |
equal or auto. |
spec.cellGap |
string | no | - | CSS gap between the panels. |
spec.showBorders |
boolean | no | false |
Lines between the panels. |
spec.chartTitle |
string | no | - | Title of the whole grid. |
spec.selectedStyle |
string | no | - | ComponentStyle of the grid, inherited by the panels. |
spec.i18nNamespace |
string | no | - | I18n namespace inherited by the panels. |