我试着用6个变量值来优化图表。
有时,这些值中的一些是负值,并且图形不会显示它们。
我试着在Y标度上设置负值,但也不起作用。
图形上的线条本身将消失。
风速线具有正值,但也不可见。

我的代码:
<div className="row">
<div className="col-md-12">
<ComposedChart width={1100} height={800} data={this.state.data} stackOffset="sign">
<XAxis dataKey="Date" />
<YAxis />
<Tooltip />
<Legend />
<CartesianGrid strokeDasharray="3 3" />
<Area type='monotone' dataKey='Apress' fill='#726a64' stroke='#726a64' />
<Bar dataKey='Rain' barSize={20} fill='#000cff'>
<LabelList dataKey="Rain" position="top" />
</Bar>
<Bar dataKey='Snow' barSize={20} fill='#6387ff'>
<LabelList dataKey="Snow" position="top" />
</Bar>
<Line type='monotone' dataKey='Temp' stroke='#ff0000' />
<Line type='monotone' dataKey='WindSpeed' stroke='#00ff1a' />
</ComposedChart>
</div>
</div>
</div>发布于 2018-03-01 21:37:14
向BarChart添加道具stackOffset=“sign”。
默认值是none,这就是为什么你得不到负值的原因。
https://stackoverflow.com/questions/49050643
复制相似问题