Skip to content

RuleSet

RuleSet manifests adjust the IBCS scenario rules that tables, charts, and titles use to display scenario columns: the display name, the IBCS color encoding, and the sort order of each scenario prefix (ac, pp, fc, pl).

The smallest well-formed RuleSet sets the required spec.content and overrides the scenario rules you actually want to change. An empty content leaves the built-in rules untouched, so the manifest would have no effect.

apiVersion: bino.bi/v1alpha1
kind: RuleSet
metadata:
  name: corporateRules
spec:
  content:
    scenarios:
      pl:
        name: PLAN
        colorIndex: 50
        sortIndex: 900

Instead of a YAML object, spec.content also accepts a JSON string, which is handy when copying from front-end configuration; see JSON string form.

All attributes are listed in the Attribute Reference below.

The metadata.name of a RuleSet decides how it is applied:

  • _default - applied to all components automatically.
  • Any other name (e.g. corporateRules) - a named rule set that individual components opt into via spec.ruleset.

At render time each component merges rule-set layers in this order (later wins): built-in _system defaults → _default → the rule set named by ruleset. Overrides are partial: anything you leave out keeps its built-in value.

---
apiVersion: bino.bi/v1alpha1
kind: RuleSet
metadata:
  name: corporateRules
spec:
  content:
    scenarios:
      pl:
        name: PLAN
        sortIndex: 900
---
apiVersion: bino.bi/v1alpha1
kind: Table
metadata:
  name: revenue_table
spec:
  dataset: revenue_by_customer
  ruleset: corporateRules

ruleset is available on Table, ChartStructure, ChartTime, ChartScatter, ChartBubble, ChartBullet, LayoutPage, and LayoutCard. It is emitted as the ruleset HTML attribute on the corresponding bn-* element.

Besides a rule-set name, the component kinds (Table and the Chart* kinds) accept two inheritance keywords:

  • inherited-closest - reuse the ruleset of the nearest surrounding LayoutCard or LayoutPage that sets one. A card without ruleset is skipped and the lookup continues outwards to the page. Template engines before v1.0.0-next.28 ask only the nearest card or page.
  • inherited-page - reuse the ruleset of the surrounding LayoutPage (cards are skipped).

A keyword that finds no ruleset this way applies no named rule set: the component uses the _system and _default rule sets only, on every engine version. bino lint reports it with the rule inherited-prop-unresolved.

On LayoutPage and LayoutCard only inherited-page is meaningful, because a layout inherits from the page around it, never from itself.

A ruleset set on a LayoutPage or LayoutCard also applies to the layout’s own title row, so scenario labels in page/card titles follow the same rules.

apiVersion: bino.bi/v1alpha1
kind: LayoutPage
metadata:
  name: plan_review
spec:
  ruleset: corporateRules
  children:
    - kind: Table
      ref: revenue_table
      spec:
        ruleset: inherited-page # resolves to corporateRules

The rule-set object has two top-level sections, both optional:

Section Description
scenarios Per-scenario-prefix rule overrides, keyed by scenario prefix
fallback Rules applied to scenario names not covered by scenarios

scenarios is a map keyed by scenario prefix. Known prefixes are the base scenarios (ac, fc, pl, bu, pp, py), the absolute variances (dac … dpy), and the relative variances (drac … drpy); user-defined prefixes are allowed too. Dataset columns exist only for ac, pp, fc and pl, so an entry for bu or py has no effect. For a variance prefix only sortIndex is read. Each entry supports:

Property Type Description
name string Display name. Slot 1 shows it as written, slots 2 to 4 with their number (Budget, Budget2).
colorIndex number Theme style slot the scenario is drawn in: 10 = ac (solid), 20 = pp (light), 30 = fc (hatched), 50 = pl (outlined). Any other value counts as 10.
sortIndex number Base sort index for column ordering. Slot n adds n*10.

Each prefix expands into four slots (ac → ac1..ac4) that inherit the base values, with n*10 added to sortIndex.

From template engine v1.0.0-next.29 on, name and colorIndex work in Table, ChartTime, ChartStructure and in page and card titles. Older engines read them only in ChartScatter, ChartBubble and ChartBullet; in a table, a time chart or a structure chart a rule set changed only the order.

  • name replaces the translated labels global.<prefix>1 to global.<prefix>4, in every locale. With pl: { name: Budget } the column of pl1 is labelled Budget and the one of pl2 Budget2, whatever an Internationalization document sets for global.pl1. Only a name that a RuleSet sets counts. The built-in names in the table below do not label anything.
  • colorIndex selects one of the four looks of the theme. The ComponentStyle still decides how each look is drawn. It applies to bars, markers, lines, the variance axis, the bars inside table cells and the line under a table column header.

A report that already has a RuleSet with name or colorIndex therefore changes its output when it moves to engine v1.0.0-next.29 or later.

Applied to scenario names that have no scenarios entry:

Property Type Default Description
name string Series Display name for unmatched scenarios.
group string Series Group label for unmatched scenarios.
colorIndex number 10 Theme style slot (see above).
sortIndex number 120 Sort index for unmatched scenarios.
Prefix Name colorIndex sortIndex
ac AC 10 400
fc FC 30 300
pl PL 50 200
bu BU 50 200
pp PP 20 100
py PY 20 100
dac..dpy dAC..dPY as base base + 1000
drac..drpy drAC..drPY as base base + 2000

bu and py are part of the built-in rules, but no dataset column uses these prefixes.

---
apiVersion: bino.bi/v1alpha1
kind: RuleSet
metadata:
  name: corporateRules
spec:
  content:
    scenarios:
      pl:
        name: PLAN
        colorIndex: 50
        sortIndex: 900
      fc:
        name: FCST
    fallback:
      name: Other
      colorIndex: 20

You can also provide the content as a JSON string:

---
apiVersion: bino.bi/v1alpha1
kind: RuleSet
metadata:
  name: compactRules
spec:
  content: >-
    {"scenarios":{"pl":{"name":"PLAN","sortIndex":900}}}
Attribute Type Required Default Description
apiVersion string yes - Must be bino.bi/v1alpha1.
kind string yes - Must be RuleSet.
metadata.name string yes - Unique rule-set identifier. Use _default for global overrides.
metadata.labels object no - Key-value pairs for categorization and constraint matching.
metadata.annotations object no - Arbitrary key-value metadata, not used by the system.
metadata.description string no - Free-form description.
metadata.constraints array no - Conditional inclusion rules. See Constraints.
Attribute Type Required Default Description Sample
spec.content object or string yes - Rule-set overrides as a YAML object or as a JSON string (at least 2 characters). Deep-merged over the _system and _default layers. Rendered as the JSON body of a bn-ruleset element. content: { scenarios: { pl: { name: PLAN } } }
spec.content.scenarios object no - Per-scenario-prefix rule overrides, keyed by scenario prefix (ac, fc, pl, bu, pp, py, dac..dpy, drac..drpy, or a user-defined prefix). See Scenario rules. scenarios: { pl: { name: PLAN } }
spec.content.scenarios.<prefix> object no built-in _system rule of that prefix Rule overrides for one scenario prefix. Slots 1-4 are derived from the base values. See Built-in defaults. pl: { name: PLAN, colorIndex: 50, sortIndex: 900 }
spec.content.scenarios.<prefix>.name string no - Display name; slot 1 shows it as written, slots 2 to 4 with their number (Budget, Budget2). name: PLAN
spec.content.scenarios.<prefix>.colorIndex number no - Theme style slot: 10 = ac (solid), 20 = pp (light), 30 = fc (hatched), 50 = pl (outlined). colorIndex: 50
spec.content.scenarios.<prefix>.sortIndex number no - Base sort index for column ordering; slot n adds n*10. sortIndex: 900
spec.content.fallback object no - Style applied to scenario names not present in scenarios. See Fallback rules. fallback: { name: Other, colorIndex: 20 }
spec.content.fallback.name string no see Fallback rules Display name for unmatched scenarios. name: Other
spec.content.fallback.group string no see Fallback rules Group label for unmatched scenarios. group: Other
spec.content.fallback.colorIndex number no see Fallback rules Theme style slot: 10 = ac (solid), 20 = pp (light), 30 = fc (hatched), 50 = pl (outlined). colorIndex: 20
spec.content.fallback.sortIndex number no see Fallback rules Sort index for column ordering. sortIndex: 500

Components reference a named rule set through their own spec.ruleset attribute; see Using named rule sets.