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

你好,ios中配置formatterVariable在tooltip中使用本地运行是没问题的,但是打完包之后会导致图表不显示 #43

Closed Mortydev closed 2 years ago

Mortydev commented 2 years ago

react-native-echarts-pro【1.8.2】 react-native version【0.63.4】 react-native-webview 【11.4.0】 Platform【ios】 System【14.6】 Demo:

class demo extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            tooltipData: {
                "2022-03-25": "",
                "2022-03-26": "",
                "2022-03-27": "",
                "2022-03-28": "",
                "2022-03-29": "",
                "2022-03-30": "a:13<br/>b:8<br/>c:5<br/>",
                "2022-03-31": "a:17<br/>b:25<br/>c:25<br/>",
                "2022-04-01": "a:13<br/>b:5<br/>c:5<br/>",
                "2022-04-02": "z:16<br/>b:20<br/>c:20<br/>"
            }
        };
    }
  const pieOption = {
    tooltip: {
      trigger: "axis",
      formatter:  (params) => {
            return (
                   params[0].seriesName + ":" + params[0].data +'<br />' 
                   + formatterVariable[params[0].name]
             )                
         }
    },
    grid: {
      left: "3%",
      right: "4%",
      bottom: "3%",
      containLabel: true,
    },
    xAxis: {
      type: "category",
      boundaryGap: false,
      data: ["2022-03-27, "2022-03-28", "2022-03-29", "2022-03-30", "2022-03-31", "2022-04-01", "2022-04-02],
    },
    yAxis: {
      type: "value",
    },
    series: [
      {
        name: "邮件营销",
        type: "line",
        stack: "总量",
        data: [120, 132, 101, 134, 90, 230, 210],
      }
    ],
  };
  render() {
      return (
          <View style={{ height: 300, paddingTop: 25 }}>
            <RNEChartsPro
                 formatterVariable={this.state.tooltipData}
                 option={pieOption}
                 height={500}
                 width={800}
            />
          </View>
        );
  }
}
export default demo;
supervons commented 2 years ago

我使用你的例子打包后可以正常显示。排查下: 1、是否启用 Hermes 引擎; 2、更新 1.8.3 打包试试;

npm install react-native-echarts-pro@1.8.3
supervons commented 2 years ago

太久没有回复,等待回复再打开。