Tutorials
Getting started
Chart interface
Web components
Chart internals
Data integration
Customization
Frameworks and bundlers
Mobile development
Trading
Time Span Events
Term structures
ScriptIQ
Troubleshooting
Glossary
Reference
JSFiddles

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.

To install the library

  1. Obtain a copy of the library, and extract the archive (.zip file)

  2. Copy the tarball (chartiq-x.x.x.tgz) to your project folder

    Note: The folder must contain a package.json file.

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

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

Your package.json file should now contain the following dependency:

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

Note: The chartiq dependency does not support version ranges using tilde or caret prefixes. When you upgrade the charting library — including patch releases — you must replace the installed version with the new version. We recommend that you always remove the old version of the chartiq package completely, and then install the new version, for example:

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

Including all necessary files

The ChartIQ library includes a variety of file types: JavaScript files, CSS files, and image files of various kinds.

npm does not provide a way to load assets such as CSS and image files; you need to explicitly load them. You can use any solution you prefer, such as <link> tags, src attributes, or module bundlers such as webpack.

Example webpack configuration

The chartiq folder of your library contains sample webpack configuration files, including webpack.config.js, package.json, and a src folder that contains sample-template-webpack.js and index.html. Together, these files can be used to create a bundle from the ChartIQ library.

To create the example webpack bundle, run the following commands from the chartiq directory of your library:

  • npm install
  • npm run build

See the Module Bundlers tutorial for more details.

Already using npm?

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