fusioncharts / react-native-fusioncharts

Simple and Lightweight React Native component for FusionCharts JavaScript Charting Library
https://fusioncharts.github.io/react-native-fusioncharts
MIT License
77 stars 36 forks source link

dataPlotClick event not triggering in Android for React Native #139

Open VibhorKockpit opened 2 years ago

VibhorKockpit commented 2 years ago

Hi, I am trying to implement 2D scrollable column chart in a test project, everything has worked fine till now in case of iOS but for Android, my dataPlotClick event if not getting triggered. I am using following versions of the package.

"react-native-webview": "^11.0.2",
"react-native-fusioncharts": "^5.1.0", 
"fusioncharts": "^3.18.0",

Here is my chart config and library path:

const chartConfigs = {
    type: "scrollColumn2d",
    width: "100%",
    height: "200",
    dataFormat: "json",
    dataSource: {
      chart: {
        theme: "fusion",
        showvalues: "1",
        showToolTip: "0",
        numberprefix: "$",
        scrollheight: "0",
        flatScrollBars: "0",
        numVisiblePlot: "4",
        showHoverEffect: "1",
        scrollShowButtons: "0",
        scrollColor: "#cccccc",
        showBorder: "0",
        bgColor: "#ffffff",
        showYAxisvalue: "0",
        canvasPadding: "10",
        showXAxisLine: "1",
      },
      categories: [
        {
          category: graphLabel,
        },
      ],
      dataset: [
        {
          data: graphValue,
        },
      ],
    },
    events: {
      dataPlotClick: function (ev, props) {
        barClick();
        function barClick() {
          handleClick(props?.categoryLabel);
        }
      },
    },
  };

  const libraryPath = Platform.select({
    // Specify fusioncharts.html file location
    ios: require("../../../assets/FusionCharts/fusioncharts.html"),
    // ios: require('../../../assets/fusioncharts.html'),
    android: { uri: "file:///android_asset/fusioncharts.html" },
  });

The graph is rendering correctly in Android and iOS, it's just that events are not getting triggered on Android.

This is what I get in my Android Logcat.

2021-12-24 13:36:25.738 22228-22228/com.test I/ViewRootImpl@7e78e8e[MainActivity]: ViewPostIme pointer 0
2021-12-24 13:36:25.831 22228-22228/com.test I/ViewRootImpl@7e78e8e[MainActivity]: ViewPostIme pointer 1
2021-12-24 13:36:25.863 22228-22228/com.test D/InputMethodManager: prepareNavigationBarInfo() DecorView@37fc448[MainActivity]
2021-12-24 13:36:25.863 22228-22228/com.test D/InputMethodManager: getNavigationBarColor() -16711423
2021-12-24 13:36:25.863 22228-22228/com.test V/InputMethodManager: Starting input: tba=com.test ic=null mNaviBarColor -16711423 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
2021-12-24 13:36:25.863 22228-22228/com.test D/InputMethodManager: startInputInner - Id : 0
2021-12-24 13:36:25.863 22228-22228/com.test I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
2021-12-24 13:36:25.866 22228-22228/com.test D/InputTransport: Input channel constructed: 'ClientS', fd=218
2021-12-24 13:36:25.866 22228-22228/com.test D/InputTransport: Input channel destroyed: 'ClientS', fd=112
2021-12-24 13:36:25.866 22228-22228/com.test D/InputMethodManager: HSIFW - flag : 0
2021-12-24 13:36:45.001 22228-22228/com.test I/ViewRootImpl@7e78e8e[MainActivity]: ViewPostIme pointer 0
2021-12-24 13:36:45.083 22228-22228/com.test I/ViewRootImpl@7e78e8e[MainActivity]: ViewPostIme pointer 1
2021-12-24 13:36:45.106 22228-22228/com.test D/InputMethodManager: HSIFW - flag : 0
AyanBhadury commented 2 years ago

Library path prop is not required any react-native-fusioncharts can you double check if you are using version 5.1.0