无法调整react-apex-chart径向条厚度,求解决方案
如何减小react-apex-chart径向条形图的厚度
要实现更细的径向条形,你只需要在plotOptions.radialBar配置中添加barThickness属性,或者调整hollow.size参数即可,以下是修改后的完整配置:
const chartOptions = { series: [40], options: { chart: { height: 350, type: 'radialBar', toolbar: { show: true } }, plotOptions: { radialBar: { barThickness: 10, // 直接设置条形厚度,数值越小条形越细,支持像素或百分比 hollow: { margin: 0, size: "20%", // 也可增大此值(比如"50%"),通过扩大空心区域间接减小条形宽度 background: "#293450" }, track: { dropShadow: { enabled: true, top: 2, left: 0, blur: 4, opacity: 0.15, }, }, dataLabels: { showOn: "always", name: { offsetY: -10, color: "#fff", fontSize: "13px" }, value: { color: "#fff", fontSize: "30px", show: true } } } }, }, fill: { type: "gradient", gradient: { shade: "dark", type: "vertical", gradientToColors: ["#05E996"], stops: [0, 100] } }, stroke: { lineCap: 'round', }, labels: ['APs count'], };
两种调整方式说明:
barThickness:直接定义条形的厚度,支持像素值(如10)或百分比(如"15%"),数值越小条形越细,是最精准的调整方式。hollow.size:通过扩大空心区域的占比,间接压缩条形的宽度,适合需要整体调整图表内外比例的场景。
内容的提问来源于stack exchange,提问作者Jin Nine
相关产品推荐
相关产品推荐

