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 33 forks source link

部分手持pda扫码设备上不显示图表,而我使用react-native-webview组件调用echarts可以显示 #118

Closed DreamEVA closed 3 months ago

DreamEVA commented 9 months ago

系统:android7.1.1 react-native-echarts-pro version: 1.9.1 react-native-webview version:11.26.1

具体的系统信息可以通过邮箱联系我

示例代码 const option = { color:['#1f8afe'], xAxis: { type: 'value', show:false, //不显示坐标轴线、坐标轴刻度线和坐标轴上的文字 axisTick:{ show:false//不显示坐标轴刻度线 }, axisLine: { show: false, //不显示坐标轴线 }, axisLabel: { show: false, //不显示坐标轴上的文字 }, }, // dataZoom: [ // { // type: 'inside', // start: 50, // end: 0, // yAxisIndex: [0], // }, // { // start:50, // end:0, // yAxisIndex: [0], // } // ], yAxis: { type: 'category', data: ["废渣","医疗废物"], axisLabel: { interval: 0, formatter(value) { let ret = '';//拼接加\n返回的类目项 const maxLength = 5;//每项显示文字个数 const valLength = value.length;//X轴类目项的文字个数 const rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数 if (rowN > 1) { //如果类目项的文字大于5, for (let i = 0; i < rowN; i++) { let temp = '';//每次截取的字符串 const start = i * maxLength;//开始截取的位置 const end = start + maxLength;//结束截取的位置 //这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧 if(i+1===rowN) { temp = value.substring(start, end-1) + '...'; }else{ temp = value.substring(start, end) + '\n'; } ret += temp; //凭借最终的字符串 } return ret; } else { return value; } } }, axisTick:{ show:false//不显示坐标轴刻度线 }, }, grid:{ left:'21%', right:'14%', bottom:'10%', top:'5%' }, series: [ { data: [200,500], type: 'bar', barMaxWidth:50, label: { show: true, position: 'right', formatter(v) { return v.data + 'kg'; } }, } ] }; <RNEChartsPro ref={ref} height={540} option={option} webViewSettings={{ androidLayerType:'hardware' }}/>

supervons commented 8 months ago

使用模拟器,同样的版本,依赖包是没问题的,方便提供下具体信息吗?

Snipaste_2023-12-05_11-10-27 Snipaste_2023-12-05_11-11-33
DreamEVA commented 8 months ago

微信图片_20231201172946 这是手机的具体配置

DreamEVA commented 8 months ago

我使用react-native-webview调用的echarts是在安卓的主包中放了一个html,路径是通过uri传给webview的 image image

supervons commented 8 months ago

我使用react-native-webview调用的echarts是在安卓的主包中放了一个html,路径是通过uri传给webview的 ![image]...

可以提供下echarts.htmlecharts.js文件吗?

理论上目前库的集成方式和这种模式没有区别,可能 echarts 的版本上有差异。