dc.js pieChart设置特定的x轴值

Nik*_* K. 5 d3.js crossfilter dc.js

我正在研究dc.js,我画了pieChart

pieChart.width(300)
    .height(200)
    .transitionDuration(1500)
    .dimension(startValue)
    .group(startValueGroup, "StartValue")
    .radius(100)
    .minAngleForLabel(0.5)
    .legend(dc.legend().x(230).y(0))
    .title(function(d) {
        return d.key + ": " + d.value;
    })
    .renderTitle(true)
    .on("filtered", function (chart) {
        dc.events.trigger(function () {
            //console.log(total_payment);
            });
    });
Run Code Online (Sandbox Code Playgroud)

现在,我想设置特定的x轴值.目前,pieChart采取定义宽度和高度的中心位置.这意味着它占据了(150,100)的位置.我想把这个位置改为(100,100).

如何按上述代码更改x轴的位置?

Lar*_*off 4

您无法直接在 dc 选项中设置此值,但可以在渲染图表后修改这些值。假设“pie”是您将饼图渲染到的 DOM 元素的 ID,您可以这样做

d3.select("#pie > svg > g").attr("transform", "translate(100,100)");
Run Code Online (Sandbox Code Playgroud)