在类型为 RNSVGPath 的阴影节点中更新属性“d"时出错 [英] Error while updating property ‘d’ in shadow node of type:RNSVGPath

查看:80
本文介绍了在类型为 RNSVGPath 的阴影节点中更新属性“d"时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

https://github.com/FormidableLabs/victory-native第一次使用条形图,填写数据是正常的,但是在更改数据更新条形图时,更新条形图总是错误的.请给我们一些解决方案.

https://github.com/FormidableLabs/victory-native It is normal to use the bar chart for the first time and fill in the data, but when changing the data to update the bar chart, it is always wrong to update the bar chart. Please give us some solutions.

PS:尝试使用以下方法解决: 1.检查victory-native Path代码是否是最新的.检查互联网,它是最新的;2.判断填充的数据是否为空.已经验证数据不为空,更新了数据,但是没有重绘条形图.

PS: try using the following method to solve: 1. Check whether the victory-native Path code is up to date. Check the Internet, it's up to date; 2. Determine whether the filled data is empty. It has been verified that the data is not empty and the data is updated, but the bar chart is not redrawn.

render() {
return (
<PollutantcodeBarRank style=
{{width:SCREEN_WIDTH,backgroundColor:'#ffffff',position:'absolute',top:0}}/>
 {
 this.props.ishow?{'正在加载中'}:<VictoryChart
 style={{
 parent: {
 justifyContent:'center',
 alignItems:'center',
 marginTop:20,
 },
borderColor:'red',
borderWidth:1,
}}
height={240} width={SCREEN_WIDTH-10} padding={{ top: 40, bottom: 40, right: 
5, left: 26 }}
containerComponent={
<VictoryVoronoiContainer
width={SCREEN_WIDTH-10}
voronoiDimension="x"
labels={(d) => {
return ${d.chartXValue}\n 值:${d.chartYValue};}}
labelComponent={
<VictoryTooltip
width={SCREEN_WIDTH/2-50}
cornerRadius={0}
flyoutStyle={{ fill: "white"}}/>}
/>}
domainPadding={{ x: 15,y: 15 }}>{
<VictoryBar
alignment="start"
style={{
data: {
fill: (d) => d.chartColor?d.chartColor:'#489ae3',
width: 7,
fillOpacity: 0.9,
strokeWidth: 1
}
}}
data={this.props.chartData}
x={(d) => d.zz}
y={(d) => {
if(d.chartYValue=='---'){
return 0;
}
return d.chartYValue;}}/>
}
<VictoryAxis
theme={VictoryTheme.material}
tickFormat={this.props.radom5}
style={{ axis: { stroke: '#A4A4A4' },
axisLabel: { fontSize: 12, fill: '#000' },
ticks: { stroke: '#A4A4A4',size:5 },
tickLabels: { fontSize: 12, fill: '#999', padding: 5, fontFamily: 
'NunitoSans-Regular'},
}} />
<VictoryAxis
dependentAxis
domain={this.props.YZhou}
tickFormat={(x)=> x }
style={{ axis: { stroke: '#A4A4A4' },
axisLabel: { fontSize: 12, fill: '#000' },
ticks: { stroke: '#A4A4A4' },
tickLabels: { fontSize: 12, fill: '#999', padding: 5, fontFamily: 
'NunitoSans-Regular'},
}}
/>
}
); 
}
}

推荐答案

就我而言,原因是后端的值不正确.我正在使用 API 调用来获取图表的初始值.我收到了 X 轴的 NaN 值.

In my case, the reason was the incorrect values from the backend. I was using an API call for the initial values of charts. I was receiving a NaN value for X-axis.

这篇关于在类型为 RNSVGPath 的阴影节点中更新属性“d"时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆