Recharts - how to show multiple Y values at the same X

34 Views Asked by At

I am using Recharts (https://recharts.org/) for my charting purpose on a React Project. I have a dataset, to be charted as line chart where on the same "date" (i.e. X axis - Note: Date only, not date and time,) I can have multiple values (i.e Y axis) that must be all shown on the chart. How I envision this is that it will shown as a line along all the value points before moving on to the next day (next X value). There is a dataKey prop (https://recharts.org/en-US/api/Line#dataKey) in the Line component (https://recharts.org/en-US/api/Line) which can take a function but in my testing (https://codesandbox.io/p/sandbox/recharts-multi-data-using-accessor-function-sbzk1?from-embed=) it still requires the function to return a singular value.

0

There are 0 best solutions below