Use d3 log scale instead of linear scale

后端 未结 2 1817
再見小時候
再見小時候 2021-02-12 23:40

I\'m trying to do a chart based on http://mbostock.github.com/d3/talk/20111116/bar-hierarchy.html, the only difference being that I\'d like to use a log scale for the x-axis.

相关标签:
2条回答
  • 2021-02-12 23:44

    Your range includes zero - log(0) is undefined.

    0 讨论(0)
  • 2021-02-13 00:10

    There are a few other places where the domain for the scale is set. You need to update those as well.

    Working jsfiddle here.

    And here's some code so that it allows me to post this:

    x.domain([1, root.value]).nice();
    
    0 讨论(0)
提交回复
热议问题