5 Replies Latest reply on Jul 18, 2018 4:00 PM by chris_hub

    Import Amchart 4 into Pi Vision 4

    chris_hub

      Hi,

      I want include the Amcharts 4 library into the "pi-vision-extensions" project from OSIsoft's github repository.

      Therefor I have installed amcharts 4, as explainend in the docs(https://www.amcharts.com/docs/v4/getting-started/integrations/using-angular2/ ).

      But when I import the library I always get an error during the build.

      amchartserror.PNG

      amchartserror2.PNG

      Does anyone know how fix this?

        • Re: Import Amchart 4 into Pi Vision 4
          Roger Palmen

          Can't really help (although we have used amCharts v3 in Pi Vision 4. But i'm a big fan of both amCharts and PiV4, so good to see this combo of soon-to-be-released versions is being used!

           

          PS: i see this is related to the extensions. You really need those? Else you could skip the dead weight and thereby get rid of the issue...

          • Re: Import Amchart 4 into Pi Vision 4
            golbar

            Hi,

            I've encountered the exact same problem when trying to import the AmChart4 lib to the PiVision4, but finally found a workaround:

            1. Add rxjs-compat lib: npm install rxjs-compat@6 --save (only the campatibility lib, dont update the rxJS; rxjs/migration.md at master · ReactiveX/rxjs · GitHub)

            2. Change every "import()" function to "require()" in node_modules\@amcharts\amcharts4\.internal\core\export\Export.js and node_modules\@amcharts\amcharts4\.internal\core\responsive\responsive.js

            For example, line in Export.js:

            case 0: return [4 /*yield*/, import(/* webpackChunkName: "fabric" */ "../../fabric/fabric")];

            to:

            case 0: return [4 /*yield*/, require(/* webpackChunkName: "fabric" */ "../../fabric/fabric")];

            3. After adding chart component to module.ts everything should work fine.

             

            Hope that helps

            3 of 3 people found this helpful