我正在制作一个NVD3线状图,如果我可以为每个数据点显示标记,而不仅仅是线条本身,那么它将显着提高清晰度。不幸的是,我还没能找到一种简单的方法来用NVD3来做这件事。我也考虑过使用散点图,但我不知道如何显示这些点之间的连接线。我考虑的第三个选择是叠加一条线和散点图,但这将在图例中显示每个系列两次,并可能导致其他不必要的视觉复杂性。
有没有办法优雅地做到这一点呢?下面列出了我的格式化技术的示例代码,但是test_data中的'size‘和'shape’属性对当前代码的线条图没有影响。
test_data = [ { key: 'series1',
values: [
{ x: 1, y: 2.33, size:5, shape:"circle" },
{ x: 2, y: 2.34, size:5, shape:"circle" },
{ x: 3, y: 2.03, size:5, shape:"circle" },
] } ];
nv.addGraph(function() {
var test_chart = nv.models.lineChart();
test_chart.xAxis.axisLabel('Sample Number');
test_chart.yAxis
.axisLabel('Voltage (V)')
.tickFormat(d3.format('.02f'));
d3.select('#test_plot')
.datum(test_data)
.transition().duration(500)
.call(test_chart);
nv.utils.windowResize(test_chart.update);
return test_chart;
});
https://stackoverflow.com/questions/13732971
复制相似问题