Recharts is reliable, but a handful of setup mistakes cause most "my chart is blank" moments. Work through this guide in order — the earlier causes are by far the most common.
1. The chart has zero height
Symptom: nothing appears, no errors in the console, and inspecting the page shows an SVG with a height of 0.
Cause: ResponsiveContainer (or shadcn's ChartContainer) sizes itself from its parent. A percentage height on a parent without a height resolves to zero.
Fix: give the container a fixed height or an aspect ratio, or give the parent an explicit CSS height.
<ResponsiveContainer width="100%" height={300}>
<LineChart data={data}>{/* ... */}</LineChart>
</ResponsiveContainer>
2. Axes render but no line or bars
Cause: the dataKey does not match a property in your data, or the values are strings instead of numbers.
Fix: check spelling and casing ("Sales" is not "sales") and convert API values with Number() before passing them to the chart.
const clean = apiRows.map((r) => ({ ...r, sales: Number(r.sales) }));
3. Children are ignored after installing
Cause: the react-is package is missing or its version does not match React. The Recharts README states that react-is must match your installed React version.
Fix: run npm ls react react-is, then install a matching version. See the npm installation guide.
4. Errors in Next.js
Cause: Recharts components use browser APIs and React hooks, so they must run in client components.
Fix: in the App Router, add "use client" at the top of the file that renders the chart, and import that component from your page.
5. The tooltip never shows
- Make sure
<Tooltip />is a direct child of the chart container. - If you use a custom tooltip, return
nullonly whenactiveis false — not when payload values are zero. - Check that no overlay element with a higher
z-indexis capturing mouse events above the chart.
6. Things broke after upgrading to Recharts 3
Cause: Recharts 3 rewrote internal state management and includes breaking changes. One example from the release notes: CategoricalChartState is no longer available in event handlers or Customized.
Fix: follow the official 3.0 migration guide in the project wiki on GitHub, upgrade in a branch and check each chart. Our GitHub guide explains where to find release notes.
7. Labels overlap or get cut off
Increase the chart's margin, set a width on YAxis for long numbers, use tickFormatter to shorten values, or rotate x-axis labels with the angle prop. The responsive charts guide has more mobile tips.
8. Building the source ZIP fails
If you downloaded the GitHub archive from our download section, remember it is the raw main branch source. Use a current Node.js LTS release, run npm install inside the extracted folder and use npm run to list the scripts the project currently defines. For app development, installing from npm is simpler.
Debugging checklist
- Does the container have a real height?
- Do all
dataKeyvalues exist, with numeric values? - Do
reactandreact-isversions match? - Is the chart in a client component (Next.js)?
- Did a major-version upgrade introduce breaking changes?
When asking for help on GitHub, include a minimal reproduction and the exact versions of recharts, react and react-is.
Start by classifying the failure
A blank chart can indicate several distinct problems, and the fastest repair begins by identifying which category applies. The component may not mount at all, its container may have no measurable size, its data may be missing or its series may reference properties that do not exist. Sometimes the chart renders correctly but appears blank because the chosen stroke blends into the background or the domain excludes expected values. These are different failures, and each calls for a different test.
Open the browser console and inspect the element representing the chart. Verify whether an SVG has been produced, whether its width and height are sensible and whether the expected graphical marks appear inside it. If the container measures zero, inspect the layout first. If axes appear but the series does not, inspect the data keys and numeric values. This simple distinction can prevent an hour of dependency changes prompted by a problem that is fundamentally CSS or data preparation.
Reduce the example until it works
Remove custom tooltips, specialised ticks, animation and remote loading, leaving a minimal chart with two or three hard-coded observations. Give it an explicit width and height while investigating. If this displays correctly, the library is probably capable of rendering in that environment, and the cause lies in a removed layer of complexity. Add features back individually, checking the visual after each step. A disciplined reduction is more informative than editing several suspects simultaneously.
Keep the sample dataset realistic enough to exercise the intended field names but small enough to inspect manually. Confirm that values are numbers, not strings containing punctuation or currency symbols. Check that date labels are ordered correctly and that null means missing data rather than zero. If one component unexpectedly receives empty props, follow the application’s state flow to find where the values change. The smallest reproduction should reveal the earliest point at which the intended behaviour diverges.
Investigate container geometry carefully
ResponsiveContainer can only adapt to space supplied by its surrounding element. If its parent has a percentage height that resolves to zero, the resulting chart may have no visible area. A flex or grid item may also require a minimum-width adjustment before it can shrink inside a narrow card. Examine computed dimensions rather than guessing from the stylesheet. A border around the parent is often a useful temporary diagnostic because it makes the size constraint visible.
When a chart sits inside a hidden tab or panel, the measurement may occur while the element has no visible dimensions. Test the chart once the panel is open and review whether the surrounding component updates its layout appropriately. Avoid attaching repeated resize handlers without understanding the underlying issue. Better structure and deliberate parent dimensions usually resolve more problems than ad hoc measurement code. Once the fix is confirmed, remove diagnostic borders and keep a test for the layout that originally failed.
Separate framework and package issues
If the chart fails only in a server-rendering framework, check the boundary between server and browser components. Some chart behaviour depends on browser capabilities and should execute within a client component. If failures begin after a dependency upgrade, inspect the installed versions and relevant migration instructions. Do not assume that every new warning is a Recharts defect; framework, React and utility-package changes can expose different compatibility expectations.
For installation-related symptoms, record the exact command output and compare it with the package requirements for the version in use. For rendering-related symptoms, prioritise the component tree, data model and browser console. These investigations may overlap, but they should not be collapsed into a single vague diagnosis. Make one change at a time, keep a known-good version available and note the first change that restores the chart. That evidence makes any subsequent bug report far more useful.
Prevent recurring chart regressions
After repairing a chart, encode the lesson in a test or a shared component convention. If the issue was a missing container height, establish a standard chart-card layout with predictable dimensions. If it was a mismatched data key, use type information and a clear transformation function where practical. If a tooltip obscured important data on mobile, include a narrow-viewport check in the review process. The aim is to stop the same class of defect from recurring in another dashboard.
Operational charts also deserve empty-state and loading-state design. A blank rectangle should not make users wonder whether the system has failed or whether no measurements exist. Provide concise explanatory language for unavailable data and use simple visual fallbacks when an error occurs. Good troubleshooting leaves the product stronger than it was before the defect: the cause is understood, the correction is reproducible and the interface continues to communicate honestly when its data or environment becomes imperfect.
Conclusion
When a Recharts visual fails, classify the symptom before changing code. Verify dimensions, inspect data, reduce the example and separate framework behaviour from package compatibility. Preserve the working fix in tests or shared conventions. The result should be more than a visible chart: it should be a robust interface that explains empty, loading and error states responsibly.

