nvd3散点图中不可见气泡

Invisible bubbles in nvd3 scatter chart

本文关键字:气泡 散点图 nvd3      更新时间:2023-09-26

我有这个散点图和一个样本数据。出于某种原因,我看到了看不见/没有显示的气泡。Y轴(在6)和更多的点。是我做错了什么还是有bug ?

nv.addGraph(function () {
var chart = nv.models.scatterChart()
    .showDistX(true) //showDist, when true, will display those little distribution lines on the axis.
.showDistY(true)
    .transitionDuration(350)
    .color(['#1f77b4'])
    .margin({
    left: 150,
    right: 150
})
    .showLegend(false)
    .sizeRange([50, 5000])
    .interactive(true);
//Configure how the tooltip looks.
chart.tooltipContent(function (key) {
    return '<center><b>Value</b><br><h3>' + key + '</h3></center>';
});

chart.forceY(0)
//Axis settings
chart.xAxis.tickFormat(function (d) {
    return d3.time.format('%b %d')(new Date(d));
});
chart.yAxis.tickFormat(function (d) {
    return d;
});
//We want to show shapes other than circles.
chart.scatter.onlyCircles(true);
d3.select('#categories-viewed-scatterchart svg')
    .datum(data)
    .call(chart);
nv.utils.windowResize(chart.update);
return chart;
});

Jsfiddle: http://jsfiddle.net/eyedagger/4Dm9D/

原来我存储数据的方式是问题所在。我对每个数据集都有一个键,我应该对一组数据集有唯一的键。

看起来如果密钥重复,问题就出现了