Add Scale and Domain Prop for Line Chart X-Axis
Love the library!
In my use case I'm looking to be able to leverage tremor for some time series data which requires setting the scale prop on the XAxis to equal "time".
I think this could be done rather straightforwardly by extending the BaseChartProps and/or creating a new LineChartProps interface that includes both a scale and a domain prop. If needed it could be xDomain and yDomain as ReCharts allows for both.
ex:
<LineChart
autoMinValue
categories={['x']}
data={chartData}
dataKey="y"
height="h-80"
marginTop="mt-8"
scale={'time'}
showLegend
xDomain={['auto', 'auto']}
yAxisWidth="w-12"
/>
If you'd like I'd be happy to put up a PR for it
Edit*: Looks like the yDomain is handled under the hood so perhaps we could do something similar
hey @bquay, thanks a lot for the comment! We are planning to migrate to another chart library in the near future, therefore we are a bit careful with implementing re-charts specific props. We will consider it though for our next minor release!
Oh interesting! Which library if you don't mind me asking?
Sure, we are thinking of visx, but haven't made a final decision yet :) definitely open for recommendations!
hey @bquay, sorry for taking so long to come back to this again. Is there a reason why you prefer not to use a callback in the valueFormatter prop to format your time series data? 🙂
E.g.
<AreaChart
...
valueFormatter={(value) => String(new Date(value))}
>
@mitrotasios What are your main pain points with recharts? Would be great if you could communicate them as issues. We would be happy to take those into considerations for upcoming feature work.
Bumping this, is there any workaround to set the scale in the current state?