【发布时间】:2016-09-14 09:19:01
【问题描述】:
我在我的应用程序中使用 NVD3 图表。我不明白为什么 X 轴标签在我的图表中重叠。有人可以帮我解决吗?
我曾尝试使用.ticks(3) 设置滴答数,但似乎不会影响滴答数。
nv.addGraph(function () {
var chart = nv.models.lineChart()
.x(function (d) {
return d[0];
})
.y(function (d) {
return d[1];
})
.showXAxis(true)
.showYAxis(false)
.useInteractiveGuideline(true);
chart.xAxis //Chart x-axis settings
.axisLabel('Time')
.tickFormat(function (d) {
var dateTimeFormat = '%m/%d/%Y %H:%M';
d = new Date(d);
return d3.time.format(dateTimeFormat)(d);
});
chart.yAxis
.axisLabel('Size');
chart.forceY([0]);
d3.select('#id svg')
.datum(graphData)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
【问题讨论】:
标签: javascript jquery nvd3.js