d3.select(this).style("font-size","30px");
d3.select(this).style("font-size",30);
使用以下代码可以设置任何X标签的样式
const formatXLabel=()=>{
const parent = document.querySelector("."+ props.xAxis.class);
for(let x = 0; x<parent.children.length; x++) {
const ticks = parent.children.item(x);
if(ticks !==null && ticks.className.baseVal === 'tick') {
try {
const text = ticks.querySelector("text");
for (let sp in props.xAxis.labelStyles) {
text.style[sp.toString()] = props.xAxis.labelStyles[sp];
}
}catch (e){
console.log(e);
}
}
}
}
"60px"
而不是仅使用60
。 - smcs