目前我正在尋找D3示例試圖改變它來添加工具提示https://plnkr.co/edit/stHnntCknDUs0Xw6MlQ2?p=preview,但不能自己管理它。如何添加D3工具提示
我想提示和指針添加到此的方式就像是在這裏完成http://c3js.org/samples/timeseries.html
//Add tooltips
// Define the div for the tooltip
var div = d3.select("body").append("div")
.attr("class", "tooltip")
.style("opacity", 0);
// Add the scatterplot
countryEnter.selectAll("dot")
.data(data)
.enter().append("circle")
.attr("r", 5)
.attr("cx", function(d) { return x(d.date); })
.attr("cy", function(d) { return y(d.stat); })
.on("mouseover", function(d) {
div.transition()
.duration(200)
.style("opacity", .9);
div .html(formatTime(d.date) + "<br/>" + d.date)
.style("left", (d3.event.pageX) + "px")
.style("top", (d3.event.pageY - 28) + "px");
})
.on("mouseout", function(d) {
div.transition()
.duration(500)
.style("opacity", 0);
});
只是不能得到它的工作
沒有我的回答解決你的問題? – thatOneGuy