{
  "$schema": "https://design.senvenli.com/schema/component.full.json",
  "kind": "component",
  "family": "charts",
  "status": "alpha",
  "import": "@senvenli/react/charts",
  "name": "bar-chart",
  "title": "Bar chart",
  "exports": [
    "BarChart"
  ],
  "description": "Values per category or period as bars, grouped or stacked, vertical or horizontal.",
  "keywords": [
    "chart",
    "bar",
    "column",
    "compare",
    "stacked",
    "waterfall",
    "bridge",
    "variance"
  ],
  "usage": {
    "when": [
      "Comparing values across categories or periods.",
      "Explaining a change between two totals."
    ],
    "instead": [
      {
        "use": "bar-list",
        "when": "A ranked list of names with values reads better."
      }
    ]
  },
  "a11y": {
    "keyboard": [
      {
        "keys": "Arrow left / right",
        "does": "Moves between data points; the tooltip follows."
      }
    ],
    "builtIn": [
      "A \"Show as table\" button shows the same data as a table, which screen readers get by default."
    ],
    "youProvide": [
      "A title that says what the figure is."
    ]
  },
  "related": [
    "bar-list"
  ],
  "genui": {
    "expose": true,
    "description": "Values per category. Rows are categories or periods; categories are the numeric columns (a stack holds at most five).",
    "props": [
      "title",
      "period",
      "data",
      "index",
      "categories"
    ],
    "children": "none",
    "schema": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "title": {
          "type": "string",
          "description": "What the chart shows (\"Income and expenses\"), over it; leave it out when a card or a heading already says so."
        },
        "period": {
          "type": "string",
          "description": "The period it covers (\"September 2026\")."
        },
        "data": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "string",
                "number",
                "boolean",
                "null"
              ]
            }
          }
        },
        "index": {
          "type": "string",
          "description": "The x key: the period or category of each row."
        },
        "categories": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The series keys, in order; the first is the product's own figure (`ds-chart-1`)."
        }
      }
    }
  },
  "source": [
    "src/charts/bar-public.tsx"
  ],
  "props": {
    "BarChart": [
      {
        "name": "title",
        "type": "string",
        "required": false,
        "origin": "own",
        "description": "What the chart shows (\"Income and expenses\"), over it; leave it out when a card or a heading already says so.",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "aria-label",
        "type": "string",
        "required": false,
        "origin": "own",
        "description": "Names the chart when it has no visible `title`.",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "period",
        "type": "string",
        "required": false,
        "origin": "own",
        "description": "The period it covers (\"September 2026\").",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "isLoading",
        "type": "boolean",
        "required": false,
        "origin": "own",
        "schema": {
          "type": "boolean"
        }
      },
      {
        "name": "emptyState",
        "type": "React.ReactNode",
        "required": false,
        "origin": "own",
        "description": "Shown instead of the plot when there is no data: an `EmptyState size=\"small\"` or text; \"No data\" by default."
      },
      {
        "name": "start",
        "type": "WaterfallChartStep",
        "required": false,
        "origin": "own",
        "description": "The opening total (\"Opening balance\"), a total bar from zero; the running total starts at 0 without it. A\nstart without a finite value (NaN, ±Infinity) is left out the same way, with a warning in the console: no\nstart bar, the running total starts at 0, and the end total is the finite steps' sum (never NaN)."
      },
      {
        "name": "steps",
        "type": "readonly WaterfallChartStep[]",
        "required": false,
        "origin": "own",
        "description": "The changes, in order: a positive value raises the running total, a negative one lowers it, and a zero leaves\nit (a neutral step: a flat 1.5px line at the running total, labeled \"€ 0\" with no sign, and no legend key of\nits own). Steps without a finite value are left out, with a warning in the console. When nothing moves off\nzero (no step, or every figure zero, start included), the chart counts it as nothing measured and shows the\nempty state.",
        "schema": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "name": {
                "type": "string"
              },
              "value": {
                "type": "number"
              }
            },
            "required": [
              "name",
              "value"
            ]
          }
        }
      },
      {
        "name": "endLabel",
        "type": "string",
        "required": false,
        "origin": "own",
        "description": "The closing total's name (\"Net\"): a total bar from zero to the start plus every step.",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "valueFormatter",
        "type": "ChartValueFormatter",
        "required": false,
        "origin": "own",
        "description": "Shared by the axis, the labels, the tooltip and the table (\"€ 48.920\"). Changes and a negative total are\nformatted by their size with a `+` or `−` before them, so the formatter sees non-negative values there."
      },
      {
        "name": "height",
        "type": "number",
        "required": false,
        "origin": "own",
        "description": "The plot's height in px; 240 by default.",
        "schema": {
          "type": "number"
        }
      },
      {
        "name": "type",
        "type": "\"waterfall\" | \"percent\" | \"grouped\" | \"stacked\"",
        "required": false,
        "origin": "own",
        "description": "`waterfall`: a start, the steps up and down, and the end, each bar starting where the last one ended.",
        "schema": {
          "type": "string",
          "enum": [
            "waterfall",
            "percent",
            "grouped",
            "stacked"
          ]
        }
      },
      {
        "name": "total",
        "type": "React.ReactNode",
        "required": false,
        "origin": "own",
        "description": "The headline figure, in `metric-medium` (\"€ 184,2k\")."
      },
      {
        "name": "data",
        "type": "readonly T[]",
        "required": false,
        "origin": "own",
        "schema": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "string",
                "number",
                "boolean",
                "null"
              ]
            }
          }
        }
      },
      {
        "name": "index",
        "type": "keyof T & string",
        "required": false,
        "origin": "own",
        "description": "The x key: the period or category of each row.",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "categories",
        "type": "readonly (keyof T & string)[]",
        "required": false,
        "origin": "own",
        "description": "The series keys, in order; the first is the product's own figure (`ds-chart-1`).",
        "schema": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      {
        "name": "labels",
        "type": "Readonly<Partial<Record<string, string>>>",
        "required": false,
        "origin": "own",
        "description": "Series names by key (\"web\" → \"Website\"); the key by default."
      },
      {
        "name": "indexFormatter",
        "type": "(value: unknown) => string",
        "required": false,
        "origin": "own",
        "description": "The index label in the tooltip and the table (\"August 2026\")."
      },
      {
        "name": "indexLabel",
        "type": "string",
        "required": false,
        "origin": "own",
        "description": "The index column's header in the data table; \"Period\" for time charts, \"Category\" for BarChart.",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "allowDecimals",
        "type": "boolean",
        "required": false,
        "origin": "own",
        "description": "`false` for whole counts (orders, new customers): the value axis steps by whole numbers, so a small count\nreads 0 / 1 / 2 / 3, never 0.7 / 1.4 / 2.1. Fractional steps by default. Percent bars keep their\n0–100% steps.",
        "schema": {
          "type": "boolean"
        }
      },
      {
        "name": "layout",
        "type": "\"horizontal\" | \"vertical\"",
        "required": false,
        "origin": "own",
        "description": "`horizontal` for long category names, ranked; `vertical` columns by default.",
        "schema": {
          "type": "string",
          "enum": [
            "horizontal",
            "vertical"
          ]
        }
      },
      {
        "name": "comparison",
        "type": "keyof T & string",
        "required": false,
        "origin": "own",
        "description": "A comparison series (last year): `ds-chart-neutral`.",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "sortBy",
        "type": "\"none\" | \"value\"",
        "required": false,
        "origin": "own",
        "description": "Horizontal bars are sorted by their total unless the categories have a natural order (`none`).",
        "schema": {
          "type": "string",
          "enum": [
            "none",
            "value"
          ]
        }
      },
      {
        "name": "referenceLines",
        "type": "readonly ChartReferenceLine[]",
        "required": false,
        "origin": "own",
        "description": "An average or target line.",
        "schema": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "value": {
                "type": "number"
              },
              "label": {
                "type": "string"
              }
            },
            "required": [
              "value",
              "label"
            ]
          }
        }
      }
    ]
  },
  "tokens": [
    "ds-background-brand-subtle",
    "ds-background-neutral",
    "ds-background-neutral-pressed",
    "ds-background-selected-hovered",
    "ds-background-selected-pressed",
    "ds-border",
    "ds-border-bold",
    "ds-border-focused",
    "ds-chart-1",
    "ds-chart-2",
    "ds-chart-3",
    "ds-chart-4",
    "ds-chart-5",
    "ds-chart-neutral",
    "ds-icon-danger",
    "ds-icon-success",
    "ds-icon-warning",
    "ds-link",
    "ds-radius-medium",
    "ds-radius-small",
    "ds-radius-xsmall",
    "ds-shadow-overlay",
    "ds-space-050",
    "ds-space-075",
    "ds-space-100",
    "ds-space-150",
    "ds-space-200",
    "ds-space-300",
    "ds-space-400",
    "ds-surface-overlay",
    "ds-surface-raised",
    "ds-text",
    "ds-text-danger",
    "ds-text-subtle",
    "ds-text-subtlest",
    "ds-text-success"
  ],
  "strings": [
    "chartBand",
    "chartCategory",
    "chartChange",
    "chartConversion",
    "chartDecrease",
    "chartIncrease",
    "chartNoData",
    "chartNoValue",
    "chartOther",
    "chartPeriod",
    "chartShare",
    "chartStatus",
    "chartTotal",
    "chartTrend",
    "chartValue",
    "gaugeTarget",
    "heatmapLess",
    "heatmapMore",
    "hideDataTable",
    "selection",
    "showAll",
    "showDataTable",
    "showFewer",
    "sparklineSummary"
  ],
  "quality": {
    "tests": true,
    "a11y": false,
    "docs": false,
    "visual": false,
    "dark": false,
    "rtl": false,
    "mcp": true,
    "generic": true
  }
}
