Installing the Library Using npm

As of version 7.2.0, the ChartIQ library archive contains a tarball (.tgz file) that enables you to install the charting library using npm.

Obtain a copy of the library, and extract the files from the archive.

Install the library from the tarball using npm, for example:

npm install ./chartiq-7.2.0.tgz

Now if you inspect your package.json file you will notice that a new dependency has been added:

"chartiq": "file:chartiq-7.2.0.tgz",

Note: Unlike other NPM dependencies where you can prefix the semantic version with a carot or tilde, when you upgrade the charting library for any reason, even for patch releases, this reference will need to be replaced with the new version. We recommend always removing the old version of the chartiq package completely and reinstalling the new version:

npm remove chartiq
npm install ./chartiq-x.x.x.tgz

Including all necessary files

The ChartIQ library comprises a variety of file types: JavaScript files, CSS files, svg and cur files.

The npm package does not include a way to load assets such as CSS and image files. As such, you will need to explicitly load them. You can use any solution you feel appropriate such as <script> src attributes or a module bundler such as webpack. The ChartIQ npm package has been designed to work well within the patterns set by Webpack and samples are provided.

Example Webpack Configuration

In the root of your chartiq folder you will find some annotated files: webpack.config.js, a package.json to go with it, and the src folder. These files together can be used to create a bundle using the library. Note you may need to change the paths referenced when you organize your application. To use it, navigate to the root directory and run the following:

  • npm install
  • npm run build

See the Module Bundlers tutorials for more details.

Already using NPM?

If you had previously been using a custom solution to load the library as an NPM package, you may need to revert your own solution to have everything working correctly. It may also be necessary to change any aliases that you have created. If you need any help migrating, please contact support@chartiq.com.

Next Steps: