{
 "id": "bar-chart",
 "name": "Monthly spend chart",
 "purpose": "Six months of spend as bars, with the current month's forecast hatched on top, a dashed budget line and a tooltip on the bar you point at.",
 "use_when": [
  "for monthly spend or usage against a budget, with a forecast",
  "a billing or usage page that must warn early when the month is heading over budget"
 ],
 "avoid_when": [
  "a share of a whole, such as spend by team: use donut-breakdown",
  "a few headline numbers with no monthly history: use kpi-strip or budget-meters",
  "more or fewer than six periods: the columns are fixed at six"
 ],
 "type": "chart",
 "style": "quiet",
 "width": "medium",
 "tags": {
  "audience": "work",
  "industries": [
   "saas",
   "finance",
   "devtools"
  ],
  "keywords": [
   "bar chart",
   "spend",
   "budget",
   "forecast",
   "billing",
   "tooltip"
  ]
 },
 "root": ".odl-bar-chart",
 "parts": [
  {
   "name": "title",
   "selector": ".odl-bar-chart h3",
   "what": "the chart's heading",
   "slot": "text"
  },
  {
   "name": "subtitle",
   "selector": ".odl-sub",
   "what": "the date range and when the data was updated",
   "slot": "text"
  },
  {
   "name": "stats",
   "selector": ".odl-stats div",
   "what": "one headline figure: a label and a value; the forecast can carry an over-budget badge",
   "slot": "list"
  },
  {
   "name": "over",
   "selector": ".odl-over",
   "what": "the forecast as a share of budget, in a warning badge",
   "slot": "text"
  },
  {
   "name": "axis",
   "selector": ".odl-axis span",
   "what": "one value label on the side axis",
   "slot": "list"
  },
  {
   "name": "budget",
   "selector": ".odl-budget",
   "what": "the dashed budget line and its label",
   "slot": "text"
  },
  {
   "name": "months",
   "selector": ".odl-col",
   "what": "one month's bar, with a tooltip of its figures on hover or focus; the current month adds a hatched forecast",
   "slot": "list"
  },
  {
   "name": "tip",
   "selector": ".odl-tip",
   "what": "the month name and its figures, label then value",
   "slot": "rich"
  },
  {
   "name": "x_labels",
   "selector": ".odl-x li",
   "what": "one short month name under the bars",
   "slot": "list"
  },
  {
   "name": "legend",
   "selector": ".odl-legend li",
   "what": "one legend key: spent, forecast or budget",
   "slot": "list"
  },
  {
   "name": "note",
   "selector": ".odl-foot > span",
   "what": "how the forecast was made",
   "slot": "text"
  }
 ],
 "data": {
  "type": "object",
  "required": [
   "title",
   "currency",
   "budget",
   "months"
  ],
  "properties": {
   "title": {
    "type": "string",
    "maxLength": 32,
    "part": "title"
   },
   "subtitle": {
    "type": "string",
    "maxLength": 60,
    "part": "subtitle"
   },
   "currency": {
    "type": "string",
    "maxLength": 3,
    "part": "months"
   },
   "stats": {
    "type": "array",
    "minItems": 1,
    "maxItems": 3,
    "part": "stats",
    "items": {
     "type": "object",
     "required": [
      "label",
      "value"
     ],
     "properties": {
      "label": {
       "type": "string",
       "maxLength": 22
      },
      "value": {
       "type": "string",
       "maxLength": 12
      },
      "badge": {
       "type": "string",
       "maxLength": 5
      }
     }
    }
   },
   "axis_max": {
    "type": "number",
    "part": "axis"
   },
   "budget": {
    "type": "number",
    "part": "budget"
   },
   "months": {
    "type": "array",
    "minItems": 6,
    "maxItems": 6,
    "part": "months",
    "items": {
     "type": "object",
     "required": [
      "label",
      "short",
      "spent"
     ],
     "properties": {
      "label": {
       "type": "string",
       "maxLength": 30
      },
      "short": {
       "type": "string",
       "maxLength": 4
      },
      "spent": {
       "type": "number"
      },
      "forecast": {
       "type": "number"
      },
      "current": {
       "type": "boolean"
      }
     }
    }
   },
   "legend": {
    "type": "array",
    "minItems": 2,
    "maxItems": 3,
    "part": "legend",
    "items": {
     "type": "string",
     "maxLength": 22
    }
   },
   "note": {
    "type": "string",
    "maxLength": 40,
    "part": "note"
   }
  }
 },
 "states": {
  "shown": [
   "hover",
   "focus",
   "current month",
   "forecast over budget"
  ],
  "edge": {
   "empty": {
    "status": "handled",
    "evidence": "data-od-list",
    "how": "the Smart UI renderer puts one plain 'Nothing to show yet.' line in an empty list"
   },
   "loading": {
    "status": "handled",
    "evidence": "data-od-slot",
    "how": "the Smart UI renderer draws each marked slot as a quiet block of its size while the data arrives; the static file shows the filled part"
   },
   "error": {
    "status": "not_built",
    "how": "if the spend data fails to load, replace the plot with an alert-banners line and a retry button"
   },
   "disabled": {
    "status": "not_built",
    "how": "the bars have no action to disable; nothing to build unless they open a month"
   },
   "overflow": {
    "status": "handled",
    "how": "in a narrow box every tooltip moves to the plot's top-left corner so it cannot run past the card",
    "evidence": "max-inline-size: 100%; transform: none"
   },
   "long_text": {
    "status": "handled",
    "how": "the heading and figures wrap onto separate lines; figures, axis labels and the budget label never break",
    "evidence": "flex-wrap: wrap; align-items: start; justify-content: space-between"
   },
   "missing_image": {
    "status": "none",
    "how": "the part has no photo"
   }
  }
 },
 "tokens": [
  "--ds-border-width-default",
  "--ds-border-width-emphasis",
  "--ds-color-bg-accent-bold",
  "--ds-color-bg-accent-subtle",
  "--ds-color-bg-inverse",
  "--ds-color-bg-warning-subtle",
  "--ds-color-border-accent",
  "--ds-color-border-focus",
  "--ds-color-border-strong",
  "--ds-color-border-subtle",
  "--ds-color-surface-raised",
  "--ds-color-text-inverse",
  "--ds-color-text-primary",
  "--ds-color-text-secondary",
  "--ds-color-text-tertiary",
  "--ds-color-text-warning",
  "--ds-elevation-floating",
  "--ds-elevation-raised",
  "--ds-focus-ring-offset",
  "--ds-focus-ring-width",
  "--ds-font-weight-heading",
  "--ds-motion-duration-short",
  "--ds-motion-easing-standard",
  "--ds-radius-2",
  "--ds-radius-4",
  "--ds-radius-container",
  "--ds-radius-full",
  "--ds-size-target-min",
  "--ds-space-12",
  "--ds-space-2",
  "--ds-space-24",
  "--ds-space-4",
  "--ds-space-inline-md",
  "--ds-space-inline-sm",
  "--ds-space-inline-xs",
  "--ds-space-inset-lg",
  "--ds-space-inset-md",
  "--ds-space-inset-sm",
  "--ds-space-inset-xl",
  "--ds-space-inset-xs",
  "--ds-space-stack-lg",
  "--ds-space-stack-md",
  "--ds-space-stack-sm",
  "--ds-space-stack-xl",
  "--ds-space-stack-xs",
  "--ds-text-body-md",
  "--ds-text-body-sm",
  "--ds-text-label-md",
  "--ds-text-label-sm",
  "--ds-text-numeric-lg",
  "--ds-text-numeric-md",
  "--ds-text-title-md"
 ],
 "a11y": {
  "summary": "Each bar is a button whose name says the month, the amount and how it sits against the budget; Tab moves through the months and shows the same tooltip as hover.",
  "roles": [
   "list",
   "listitem",
   "region"
  ],
  "keyboard": [
   "Tab moves through the six month bars in order",
   "A focused bar shows its tooltip and dims the other bars, as hover does"
  ],
  "controls": {
   "button": 7,
   "input": 0,
   "link": 0,
   "select": 0,
   "textarea": 0,
   "summary": 0
  },
  "focus_visible": true,
  "reduced_motion": true,
  "min_target": true
 },
 "files": {
  "html": "components/bar-chart/component.html",
  "bytes": 20779,
  "script": true
 },
 "source": "brand/showcase/product/05-kilnworks-billing",
 "photos": 0,
 "urls": {
  "html": "https://opendesigner.dev/library/bar-chart.html",
  "json": "https://opendesigner.dev/library/bar-chart.json",
  "page": "https://opendesigner.dev/library/bar-chart/"
 },
 "get": {
  "curl": "curl -fsSLo bar-chart.html https://opendesigner.dev/library/bar-chart.html",
  "opendesigner": "python3 path/to/skills/opendesigner/scripts/library.py add bar-chart --from https://opendesigner.dev",
  "prompt": "Add the OpenDesigner component bar-chart to this project: https://opendesigner.dev/library/bar-chart.html. Keep its markup and states; map its --ds-* variables to my tokens."
 }
}
