我使用离散条形图(NVD3库)在我的网站中显示图表.虽然显示图表一切都很好,但我的问题是如何将十进制值更改为整数.在y轴上显示的值显示整数值.虽然我用哪个数组显示具有整数值的值.我使用的js代码如下
nv.addGraph(function() {
var chart = nv.models.discreteBarChart()
.x(function(d) { return d.label })
.y(function(d) { return d.value })
.staggerLabels(true)
.tooltips(false)
.showValues(true)
.transitionDuration(250);
chart.xAxis.axisLabel("<?php echo $configureGrid['x_axis']['legend']; ?>");
chart.yAxis.axisLabel("<?php echo $configureGrid['y_axis']['legend']; ?>");
d3.select('#issue_by_time svg')
.datum(historicalBarChart)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
});
Run Code Online (Sandbox Code Playgroud) 我通过crontab -e命令在终端中打开文件,现在我想保存它。我尝试了几种方法,例如:wq或Ctrl-X,但它没有保存文件。我怎样才能做到这一点?