EvHaus / react-pdf-charts

Allows SVG-based React charts to be rendered in react-pdf
MIT License
44 stars 3 forks source link

Rechart vertical BarChart not working #400

Closed BaaSidDev closed 3 weeks ago

BaaSidDev commented 3 weeks ago

Describe the bug

i want vertical barchart like this img

image

but displaying empty chart.. layout="vertical" not working what should i do??

image image

Reproduction

https://stackblitz.com/edit/react-pdf-charts-starter-5byukq?file=src%2FApp.tsx

Validations

EvHaus commented 3 weeks ago

@BaaSidDev Looks like this is is not a bug with react-pdf-charts but rather with your recharts code. Your chart configuration in the web version of recharts also doesn't render anything: https://stackblitz.com/edit/recharts-example-4nwyda?file=index.js

I think the issue is that your XAxis and YAxis values aren't specifying which data to use. If you change those to:

<XAxis dataKey="amt" type="number" />
<YAxis dataKey="name" type="category" />

then you'll get the result I think you want:

image

And it also works in react-pdf-charts:

image

jaemushim commented 3 weeks ago

this is my mistake..
Thank you very much.