You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2021/09/12 05:17:41 UTC

[GitHub] [echarts-examples] aditya-manit opened a new issue #38: How to fetch data from api in any of the example ?

aditya-manit opened a new issue #38:
URL: https://github.com/apache/echarts-examples/issues/38


   I am trying to fetch data to built  a chart from an API, but I cannot add any imports to chart files (eg: `area-simple.js`)
   
   On adding `import axios from 'axios';`
   Its giving me error: `SyntaxError: Cannot use import statement outside a module`
   
   I have tried using require but then I am getting:
   On adding `const axios = require('axios');`
   It giving me error: `ReferenceError: require is not defined`
   
   I am kinda new to webpack, Can someone please guide me to the correct way to call an api and use its data in `area-simple.js` file or any other file.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org