API reference

API overview

Everything Chartlyx exports, verified against the source. Components, hooks, helpers, constants, and types, each with prop signatures and defaults straight from the code.

Imports & version

Chartlyx ships as a single package with a flat export surface: everything lives at the top level, no sub-paths required.

import {
  // Cartesian
  ChartContainer,
  Line,
  Area,
  Bar,
  Scatter,
  StackedBar,
  StackedArea,
  XAxis,
  YAxis,
  CartesianGrid,
  LinearGradient,
  Tooltip,
  Legend,

  // Polar
  PolarChartContainer,
  Pie,
  Radar,
  RadarGrid,
  RadarAxes,
  PolarTooltip,

  // Hooks
  useChartContext,
  usePolarChartContext,

  // Helpers
  stackSum,
  pickColor,
  DEFAULT_STACK_COLORS,
  DEFAULT_MARGIN,
  VERSION,
} from "chartlyx";

import type {
  ChartContainerProps,
  ChartContextValue,
  PolarChartContainerProps,
  PolarChartContextValue,
  LineProps,
  AreaProps,
  BarProps,
  ScatterProps,
  StackedBarProps,
  StackedAreaProps,
  PieProps,
  RadarProps,
  RadarGridProps,
  RadarAxesProps,
  AxisProps,
  CartesianGridProps,
  TooltipProps,
  TooltipState,
  TooltipRender,
  LegendProps,
  LegendItem,
  LinearGradientProps,
  PieLabelRender,
  PieLabelRenderProps,
  PolarTooltipProps,
  PolarTooltipRender,
  PolarTooltipState,
  ShapeLabelRender,
  ShapeLabelRenderProps,
  TickValue,
  TickFormatter,
  CurveType,
  ScaleType,
  ScaleInput,
  Margin,
  KeysOfType,
} from "chartlyx";

The current package version is exposed as a runtime constant if you need to display it in your app:

import { VERSION } from "chartlyx";
console.log(VERSION); // "1.0.0"

Quick reference

Every symbol Chartlyx exports at a glance. Click any name to jump to its detailed reference.

Name Kind Summary
ChartContainer Component Cartesian root: measures size, builds scales, provides context.
PolarChartContainer Component Polar root for pie, donut, and radar charts.
Line Component SVG path connecting data points with a chosen curve.
Area Component Filled polygon between a line and the plot bottom.
Bar Component Rectangular bars on a band x-scale.
Scatter Component One circle per data point.
StackedBar Component Multi-series stacked bar chart with rounded top segment.
StackedArea Component Multi-series stacked area chart with curve support.
XAxis Component Bottom axis line, ticks, labels.
YAxis Component Left axis line, ticks, labels with rotated title.
CartesianGrid Component Horizontal and/or vertical grid lines behind the plot.
LinearGradient Component Convenience wrapper for SVG defs gradients.
Tooltip Component Nearest-point hover tooltip for Cartesian charts.
Legend Component Standalone SVG legend with color chips.
Pie Component Pie or donut slices from a valueKey.
Radar Component Closed polygon connecting values across N axes.
RadarGrid Component Concentric background rings for radar charts.
RadarAxes Component Spokes and labels for radar chart axes.
PolarTooltip Component Hover tooltip driven by polar container active state.
useChartContext Hook Read scales / accessors / dimensions inside custom Cartesian components.
usePolarChartContext Hook Read cx / cy / radius / active slice inside custom polar components.
stackSum Helper Max accumulated total across rows for a given key set.
pickColor Helper Cycles through a color array by index; wraps safely.
DEFAULT_STACK_COLORS Constant 6-color default palette for stacks, pies, radars.
DEFAULT_MARGIN Constant Default Cartesian chart margin.
VERSION Constant Package version string.
KeysOfType Type Utility type: keys of T whose values match V.