react-native-chart-kit
react-native-chart-kit copied to clipboard
Customize fonts on labels
Is it possible customize fonts on labels? fontFamily, fontSize etc
You can add fontFamily property to Text into react-native-chart-kit.
for example : in pie-chart.js - line 47 add this code:
fontFamily={c.item.fontFamily}
Now you can set fontFamily in your data entities.
but react-native-svg can't render all font type!
@c0mm4nDer worked like a charm. Thanks a lot!
Should we create a PR for this?
Any update?
Just found out by accident while reading someone else code:
Under chartConfig prop, there is the propsForLabels prop. You may enter the fontFamily
there and other texts properties.
add font name in propsForLabels this works for me
chartConfig={{
propsForLabels:{
fontFamily:'MontserratBold',
},
...
}}
add font name in propsForLabels this works for me
chartConfig={{ propsForLabels:{ fontFamily:'MontserratBold', }, ... }}
Thanks, it worked for me :)
inside data object
{
legendFontColor: colors.white,
legendFontSize: 8,
}
{ legendFontColor: colors.white, legendFontSize: 8, }
@3abdawy Where we can put this?
It pretty easy you can add ### propsForLabels to the config props
<BarChart chartConfig={{ ...chartConfig, propsForLabels: { fontSize:12, fontFamily: "roboto-regular", } }} />
propsForLabels:{fontFamily :'iransans'},
this work just fine