'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. (see https://britecharts.github.io/britecharts-react/#bar). From the docs it seems that the method is "labelsSize" but this is not currently working. A forked codepen showing the issue is here: 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')
);
Solution 1:[1]
Found this out asking around in the Brightcharts-React github page. Basically, you need to target the elements of the chart via css. See example for changing the font-size:
.tick text {
font-size: 16px !important;
}
similarly,
.vertical-grid-line {
display: none !important;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | mvoln |