I have a Recharts LineChart with 14 data points (although in future this may vary, so ideally I'd like to not have to hardcode that). I want to show 2 tick values on the XAxis - the first and last.
So, I have:
<LineChart width={100} height={50} data={lineData}>
<Line type="monotone" dataKey="data" dot={false} />
<XAxis />
</LineChart>
where lineData is:
"lineData": [
{ "data": 43.0 },
{ "data": 44.5 },
{ "data": 45.0 },
{ "data": 41.0 },
{ "data": 35.0 },
{ "data": 32.0 },
{ "data": 24.0 },
{ "data": 18.0 },
{ "data": 21.0 },
{ "data": 26.0 },
{ "data": 32.0 },
{ "data": 46.0 },
{ "data": 44.0 },
{ "data": 42.0 }
]
I've tried various combinations of interval, tickCount and a ticks array, but nothing has worked - eg the code above gives "1 3 6 9 13".
How do I show only the first and final ticks on the XAxis? They can be hardcoded, so let's say I want "12:00" at the start and "16:00" at the end. How do I achieve that?