gpt4 book ai didi

charts - nvd3 条之间的空间

转载 作者:行者123 更新时间:2023-12-02 05:41:45 24 4
gpt4 key购买 nike

我用 NVD3 制作了一个 MultiBarChart。然而,一位同事说,这确实有效,我需要澳大利亚每个州之间有更多的空间。所以,塔斯马尼亚距离维多利亚等地更远。

Here is the data visualisation

我找不到用非开发人员语言解释此问题的论坛。我不是开发人员,但我想尝试一下。

这是我的代码...

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: 105, bottom: 30, left: 103})
.tooltips(true)
.showControls(false);

chart.yAxis
.tickFormat(d3.format(',.1f'));

d3.select('#chart1 svg')
.datum(long_short_data)
.transition().duration(1400)
.call(chart);

nv.utils.windowResize(chart.update);

chart.dispatch.on('stateChange', function(e) { nv.log('New State:', JSON.stringify(e)); });

return chart;
});

谢谢你们 super 善良和聪明的人们!

最佳答案

不需要使用太多的代码来设置间距,只需使用下面的代码:

 var chart = nv.models.multiBarChart();
//added by santoshk for fix the width issue of the chart
chart.groupSpacing(0.8);//you can any value instead of 0.8

关于charts - nvd3 条之间的空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21215084/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com