我想显示最近的N点,但是当将域设置为小于chartData.length的任何值时,图表会向左溢出。
我看到我可以通过将margin={{left:59}}添加到来将所有内容向左移动,但这似乎有点不客气。有没有更好的方法可以隐藏这条溢出线?
/*
* NOTE: the axis `domain` requires a _function_ if you want to display less than the total number of
* data points (see: https://stackoverflow.com/questions/53751564/can-i-set-the-recharts-axis-domain-max-lower-than-datamax)
*/
const pointsToDisplay = 8;
const xAxisStart = chartData.length - pointsToDisplay;
return (
xAxisStart, 'dataMax']} />
);