-
Create a
package.jsonwhich includesreact,react-dom, and@amcharts/amcharts3-react:{ "devDependencies": { "react": "^15.4.2", "react-dom": "^15.4.2", "@amcharts/amcharts3-react": "^2.0.0" } } -
Run
npm install -
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>
-
If you are using
<script>tags, include the React andamcharts3-react.jsfiles in your HTML:<script src="node_modules/react/dist/react.min.js"></script> <script src="node_modules/react-dom/dist/react-dom.min.js"></script> <script src="node_modules/@amcharts/amcharts3-react/amcharts3-react.js"></script>
If you are using a bundler (like Webpack), import the
@amcharts/amcharts3-reactplugin:var AmCharts = require("@amcharts/amcharts3-react");
React.createElement(AmCharts.React, {
"type": "serial",
"theme": "light",
"graphs": [...],
"dataProvider": [...]
})Or alternatively if you are using JSX:
<AmCharts.React
type="serial"
theme="light"
graphs={[...]}
dataProvider={[...]} />You can also pass the entire config object:
var config = {
"type": "serial",
"theme": "light",
"graphs": [...],
"dataProvider": [...]
};
<AmCharts.React {...config} />The configuration is exactly the same as the AmCharts.makeChart method.
Changes to the configuration 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.
- Reverting the code which waits for the chart to initialize.
- It now waits for the chart to initialize before it updates (this fixes some errors).
- Republishing 2.0.4
-
Fixing a deprecation warning with React (thanks to Izumi-kun)
-
Working around a bug with
groupToPeriods
- Fixing an error when updating maps
- Fixing a warning with
React.createClass(thanks to Izumi-kun)
-
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.Reactrather thanAmCharts
- Fixing another bug with updating the chart data
- Fixing a bug where the chart does not zoom out when changing the
dataProvider
- Fixing a bug where the chart won't show up properly on the first update
- Fixing a bug which caused stock charts to not update correctly
- Deprecating using
AmChartswith Webpack, instead useAmCharts.React - Adding in the various global
AmChartsproperties for Webpack
- Fixing a bug that caused the
listenersto trigger multiple times
- Fixing an issue with
peerDependencies
- Adding in support for npm / Webpack
- Initial release