Javascript 散点图nvd3中的连接器线
我正在绘制nvd3散点图,我想把每个圆彼此连接起来,就像我们有带圆的折线图一样。 我的图表: 以下是我编写的代码:Javascript 散点图nvd3中的连接器线,javascript,d3.js,svg,charts,nvd3.js,Javascript,D3.js,Svg,Charts,Nvd3.js,我正在绘制nvd3散点图,我想把每个圆彼此连接起来,就像我们有带圆的折线图一样。 我的图表: 以下是我编写的代码: function scatterChartConfig(con, data, labels) { $(con).show().find('.spark-chart').show(); var div = '#' + $(con).find('.spark-chart').attr('id'); $(div).empty().data({
function scatterChartConfig(con, data, labels) {
$(con).show().find('.spark-chart').show();
var div = '#' + $(con).find('.spark-chart').attr('id');
$(div).empty().data({
'lineChart': false
});
$('#brush').hide();
nv.addGraph(function() {
$(div).height("68vh")
var height = $(div).height(),
width = height, // a square chart
chart = nv.models.scatterChart()
.interactive(true)
.tooltips(true)
.showDistX(true)
.showDistY(true)
.transitionDuration(350)
.tooltipContent(function(key, x, y, obj) {
console.log(obj);
return ' RPM (' + obj.point.size.toFixed(2) + ')';
});
//chart.xAxis.axisLabel(labels.x).tickFormat(d3.format('.02f'));
chart.yAxis.axisLabel(labels.y).axisLabelDistance(20).tickFormat(d3.format('.02f'));
//We do no want to show shapes other than circles.
chart.scatter.onlyCircles(true);
d3.select(div).append('svg')
.datum(data)
.attr('width', width)
.attr('height', height)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
}
我想用js来做这件事,或者我可以更新nvd3.js库,不需要css解决方案。您必须为此更改nvd3源代码。在普通D3中可能更好。我不是D3方面的专家。虽然我已经完全研究了nvd3库,并且了解它是如何工作的。。在库执行此操作之前,我正在寻找任何通用解决方案。您必须为此更改NVD3源代码。在普通D3中可能更好。我不是D3方面的专家。虽然我已经完全研究了nvd3库,并且了解它是如何工作的。。在库执行此操作之前,我正在寻找任何通用解决方案。