由于我无法找到并回答这个问题,我希望它不是重复的。我正在使用chartist.js,我制作了一个简单的甜甜圈,这非常简单直接,但现在我想禁用标签,它工作正常并在甜甜圈内添加一个标签(这就是问题)。图表本身不需要标签变大,如果它只是一个新的 div 或其他东西就足够了。
到目前为止我的代码:
<div class="ct-chart1 ct-chart ct-perfect-fourth"></div>
和
new Chartist.Pie('.ct-chart1', {
labels: [],
series: [75, 25]
}, {
donut: true,
width: '300px',
height: '200px',
donutWidth: 30,
startAngle: 0,
total: 100
});
我已经尝试使图表本身成为一个 flexbox 并将标签添加为子标签并以这种方式居中,但这不起作用,我尝试用新的 div 包围图表,但让图表消失。
<div>
<div class="ct-chart1 ct-chart ct-perfect-fourth"></div>
</div>