Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to make a pie chart in D3.js with some interactions, like 'mouseover' showing tooltips and transition when loading. Here is my current code:

const graph = select(this.refs.pieChart);

graph
  .append("svg")
  .attr("width", width)
  .attr("height", height)
  .classed("PieChartGraphContainerSvg", true);

graph
  .select("svg")
  .append("g")
  .attr("width", width)
  .attr("height", height)
  .attr("transform", `translate(${width / 2},${height/2})`);

let pie = d3.pie().value(d => d.value).sort(null)

let arc = d3.arc().outerRadius(radius)
.innerRadius(0);

let path = graph.select('svg').select('g').datum(chartData).selectAll('path')
    .data(pie)
    .enter().append('path')
    .attr("fill", d => {
        return color(d.data.key)})
    .attr("d",arc)
    .each(d => this._current = d)


    

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
279 views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...