supervons / react-native-echarts-pro

A React-Native charts based on Apache ECharts, support various charts and map.
https://supervons.github.io/react-native-echarts-pro-docs/
MIT License
216 stars 32 forks source link

柱状图本地与打包后不一致问题,打包后柱形不显示 #124

Closed chenhr24 closed 3 months ago

chenhr24 commented 3 months ago

遇到了本地问题,formatter方法是直接写在option配置里的,表现是(调试模式下是正常展示的)打包后柱形不展示, "react-native-echarts-pro": "^1.9.0", “react-native”:0.0.63 react-native-webview :10.9.0 平台:安卓&ios 系统版本:鸿蒙4.0/ios14

初步排查:注释掉formatter方法后可以正常展示柱形,可能与formatter有关,请问改如何解决

chenhr24 commented 3 months ago

问题已解决,参考:https://github.com/supervons/react-native-echarts-pro/issues/123 1.RNEChartsPro的enableParseStringFunction为true 2.将formatter函数使用字符形式编写 a.之前的写法 formatter: function(params) { return params.data.labelText || params.value; }, b.修改后的写法 formatter: "function(params) { 'show source'; return params.data.labelText || params.value; }"