Annotation
An Annotation points at a component, or at one data point of it, and draws a mark over the page:
marker(default): a numbered circle.frame: a rounded frame around a value. A frame around a text is an oval.arrow: a straight arrow between two data points.difference: the difference of two values of a chart.pointer: a thick arrow that points down at the end of a bar.bracket: a line around some rows of aChartStructure, with a text or their share.
An annotation with a title or a text gets a number. An AnnotationList on the same page prints the numbered texts.
The annotation points at the component. The component does not change and does not know about it, so this also works for a component from a package.
Minimal definition
Section titled “Minimal definition”target.name is the document a layout child refs, or metadata.name of an inline child. Without point the mark goes on the component as a whole.
The point
Section titled “The point”point names one data point by its raw dataset values, not by the formatted label.
| Field | Value |
|---|---|
rowGroup, category, subCategory |
The value of the column. |
date |
The first day of the period, YYYY-MM-DD. With dateInterval: year a row of 2024-03-15 is in the period 2024-01-01. A period that does not start at midnight also has the time: 2024-01-01T09:00:00. |
scenario |
A slot (ac1, pl1), a variance (dac1_pl1_pos), a table column, or a family (ac, pl) on the total of a stack that overlays families. |
row |
subtotal or total, for those rows of a table. On a ChartTime with totals, total is a total column. With by other than all, date is the first day of its period. |
part |
element (default): the bar, mark, row or cell. label: its value label. total: the total label of a stack. |
A field left out is a wildcard. The point must match exactly one rendered element. What a component reports differs by kind:
| Kind | Fields of a data point |
|---|---|
ChartTime |
date and scenario. With stack.by: dimensions a segment also has category, the name of its series. A stack total has date only, or also scenario: ac when the stack overlays families and each one has its own total. |
ChartStructure |
The dimension of level and scenario. With stack by dimensions a segment also has the next lower dimension. A sum row has the name of its rowGroup, or the sumTitle, in the dimension of level. With template engine v1.0.0-next.69 it also has row: total for the row over all rows, subtotal for the row of a group. |
ChartScatter, ChartBubble |
The dimensions of the point level, the series level and the facet level. |
ChartBullet |
The dimension of level and the actual measure as scenario. |
Table |
rowGroup, category, subCategory, and date in a column of a date interval. scenario selects the column. Without scenario the whole row is the target. |
Text, Tree, Grid |
None: use a target without point. |
SmallMultiple |
With panel: the fields of its base kind. Without panel: none. |
A table point without subCategory means the row itself and not its thereof rows. All columns of one scenario with columnthereof or interval: setname have the same key, so a point cannot tell them apart.
Examples
Section titled “Examples”Marker on a table cell and on a whole row
Section titled “Marker on a table cell and on a whole row”On a table cell the marker sits next to the number, not on it. The same holds for a value label of a chart (part: label or part: total) from template engine v1.0.0-next.51 on: the marker sits right of the label. A dense table has no room for that: there it is smaller and sits in the wider gap next to the number.
Subtotal and total rows
Section titled “Subtotal and total rows”Frame around a stack total
Section titled “Frame around a stack total”This annotation has no text, so it has no number and no entry in a list.
Arrow between two totals
Section titled “Arrow between two totals”Both ends are data points, never free coordinates, and both must be on one page. to is required for mark: arrow, mark: difference and mark: bracket, optional for mark: frame and not allowed for the other marks.
Difference between two values
Section titled “Difference between two values”mark: difference shows how far two values of a chart are apart. A thin line runs from the level of each value to a bar behind the second one, and the label is to minus target. Needs template engine v1.0.0-next.49.
- A point of a stacked chart without
categorymeans the sum of the stack. Withcategoryit means one series. percent: trueadds the relative difference in brackets:+12.2 (+12%).highlight: truedraws a frame around it.digitssets the digits of the absolute difference. Default: 1.- The bar has the color
positivefor a higher value andnegativefor a lower one.sentiment: good-downturns that around, for costs. Acoloron the annotation wins. - A difference has no part: the point always means the bars.
- On a
ChartStructurethe bars run from left to right. There the bar of the difference lies below the second row, or above it when that row is the upper one. This needs template engine v1.0.0-next.51.
Pointer at the end of a bar
Section titled “Pointer at the end of a bar”mark: pointer draws a thick arrow that points down at the value end of a bar: the right end of a bar of a ChartStructure, the top of a column of a ChartTime. A point of a stack without a scenario means the whole stack. Needs template engine v1.0.0-next.51.
Bracket around rows
Section titled “Bracket around rows”mark: bracket marks the rows of a ChartStructure from target to to. A line runs below the last row to the end of its bar, and from there up to the end of the bar of the first row. The text stands in a frame at the upper left. With percent: true the text is the share of these rows in all rows of the chart, for the bars the point names. markText sets another text. Needs template engine v1.0.0-next.51.
- Both ends must be in one chart.
- The share counts the rows with a bar. A sum row is not a part of it.
Frame around two data points
Section titled “Frame around two data points”A frame with to is one oval around both data points: the ellipse through the corners of the box that holds both. Use it for a group of points in a ChartScatter: name the two points that lie farthest apart, and the points between them are inside. Needs template engine v1.0.0-next.75.
The two ends can also be the mark and the name label of one point. The oval then goes around both:
- Both ends must be data points, not a component as a whole.
- A text of its own (
markText) is not printed on such a frame. - When the oval has no room on the page, the frame is drawn close around both ends with round ends.
Frame with its own text
Section titled “Frame with its own text”A frame with markText prints that text on the target and draws the frame around it. Use it for a number the chart does not show, for example a share. Needs template engine v1.0.0-next.49.
On a value label of a chart (part: label or part: total) the text stands right of the label, so both can be read. This needs template engine v1.0.0-next.51. An older engine prints the text on the label. markTextPosition: above puts the text above the label and not right of it (template engine v1.0.0-next.54).
One panel of a SmallMultiple
Section titled “One panel of a SmallMultiple”A SmallMultiple draws one chart or table per panel. panel names one of them by its label: a value of panels.by, or the label of a panels.items entry. point is then a data point of the chart or table in this panel.
- With
paneland withoutpoint, the mark goes on the panel as a whole. - Without
panel, the target is the SmallMultiple as a whole, like aGrid. It has no data points then. panelis only allowed withkind: SmallMultiple.- A panel that does not exist is reported by
annotation-target-missing. The labels ofpanels.bycome from the data, so for them the rule needs--execute-queries, andbino buildwrites a warning to its log. - A label should name one panel. When two panels have it, a
byvalue that is also thelabelof apanels.itemsentry, or two entries with one label, the mark goes on each of them, with the same number. Lint and the build log report it asannotation-panel-ambiguous. Give the item another label. - A panel that
panels.limitdrops does not exist. Lint builds thebypanels like the build: withpanels.orderandpanels.limit. - The point check looks at the rows of the panel only: for a
bypanel the rows with its value in thebycolumn. It does not look at thefilterof apanels.itemsentry.
Numbers
Section titled “Numbers”The CLI gives the numbers, per page and starting at 1:
- The order of the entries of the page’s
AnnotationLists. - Then the other annotations of the page, in manifest order.
Only an annotation with a title or a text gets a number. A number exists only if a mark carries it: an annotation whose point is not in the data gets none, and the next ones move up. Its text stays in the list without a number.
A component that sits on a page twice gets the mark twice, with the same number.
A point that is not in the data
Section titled “A point that is not in the data”This is a warning and not a failure. The rule annotation-point-missing compares the point with the rows of the component’s dataset. bino build and bino preview write it to their log. bino lint --execute-queries reports it as a finding, which fails only with --fail-on-warnings or a severity you set in bino.toml.
The check does not look at the filter of a component, it skips a component that binds several datasets, and it cannot see whether a wildcard matches several elements. For a panel of a SmallMultiple whose sums, sumTitle or level holds a param of the base document, bino lint does not judge the point: only the build knows the value. In these cases the engine draws nothing and writes a warning to the browser console. The entry in the list keeps its place and loses its circle, the other numbers stay as they are.
Colors
Section titled “Colors”color names a color from the bn-annotation section of a ComponentStyle. Built in are negative and positive. Without color, or with a name the style does not have, a mark has the main color of the style, a blue.
Limits
Section titled “Limits”- A direct child of a
Gridcan be a target, and so can a node of aTreethat renders a document byref. A component in a card that sits in aGridor aTree, and an inline node of aTree, cannot. The ruleannotation-target-missingsays so. TheGridor theTreeas a whole can be one. A panel of aSmallMultiplecan be a target, see One panel of a SmallMultiple. - A
ScreenshotArtefactof a single component does not show the marks: they are drawn over the page and not in the component. - A component embedded in the Markdown of a
DocumentArtefacthas no marks. - The presentation view shows annotations like
bino preview. metadata.annotationsof any document is an unused free-form map and has nothing to do with this kind.
Targets in the HTML
Section titled “Targets in the HTML”A tool that reads the HTML of bino preview or of a build can find the targets without an annotation on the page:
- A component on a page or in a card on a page sits in an element with
data-bino-kindanddata-bino-ref(a document byref) ordata-bino-name(an inline child). Itstargetiskindfromdata-bino-kindandnamefromdata-bino-ref, else fromdata-bino-name. - A direct child of a
Gridand a node of aTreethat can be a target sit in an element withdata-bino-target-kindanddata-bino-target-name. These aretarget.kindandtarget.nameas they are. A child that cannot be a target has neither. - Each panel of a
SmallMultiplesits in an element withdata-bino-panel: the label thattarget.paneltakes.kindandnameare those of theSmallMultiple.
A mark knows its annotation too. From template engine v1.0.0-next.88 on, each mark of bn-annotation-layer (a g.mark in its shadow root) and each entry of bn-annotation-list has data-bino-annotation with the metadata.name of its Annotation. Two annotations with the same target and point can so be told apart. In bino preview the items of the layer and the list also carry the file and line of each Annotation (sourceFile, line). An older engine draws the marks without the attribute.
A document that sits on a page twice has the same target in both places, and the mark goes on both.
Attribute reference
Section titled “Attribute reference”| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
spec.mark |
string | no | marker |
marker, frame, arrow, difference, pointer or bracket. |
spec.markText |
string | no | - | For frame: a text printed on the target, with the frame around it. For bracket: its text. |
spec.markTextPosition |
string | no | beside |
For frame with markText on a value label of a chart: beside or above. |
spec.percent |
boolean | no | false |
For difference: also print the relative difference. For bracket: print the share of its rows. |
spec.digits |
integer | no | 1 |
For difference: digits of the absolute difference. |
spec.sentiment |
string | no | good-up |
For difference: good-up or good-down. |
spec.highlight |
boolean | no | false |
For difference with percent: a frame around the relative difference. |
spec.color |
string | no | main color | Name of a color in the bn-annotation style. |
spec.target.kind |
string | yes | - | ChartTime, ChartStructure, ChartScatter, ChartBubble, ChartBullet, Table, Text, Tree, Grid or SmallMultiple. |
spec.target.name |
string | yes | - | Name of the component. |
spec.target.panel |
string | no | - | Label of one panel. Only with kind: SmallMultiple. See One panel of a SmallMultiple. |
spec.target.point |
object | no | whole component | See The point. |
spec.to |
object | for arrow, difference and bracket |
- | The end of the arrow, the second value of the difference, the last row of the bracket or the second data point of a frame, the same shape as target. |
spec.title |
string | no | - | Shown in bold in the list. |
spec.text |
string | no | - | Inline Markdown shown in the list. |