mirror of
https://github.com/bitbaum/chartkit.git
synced 2026-12-04 04:47:29 +01:00
ShareBars took {rows, caption, other} and always called the remainder
"Other", so an app that knew what its rest was ("Others, each below 5%")
could only say it in the caption. `otherLabel` names it in the legend and the
table; left out, it is still "Other".
ColumnChart draws figures by period: revenue and net income by fiscal year,
periods left to right in the order given (fiscal labels are not dates, so
nothing re-sorts them), several series side by side, a loss below the zero
line, a missing figure as no column and "—" in the table, each column
focusable with its value and a link to its source. The ranked BarChart could
not do this: it re-orders rows by size, so a year chart came out of order.
Release 0.2.0.
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
Co-authored-by: Claude <noreply@anthropic.com>
44 lines
1.7 KiB
TypeScript
44 lines
1.7 KiB
TypeScript
import { type XValue } from "../index.js";
|
|
export interface ColumnPoint {
|
|
/** The period: "2025", "2025-Q2", "FY2025". Drawn left to right in the order given. */
|
|
x: XValue;
|
|
/** `null` when the source gives no figure for the period: no column, "—" in the table. */
|
|
y: number | null;
|
|
/** Where the figure was read: the column is a link to it. */
|
|
href?: string;
|
|
note?: string;
|
|
}
|
|
export interface ColumnSeries {
|
|
id: string;
|
|
label: string;
|
|
points: ColumnPoint[];
|
|
}
|
|
export interface ColumnChartProps {
|
|
/** One series, or a few side by side per period. Same unit, one axis. */
|
|
series: ColumnSeries[];
|
|
/** "USD", "EUR m": shown with every value. */
|
|
unit?: string;
|
|
caption: string;
|
|
/** Plot height in CSS px. The width is the container's. */
|
|
height?: number;
|
|
}
|
|
/**
|
|
* A value axis that always holds zero, on round steps, below zero as well as
|
|
* above: a loss is a column that goes down, not a short column going up.
|
|
*/
|
|
export declare function columnScale(values: readonly number[], tickCount?: number): {
|
|
min: number;
|
|
max: number;
|
|
ticks: number[];
|
|
};
|
|
/**
|
|
* Columns by period: revenue by year, a loss below the zero line. Periods
|
|
* read left to right in the order the caller gives (fiscal labels such as
|
|
* "FY2025" are not dates, so nothing re-sorts them), and several series sit
|
|
* side by side in each period, each after the first told apart by its tone.
|
|
* Every column with a figure is focusable, with its value, period and note
|
|
* on hover and focus; a link when it has a source. The table carries every
|
|
* figure, a missing one as "—".
|
|
*/
|
|
export declare function ColumnChart({ series, unit, caption, height }: ColumnChartProps): import("react").JSX.Element;
|
|
//# sourceMappingURL=Columns.d.ts.map
|