dc.js饼图并非显示所有标签

时间:2017-04-13 04:33:11

标签: dc.js

Pie missing labels

我在饼图中设置了这些属性,但标签仍然不完全可见。标签只在单击任何切片时可见,但在加载页面时不可见,我现在该怎么办?

    yearChart
    .width(200)
    .height(200)
    .dimension(yearDim)
    .group(countPerYear)
    .innerRadius(20)            
    .drawPaths(true)
    .externalRadiusPadding(30)
    .externalLabels(40);          


    monthChart
    .width(200)
    .height(200)
    .dimension(dist)
    .group(countPerDist)
    .innerRadius(20)
    .drawPaths(true)
    .externalRadiusPadding(30)
    .externalLabels(40);

2 个答案:

答案 0 :(得分:2)

最后我解决了这个问题。我只需添加.minAngleForLabel(0)即可显示所有标签。

Pie labels showing

yearChart
            .width(300)
            .height(300)
            .dimension(yearDim)
            .group(countPerYear)                        
            .drawPaths(true)
            .externalRadiusPadding(60)
            .minAngleForLabel(0)
            .externalLabels(40);

答案 1 :(得分:0)

使用 externalRadiusPadding 调整宽度,高度

试试这个

yearChart
.width(300)
.height(300)
.dimension(yearDim)
.group(countPerYear)
.innerRadius(20)            
.drawPaths(true)
.externalRadiusPadding(90)
.externalLabels(40);          


monthChart
.width(300)
.height(300)
.dimension(dist)
.group(countPerDist)
.innerRadius(20)
.drawPaths(true)
.externalRadiusPadding(90)
.externalLabels(40);
相关问题