dc.js: Adding a Legend to Pie Chart

╄→尐↘猪︶ㄣ 提交于 2019-12-07 15:53:26

The syntax looks correct.

I have had several cases where my legend did not show up either. It was usually because I specified .x() or .y() outside the container size of the graph. Start by putting the legend at .x(0).y(0) to make sure it fits inside the container.

A working fiddle of the basic .legend() for the pieChart can be found here http://jsfiddle.net/za8ksj45/39/

    Working example of original .legend(): line 1018
    Working example of new .legend2(): line 1030

It is a bit lengthy because the example includes a modification to legend.js in the beginning of the section that lets you add (%) to it. If you just need the standard legend, look at line 1018.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!