Add legend to pie chart in dc.js

后端 未结 1 1967
说谎
说谎 2021-01-13 10:26

I\'m building a dc.js-based visualization where one of the charts is a pie chart. See:

http://jsfiddle.net/luiseth/t8we6/

The peculiarity of my case is that

相关标签:
1条回答
  • 2021-01-13 11:11

    I just tried this with a CSS override and it seemed to work:

    pie chart with offset legend

    The pie chart creates an SVG canvas based on what width you declare the chart and then places it in the center. I targeted that SVG canvas and added a different width and it displays. Offsetting the label past the canvas causes it to be hidden.

    So if your pie chart has a width of 200, and an id of "piechart", and you want to add an additional 150 pixels to account for the label, try the following CSS:

    #piechart svg { width: 350px; }
    

    Remember to account for that width in your page layout.

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