[英]rounded corners to a rectangle?
目前,我在c3.js中生成的圖表圖例是彩色矩形,我想通過圓圈對其進行更改。 我該怎么做?
var chart = c3.generate({
data: {
columns: [
['data1', 30],
['data2', 120],
],
type : 'donut',
onclick: function (d, i) { console.log("onclick", d, i); },
onmouseover: function (d, i) { console.log("onmouseover", d, i); },
onmouseout: function (d, i) { console.log("onmouseout", d, i); },
label:true,
},
donut: {
title: "Iris Petal Width",
label: {
/*format: function(value, ratio, id)
{
return d3.format('')(value)
},*/
show: false
}
}
});
有一種方法(可怕嗎?!)來做您想做的事情:
CSS更改:
.c3-legend-item-tile {
stroke-linecap: round;
}
JS變更:
const legendTiles = document.getElementsByClassName('c3-legend-item-tile');
for (const tile of legendTiles) {
const x1 = tile.getAttribute('x1');
tile.setAttribute('x2', x1);
}
看到這個柱塞
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.