D3 y-axis percent display

后端 未结 1 1546
滥情空心
滥情空心 2021-01-24 20:27

D3 Fiddle

/**
* A bar chart. Required data format:
* [ { name : x-axis-bar-label, value : N }, ...]
*
*  Sample use:
*  var bargraph = d3.select(\'#bargraph\')         


        
相关标签:
1条回答
  • 2021-01-24 21:08

    Do this to append % to the y tick:

    var yAxis = d3.svg.axis()
      .scale(chart.y)
      .orient('left')
      .ticks(5)
    
      .tickFormat(function(d){return d+ "%"});
    

    working code here

    0 讨论(0)
提交回复
热议问题