Giter VIP home page Giter VIP logo

Comments (2)

Pauan avatar Pauan commented on July 17, 2024

@Gervwyk The reason for using <script> tags is because AmCharts 3 is designed for <script> tags.

I had tried to use require instead, but that caused many problems:

  1. If a developer isn't using serial charts, it will still require the serial.js file, which is inefficient.

  2. If a developer wants to use the other chart types, they need to include a special require("amcharts3/amcharts/<type>.js") line in their code, and it has to be in a special order.

  3. If using require, you can't take advantage of the AmCharts CDN.

  4. If using the paid version of AmCharts, you need to include special versions of amcharts.js, serial.js, etc. but amcharts3-react always requires the non-paid versions.

  5. The documentation is written under the assumption that you are using <script> tags.

  6. If using require, the export plugin breaks. This breakage is very hard to fix. This was the biggest reason to switch back to <script> tags.

AmCharts 3 was written many years ago. It was created long before modules and bundlers even existed, so it was designed for <script> tags, and it's too difficult for us to fix these problems.

Switching back to <script> tags was not a decision I made lightly. It's a major breaking change (which caused a lot of extra work for me), and I was the one who changed amcharts3-react to use require in the first place, because I wanted to try and modernize AmCharts.

AmCharts 4 will have great support for npm, ES6 modules, TypeScript, Angular, React, etc. but it's not released yet. We can't make any guarantees, but we hope to have it released before next year.

In the meantime, you can either use <script> tags, or you can manually require all of the AmCharts files yourself (e.g. require("amcharts3/amcharts/amcharts.js")). If you choose to use require, you will need to deal with the breakage that occurs with the export plugin, but there are ways to work around it.

from amcharts3-react.

Gervwyk avatar Gervwyk commented on July 17, 2024

Thanks for the feedback @Pauan . That makes sense to me and I'm happy to hear AmCharts 4 is on its way, I would be happy to wait for the upgrades until then. To me AmCharts is by far the most advanced and flexible chart library out there and we are currently building it into the core of our product because of its flexibility.
This probably should be another issue but I updated to the latest release with script tags but down graded again. Mainly because the smoothed line function caused some very weird curves - which was not the case in the previous version. It would be nice to have a property to control the curvature of the smooth line.

from amcharts3-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.