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

[fix] Remove useless "replace" function #111

Closed congshengwu closed 1 year ago

congshengwu commented 1 year ago

Summary

This PR removes this line of the code. This line of the code will make the sign " not working in the formatter string function.

After removing it, I tested it on debug and release mode and the charts are rendering well on iOS and Android.

Related issue

https://github.com/supervons/react-native-echarts-pro/issues/96#issuecomment-1449607617

Test case

Before removing the line of the code, the below chart will not be rendered well because of the sign " in the fromatter string function.

After removing the line of the code, the below chart will be rendered well.

function renderChart() {
  const pieOption = {
    tooltip: {
      formatter: `(param) => {
        return param.marker + "&nbsp;&nbsp;" + param.name + ":" + param.value + "<br>";
      }`,
    },
    series: [
      {
        name: 'Source',
        type: 'pie',
        legendHoverLink: true,
        hoverAnimation: true,
        avoidLabelOverlap: true,
        startAngle: 180,
        radius: '55%',
        center: ['50%', '35%'],
        data: [
          {value: 105.2, name: 'android'},
          {value: 310, name: 'iOS'},
          {value: 234, name: 'web'},
        ],
        label: {
          normal: {
            show: true,
            textStyle: {
              fontSize: 12,
              color: '#23273C',
            },
          },
        },
      },
    ],
  };
  return (
    <View style={{height: 300, paddingTop: 25}}>
      <RNEChartsPro
        enableParseStringFunction={true}
        height={250}
        option={pieOption}
      />
    </View>
  );
}