import { BarChartOrientation, ChartReferenceLine, ChartSeries } from "../types"; export type BarChartLayout = "single" | "grouped" | "stacked"; export type BarChartValueScale = "absolute" | "percent"; export type BarChartProps = { /** X 軸のカテゴリラベル(horizontal 時は Y 軸) */ categories: string[]; /** 1 本以上のデータ系列 */ series: ChartSeries[]; /** * - single: 系列 1 本(デフォルト) * - grouped: 系列を横並びで比較 * - stacked: 系列を積み上げて構成比を比較 */ layout?: BarChartLayout; /** * stacked 時の値スケール。percent はカテゴリごとに系列を 100% 積み上げ表示する。 * grouped / single では無視され absolute として描画する。 */ valueScale?: BarChartValueScale; /** vertical: 棒が上向き / horizontal: 棒が右向き。デフォルト vertical */ orientation?: BarChartOrientation; /** * theme.palette.chart.colorSchemes のキー。 * 未指定時は palette.chart.series(デフォルト)を使う。 */ colorScheme?: string; /** 軸・tooltip の数値表示。未指定時は absolute なら toLocaleString()、percent なら `12.3%` 形式 */ valueFormatter?: (value: number) => string; /** 系列が 2 本以上のとき凡例を表示。デフォルト true */ showLegend?: boolean; /** stacked 時に tooltip に合計を表示。デフォルト true */ showTotalInTooltip?: boolean; /** 凡例クリックで系列の表示/非表示を切り替え。デフォルト true */ interactiveLegend?: boolean; /** * 棒の太さ(カテゴリスロット幅に対する比率 0–1)。 * - single / stacked: 棒 1 本(または積み上げ全体)の幅。デフォルト 0.6 * - grouped: カテゴリ内グループ全体の幅(系列数で等分)。デフォルト 0.8 */ barWidthRatio?: number; /** 値軸上の水平(horizontal 時は垂直)参照線。スケール外は描画しない */ referenceLines?: ChartReferenceLine[]; /** true の間、チャートの代わりにローディング表示 */ loading?: boolean; /** 描画可能なデータがないときのメッセージ。未指定時は「データがありません」 */ emptyMessage?: string; "aria-label": string; height?: number; className?: string; };