Skip to content
ChartslibraryUI Get Pro

Customization

The charts are source files in your repo, so customising one means editing it. Some common changes and where to make them:

I want to… Edit
Change brand colours or fonts CSS variables in core/charts.css (Theming)
Change how numbers look everywhere core/format.ts
Restyle the tooltip .clui-tooltip in charts.css; the markup is ChartTooltip in core/frame.tsx
Change bar thickness maxBarSize prop, or GAP and the band padding in core/bars.tsx
Remove the Table / CSV buttons toolbar={false}, or delete the toolbar in core/frame.tsx
Change the legend Legend in core/frame.tsx and .clui-legend in CSS
Use smoother lines curve="monotone" on line and area charts
Translate built-in words ("Forecast", "Total", "Partial") Search the chart file; they're plain strings near the top of each plot

Keep edits easy to merge

  • Prefer props and CSS variables over edits when they exist. They survive updates.
  • Make core edits deliberately. core/ is shared by every chart, so a change there affects all of them, which is usually what you want for formatting and theme.
  • Commit charts before updating with --overwrite, then review the diff and reapply your changes.

Tooltip content

Every tooltip is a TooltipData object: a title, rows of { label, value, color?, note?, strong? } and an optional footer. To add a field, find where the chart builds its tooltip (search for ChartTooltip) and add a row:

rows: [
  { label: "Revenue", value: formatValue(v, format, { context: "tooltip" }) },
  { label: "Margin", value: formatValue(margin[i], "percent") }, // added
],

Events

Charts don't expose click callbacks by default. Adding one is a two-line change in the chart file, for example on bars in core/bars.tsx:

<path … onClick={() => props.onBarClick?.(cats[i])} style={{ cursor: "pointer" }} />

Add onBarClick?: (category: string) => void to the props interface.