nvd3格式不适用于reactjs
我正在将nvd3格式不适用于reactjs,reactjs,d3.js,nvd3.js,Reactjs,D3.js,Nvd3.js,我正在将react版本15.6.2与react-nvd3:^0.5.7 我已经创建了一个多条形图。 我想将Y轴的tickformat更改为全整数。它是以浮点值的形式出现的。请参见所附图片。 我希望数字是完整的数字,而不是浮点数 我使用了tickFormat={d3.format('d')这段代码来更改tick格式。但是我还不能这样做 我的代码如下: <NVD3Chart id="barChart" type="multiBarChart"
react
版本15.6.2
与react-nvd3:^0.5.7
我已经创建了一个多条形图
。
我想将Y轴的tickformat
更改为全整数。它是以浮点值的形式出现的。请参见所附图片。
我希望数字是完整的数字,而不是浮点数
我使用了tickFormat={d3.format('d')
这段代码来更改tick格式。但是我还不能这样做
我的代码如下:
<NVD3Chart
id="barChart"
type="multiBarChart"
width={document.body.clientWidth-(document.body.clientWidth*0.13)}
height={400}
showLabel={false}
stacked={true}
showControls={true}
showLegend={true}
datum={this.state.activityOptions}
color={['#3fceb1','#fff480']}
x="label"
y="values"
reduceXTicks={false}
tickFormat={d3.format('d')}/>
有人能帮忙吗
您应该这样设置勾号格式:
<NVD3Chart
id="barChart"
type="multiBarChart"
width={document.body.clientWidth-(document.body.clientWidth*0.13)}
height={400}
showLabel={false}
stacked={true}
showControls={true}
showLegend={true}
datum={this.state.activityOptions}
color={['#3fceb1','#fff480']}
x="label"
y="values"
reduceXTicks={false}
yAxis={{
tickFormat: d3.format('d') // <== !!!
}}
>
有效。我缺少正确的格式。非常感谢@Mikhail Shabrikov