npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@amcharts/amcharts3-react

v3.1.1

Published

How to install ==============

Downloads

13,615

Readme

How to install

  1. Create a package.json which includes react, react-dom, and @amcharts/amcharts3-react:

    {
      "devDependencies": {
        "react": "^16.0.0",
        "react-dom": "^16.0.0",
        "@amcharts/amcharts3-react": "^3.0.0"
      }
    }
  2. Run npm install

  3. Use <script> tags in your HTML file to load AmCharts:

    <script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
    <script src="https://www.amcharts.com/lib/3/serial.js"></script>
    <script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
  4. If you are using a bundler (like Webpack), import the @amcharts/amcharts3-react plugin:

    import AmCharts from "@amcharts/amcharts3-react";

    If you are using <script> tags, include the React and amcharts3-react.js files in your HTML:

    <script src="node_modules/react/umd/react.production.min.js"></script>
    <script src="node_modules/react-dom/umd/react-dom.production.min.js"></script>
    <script src="node_modules/create-react-class/create-react-class.min.js"></script>
    <script src="node_modules/@amcharts/amcharts3-react/amcharts3-react.js"></script>

How to use

React.createElement(AmCharts.React, {
  className: "my-class",
  style: {
    width: "100%",
    height: "500px"
  },
  options: {
    "type": "serial",
    "theme": "light",
    "graphs": [...],
    "dataProvider": [...]
  }
})

Or alternatively if you are using JSX:

<AmCharts.React
  className="my-class"
  style={{
    width: "100%",
    height: "500px"
  }}
  options={{
    "type": "serial",
    "theme": "light",
    "graphs": [...],
    "dataProvider": [...]
  }} />

You can also define the options object separately:

var config = {
  "type": "serial",
  "theme": "light",
  "graphs": [...],
  "dataProvider": [...]
};

<AmCharts.React options={config} />

The options property supports exactly the same configuration as the AmCharts.makeChart method, so all of the AmCharts demos work the same.

Changes to options are automatically detected when rendering (you do not need to call validateNow or validateData).

In addition, this plugin automatically generates an id, so you do not need to specify it.

You can find some examples in the examples folder.


If you want to use plugins (like dataloader, export, responsive, animate, etc.) you will need to include the appropriate <script> tags.

Here is an example for the export plugin:

<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />

<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>

You can see an example program in the examples/webpack-export folder. It updates the chart's dataProvider every 3 seconds.

Changelog

3.1.1

  • Adding in support for React 17 and React 18.

3.1.0

  • Adding in className property for specifying the CSS class for the element.

3.0.3

  • Fixing version ranges for react and react-dom

3.0.0

  • Rather than passing in the configuration directly, instead you must pass in the configuration using the new options property.

  • Adding in delay property for controlling the chart delay.

2.0.7

  • Reverting the code which waits for the chart to initialize.

2.0.6

  • It now waits for the chart to initialize before it updates (this fixes some errors).

2.0.5

  • Republishing 2.0.4

2.0.4

2.0.3

2.0.2

2.0.0

  • Major breaking change: this plugin no longer automatically imports AmCharts, so you must use <script> tags to load AmCharts

  • Major breaking change: you must now use AmCharts.React rather than AmCharts

1.1.8

  • Fixing another bug with updating the chart data

1.1.7

  • Fixing a bug where the chart does not zoom out when changing the dataProvider

1.1.6

  • Fixing a bug where the chart won't show up properly on the first update

1.1.5

  • Fixing a bug which caused stock charts to not update correctly

1.1.4

  • Deprecating using AmCharts with Webpack, instead use AmCharts.React
  • Adding in the various global AmCharts properties for Webpack

1.1.3

  • Fixing a bug that caused the listeners to trigger multiple times

1.1.2

1.1.1

1.1.0

  • Adding in support for npm / Webpack

1.0.0

  • Initial release