React - Rechart - 如何填充组合图中区域的底部(Rechart.js)?
React - Rechart - How to fill bottom part of Area in Composed Chart (Rechart.js)?
这是我试过的代码:
<ResponsiveContainer width="100%" height={500}>
<ComposedChart
// width={500}
// height={400}
data={data}
margin={{
top: 20,
right: 20,
bottom: 20,
left: 20,
}}>
<CartesianGrid stroke="#f5f5f5" />
<XAxis axisLine={false} tickLine={false} dataKey="name" />
<YAxis
tick={{fill: '#4a4a4a', fontFamily: 'Roboto'}}
type="number"
domain={['dataMin', 'dataMax']}
yAxisId="left"
tickLine={false}
axisLine={false}
/>
<YAxis
tick={{fill: '#4a4a4a'}}
unit="x"
type="number"
domain={['dataMin', 'dataMax']}
yAxisId="right"
orientation="right"
tickCount={10}
tickLine={false}
axisLine={false}
/>
<Tooltip />
<Legend verticalAlign="top" align="right" height={40} />
<Area yAxisId="left" type="linear" dataKey="amt" fill="#8884d8" stroke="#8884d8" />
<Area yAxisId="left" type="linear" dataKey="pv" fill="#413ea0" stroke="#413ea0" />
<Line yAxisId="right" dot={false} type="linear" dataKey="uv" stroke="#ff7300" />
{/* <Scatter dataKey="cnt" fill="red" /> */}
</ComposedChart>
</ResponsiveContainer>
Here is what i get
问题是如何填充图表的底部?
它应该填充 y 轴上 0 以下的所有内容。
区域应该一直到底部
这是我试过的代码:
<ResponsiveContainer width="100%" height={500}>
<ComposedChart
// width={500}
// height={400}
data={data}
margin={{
top: 20,
right: 20,
bottom: 20,
left: 20,
}}>
<CartesianGrid stroke="#f5f5f5" />
<XAxis axisLine={false} tickLine={false} dataKey="name" />
<YAxis
tick={{fill: '#4a4a4a', fontFamily: 'Roboto'}}
type="number"
domain={['dataMin', 'dataMax']}
yAxisId="left"
tickLine={false}
axisLine={false}
/>
<YAxis
tick={{fill: '#4a4a4a'}}
unit="x"
type="number"
domain={['dataMin', 'dataMax']}
yAxisId="right"
orientation="right"
tickCount={10}
tickLine={false}
axisLine={false}
/>
<Tooltip />
<Legend verticalAlign="top" align="right" height={40} />
<Area yAxisId="left" type="linear" dataKey="amt" fill="#8884d8" stroke="#8884d8" />
<Area yAxisId="left" type="linear" dataKey="pv" fill="#413ea0" stroke="#413ea0" />
<Line yAxisId="right" dot={false} type="linear" dataKey="uv" stroke="#ff7300" />
{/* <Scatter dataKey="cnt" fill="red" /> */}
</ComposedChart>
</ResponsiveContainer>
Here is what i get
问题是如何填充图表的底部? 它应该填充 y 轴上 0 以下的所有内容。 区域应该一直到底部