如何在React Native中调整标签文本中心React Native中的SVG图表
<View style={{flex: 1, height: windowHeight * 0.39, marginLeft: 10}}>
<BarChart
style={{flex: 1}}
data={data}
spacingInner={width * 0.000999}
spacingOuter={
Months.length == 1
? width * 0.36
: Months.length == 3
? width * 0.3
: null
}
horizontal={false}
yAccessor={({item}) => item.value}
svg={{fill: fill}}
contentInset={{top: width * 0.025, bottom: width * 0.025}}
spacing={0.2}
gridMin={0}
gridMax={Math.max(...values)}>
<Grid svg={{stroke: LineFill}} />
</BarChart>
<XAxis
xAccessor={({index}) => index}
data={Months}
formatLabel={(label, index) => data[index].label}
style={{
marginHorizontal: width * -0.03,
height: width * 0.04,
alignItems: Months.length == 1 ? 'center' : null,
}}
contentInset={{
left: Months.length == 3 ? width * 0.26 : Months.length == 4 ? width * 0.09 : width * 0.07,
right: Months.length == 3 ? width * 0.26 : Months.length == 4 ? width * 0.09 : width * 0.066,
}}
svg={axesSvgXAxis}
/>
</View>
blockquote 嗨,我是新手反应天然的,我正在使用React Native-SVG-tharts,根据React Native-SVG-charts中的bar的位置,我在调整标签文本中心面临问题。 strong text
<View style={{flex: 1, height: windowHeight * 0.39, marginLeft: 10}}>
<BarChart
style={{flex: 1}}
data={data}
spacingInner={width * 0.000999}
spacingOuter={
Months.length == 1
? width * 0.36
: Months.length == 3
? width * 0.3
: null
}
horizontal={false}
yAccessor={({item}) => item.value}
svg={{fill: fill}}
contentInset={{top: width * 0.025, bottom: width * 0.025}}
spacing={0.2}
gridMin={0}
gridMax={Math.max(...values)}>
<Grid svg={{stroke: LineFill}} />
</BarChart>
<XAxis
xAccessor={({index}) => index}
data={Months}
formatLabel={(label, index) => data[index].label}
style={{
marginHorizontal: width * -0.03,
height: width * 0.04,
alignItems: Months.length == 1 ? 'center' : null,
}}
contentInset={{
left: Months.length == 3 ? width * 0.26 : Months.length == 4 ? width * 0.09 : width * 0.07,
right: Months.length == 3 ? width * 0.26 : Months.length == 4 ? width * 0.09 : width * 0.066,
}}
svg={axesSvgXAxis}
/>
</View>
Blockquote
Hi i am new to react native , i am using react native-svg-charts , i am facing issue in adjust label text center according to the position of bars in react native-svg-charts.strong text
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论