[英]How to change chart font-size in Britecharts React?
I am unable to change the font-size of the x and y-axis using Britecharts - React.我无法使用 Britecharts - React 更改 x 轴和 y 轴的字体大小。 (see https://britecharts.github.io/britecharts-react/#bar ).
(参见https://britecharts.github.io/britecharts-react/#bar )。 From the docs it seems that the method is "labelsSize" but this is not currently working.
从文档看来,该方法似乎是“labelsSize”,但这目前不起作用。 A forked codepen showing the issue is here: https://codepen.io/mvolny/pen/XWZrmXR .
显示该问题的分叉代码笔位于: https://codepen.io/mvolny/pen/XWZrmXR 。 Thanks.
谢谢。
const {Bar} = window['britecharts-react'];
const barData = [
{
name: 'Radiating',
value: 2,
},
{
name: 'Opalescent',
value: 4,
},
{
name: 'Shining',
value: 3,
},
{
name: 'Vibrant',
value: 6,
},
{
name: 'Vivid',
value: 6,
},
{
name: 'Brilliant',
value: 1,
},
];
const marginObject = {
left: 100,
right: 40,
top: 40,
bottom: 40,
};
ReactDOM.render(
<Bar
data={barData}
width={400}
isHorizontal={true}
margin={marginObject}
labelsSize={50}
/>,
document.getElementById('app')
);
Found this out asking around in the Brightcharts-React github page.在 Brightcharts-React github 页面中四处询问发现了这一点。 Basically, you need to target the elements of the chart via css. See example for changing the font-size:
基本上,您需要通过 css 定位图表的元素。请参阅更改字体大小的示例:
.tick text {
font-size: 16px !important;
}
similarly,相似地,
.vertical-grid-line {
display: none !important;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.