1
如何使用nvd3将我的域设置为[0,400]?这里是我的代码:NVD3多栏水平图x轴域
var chart;
nv.addGraph(function() {
chart = nv.models.multiBarHorizontalChart().x(function(d) {
return d.label
}).y(function(d) {
return d.value
}).margin({
top : 30,
right : 20,
bottom : 50,
left : 175
}).barColor(d3.scale.category20().range()).transitionDuration(250).stacked(true)
chart.yAxis.tickFormat(d3.format(',.2f'));
d3.select('#chart1 svg').datum(long_short_data).call(chart);
nv.utils.windowResize(chart.update);
chart.dispatch.on('stateChange', function(e) {
nv.log('New State:', JSON.stringify(e));
});
return chart;
});
谢谢,我一直在尝试'xDomain',但我没有设置足够大的规模。然后我发现,X轴是垂直轴,而不是水平轴。我需要修改水平的一个。 – Pio
@Pio检查用'chart.forceX([0,400])更新的答案;'是否有效 – shabeer90