Skip to content
GitHub

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, fc, pl, bu, pp, py, ...).

apiVersion: bino.bi/v1alpha1
kind: RuleSet
metadata:
  name: corporateRules
spec:
  content: {}  # object or JSON string

spec.content can be either:

  • A YAML object
  • A JSON string (useful when copying from front-end configuration)

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, LayoutPage, and LayoutCard. It is emitted as the ruleset HTML attribute on the corresponding bn-* element.

Besides a rule-set name, ruleset accepts two inheritance keywords:

  • inherited-closest – reuse the ruleset of the nearest surrounding LayoutCard or LayoutPage.
  • inherited-page – reuse the ruleset of the surrounding LayoutPage (cards are skipped).

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:

SectionDescription
scenariosPer-scenario-prefix rule overrides, keyed by scenario prefix
fallbackRules 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. Each entry supports:

PropertyTypeDescription
namestringDisplay base name. Variants get 1..4 appended (e.g. ACAC1).
colorIndexnumberIBCS color encoding: 10 = solid dark, 20 = light gray, 30 = hatched, 50 = outlined.
sortIndexnumberBase sort index for column ordering. Variant n adds n*10.

Each prefix expands into four variants (acac1..ac4) that inherit the base values, with the variant number appended to name and n*10 added to sortIndex.

Applied to scenario names that have no scenarios entry:

PropertyTypeDefaultDescription
namestringSeriesDisplay name for unmatched scenarios.
groupstringSeriesGroup label for unmatched scenarios.
colorIndexnumber10IBCS color encoding (see above).
sortIndexnumber120Sort index for unmatched scenarios.
PrefixNamecolorIndexsortIndex
acAC10400
fcFC30300
plPL50200
buBU50200
ppPP20100
pyPY20100
dac..dpydAC..dPYas basebase + 1000
drac..drpydrAC..drPYas basebase + 2000
---
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}}}
AttributeTypeRequiredDefaultDescription
apiVersionstringyesMust be bino.bi/v1alpha1.
kindstringyesMust be RuleSet.
metadata.namestringyesUnique rule-set identifier. Use _default for global overrides.
metadata.labelsobjectnoKey-value pairs for categorization and constraint matching.
metadata.annotationsobjectnoArbitrary key-value metadata, not used by the system.
metadata.descriptionstringnoFree-form description.
metadata.constraintsarraynoConditional inclusion rules. See Constraints.
AttributeTypeRequiredDefaultDescriptionSample
spec.contentobject or stringyesRule-set overrides as a YAML object or JSON string. Deep-merged over the built-in defaults.see sections above

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