簡體   English   中英

國家MAP上的D3js工具提示不會發布

[英]D3js Tooltip on country MAP is not coming

工作之一: http : //jsfiddle.net/2emnt8m3/17/

http://ranjan720.github.io/時不起作用

源代碼: https : //github.com/ranjan720/ranjan720.github.io

我使用的地圖圖表:

var div = d3.select("body").append("div").attr("class", "tooltip").style("opacity", 0);

我使用的餅圖:

var tip = d3.tip()
            .attr('class', 'd3-tip')
            .html(function(d) {
            return d.data.population;
        })
        .direction('s')
    svg.call(tip);

    svg.selectAll(".arc")
        .data(function(d) {
            return pie(d.ages);
        })
        .enter().append("path")
        .attr("class", "arc")
        .attr("d", arc)
        .style("fill", function(d) {
            return color(d.data.name);
        })
        // SHOW/HIDE TOOLTIP
        .on('mouseover', tip.show)
        .on('mouseout', tip.hide);

    svg.append("text")
        .attr("dy", ".35em")
        .style("text-anchor", "middle")
        .text(function(d) {
            return d.State;
        });
var m = d3.map(datas, function(d) {
  if(d.Year == $("input[name=Year]:checked").val()){
    return d.STATEUTS.toUpperCase();
}}); 

var id = d3.select(this).attr('id');之前,將以上代碼行保留在mouseover回調中 這條線。

希望這對您有用...如果不要求更多。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM