Skip to content
ChartslibraryUI Get Pro

Troubleshooting

The chart is unstyled: black text, no grid, oversized legend

charts.css isn't imported. Add import "@/components/charts/core/charts.css" once, in your root layout or entry file.

Nothing renders, or there's a blank space the size of the chart

Charts measure their container width. If the parent has no width (for example an unconstrained flex child), give it one: min-width: 0 on flex children, or an explicit width. You can also pass width={600} to fix it.

"This chart can't be drawn"

The data failed validation, and the message says which key and which values. Common causes:

  • Numbers arriving as strings from an API or CSV ("1200"). Convert with Number() before charting.
  • A typo in a key (x="Month" vs month).
  • Negative values in a part-of-whole chart.

Dates are off by one day

You're probably parsing dates yourself with new Date("2026-03-01") and formatting in local time. Pass the ISO string with xType="time"; charts read date-only strings as UTC.

Colours don't switch in dark mode

The charts look for .dark or [data-theme="dark"] on an ancestor. If your theme switcher uses another class, add a rule that sets the dark tokens for it, or pass mode="dark".

Hydration warnings in Next.js

Charts render a sized placeholder on the server and draw after measuring in the browser, so they don't cause hydration mismatches themselves. If you compute data with Math.random() or Date.now() during render, move that into an effect or onto the server.

The x-axis skips labels

Labels are thinned so they never overlap. Every value is still in the tooltip and table. For fewer, wider labels, shorten them ("Jan" rather than "January 2026") or give the chart more width.

TypeScript can't find @/components/...

Your project uses a different path alias. Change the import, or install with --dir to match your structure. The charts import each other with relative paths.

Can I use this without TypeScript?

Yes. Strip the types with any TS-to-JS tool, or let your bundler compile .tsx. Most React setups (Next.js, Vite) handle .tsx out of the box.