【发布时间】:2017-11-26 23:07:17
【问题描述】:
我使用this 参考创建了一个散点图。该代码在 v3 中运行良好,但在将其更改为 v4 后,工具提示、x 轴和 y 轴不显示。
我创建了一个Plunker。如果有人能告诉我它有什么问题,我将不胜感激。
function showTooltip (d, i) {
//Save the chosen circle (so not the voronoi)
var element = d3.selectAll(".countries."+d.CountryCode);
//Define and show the tooltip
$(element).popover({
placement: 'auto top',
container: '#chart',
trigger: 'manual',
html : true,
content: function() {
return "<span style='font-size: 12px; text-align: center;'>" + "<span>" + "Speaker: " + "</span>" + d.Speaker + "\n"
+ "<span>" + "Duration: " + "</span>" + Math.round(d.Duration) + "\n" +"</span>"; }
});
$(element).popover('show');
//Make chosen circle more visible
element.style("opacity", 1)
.style("stroke-width", 6);
更新:
This 是 v4 d3 中此散点图的更正版本。我在 Lary 的帮助下更正了它。
【问题讨论】:
标签: javascript d3.js visualization data-visualization