Home Forums Chart Support CanvasJS npm package for React Reply To: CanvasJS npm package for React



The package mentioned above is not official but from a third party. However, CanvasJS Chart works fine with React. Below are the steps to integrate CanvasJS Chart / StockChart in your react app.
1. Save canvasjs.react.js and canvasjs.min.js(canvasjs.stock.react.js and canvasjs.stock.min.js in case of StockChart) within source-folder of your React application ( src or src/assets or src/lib ).
2. Import the library into your app.
For Chart:
import CanvasJSReact from './canvasjs.react';
var CanvasJSChart = CanvasJSReact.CanvasJSChart;

For StockChart:
import CanvasJSReact from './canvasjs.stock.react';
var CanvasJSStockChart = CanvasJSReact.CanvasJSStockChart;

Once it’s imported, you are ready to go. Now you can create Chart / StockChart, pass options & render them.

Please check out React Gallery for examples on integrating charts in React app.

react column chart

Indranil Deo
Team CanvasJS