@corvaui/charts
v0.2.1
Published
Framework-neutral data, scale, geometry, and accessibility primitives for CorvaUI charts.
Readme
@corvaui/charts
Framework-neutral data normalization, scales, geometry, accessibility metadata, and export helpers for CorvaUI visualizations.
Supported production 2D families are bar, line, area, scatter, bubble, pie, donut, sparkline, histogram, boxplot, radar, and gauge. Histogram input is raw numeric observations; box plots use repeated long-form category rows; radar and gauge charts can use an explicit numeric domain.
import { createChartModel, createCartesianGeometry } from "@corvaui/charts";
const model = createChartModel(
[
{ month: "Jan", revenue: 42, target: 38 },
{ month: "Feb", revenue: 51, target: 45 }
],
{
type: "line",
xKey: "month",
series: [
{ key: "revenue", label: "Revenue" },
{ key: "target", label: "Target" }
]
}
);
const geometry = createCartesianGeometry(model, { width: 720, height: 360 });Statistical and radial families use their matching geometry helpers:
import {
createBoxPlotGeometry,
createChartModel,
createGaugeGeometry,
createHistogramGeometry,
createRadarGeometry
} from "@corvaui/charts";
const histogram = createChartModel(observations, {
bins: 12,
series: [{ key: "latency" }],
type: "histogram",
xKey: "observationId"
});
const histogramGeometry = createHistogramGeometry(histogram, { width: 720, height: 360 });createBoxPlotGeometry, createRadarGeometry, and createGaugeGeometry accept the same normalized model and dimensions contract. Selection adapters can use the exported ChartSelectionContext discriminated union for histogram ranges, box-plot summaries, radar axes, and gauge ratios.
createChartViewRange, zoomChartViewRange, panChartViewRange, and normalizeChartViewRange provide renderer-neutral record-window behavior. chartToCsv, chartSvgToString, and chartSvgToPng support data and image export; SVG/PNG helpers inline computed token colors from the active theme before encoding.
The package does not render UI. Use @corvaui/react or @corvaui/web-components for token-themed, interactive chart components.
See SUPPORT.md for supported environments and the support policy.
