@542.digital/chart-library
v1.3.13
Published
Consolidation of chart solutions for central management
Readme
@542.digital/chart-library
Chart library is a collection of charting libraries used to create interactive charts.
The chart library exposes the consolidated chart library Javascript bundle to be placed in a <script> tag
on a page as well as plugins which can be used within React.
Libraries Inside
- Highcharts: used to power simple and complex data visualizations.
- Vizzu: used to power animated data visualizations and data stories.
Installation
npm install @542.digital/chart-libraryUsage
To use the consolidated chart library Javascript bundle,
Insert the
postinstall:highchartsscript in thepackage.jsonscripts section of the project.{ "scripts": { "postinstall:highcharts": "cd ./node_modules/@542.digital/chart-library/scripts && ./setup-window-highchart-location.sh" } }This command runs the shell script which copies the combined chart library Javascript files into the current project.
Run the
postinstall:highchartsscript by executing the command:npm run postinstall:highchartsFollow the setup instruction by either using the predefined paths or a custom path.
Reference the copied file in any page using the
<script>tag.
Local Bundling
Local bundling of the chart library is not needed as it is bundled and published in the pipeline. However, you may want to test the bundling in the local environment whenever a change is made.
To create a local bundle,
- Execute
npm run build. This will create a local bundle in the/distfolder. The file name starts withcombinedHighcharts-hvfollowed by the Highchart version number.
Testing
The Cypress test is included as a stage in the pipeline. To run the Cypress test locally,
- Run
nvm useto use the current node version. - Execute
npm run cy:runto launch the test. - If the Highcharts version is upgraded, ensure the
index.htmlfile script reference is also updated. That is, ensure the<script src="./dist/combinedHighcharts-hvX.X.X.js"></script>points to the correct version number represented asX.X.X. Else, there will be errors as the referenced combined Highcharts javascript file won't be found.
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
License
Chart-library is licensed under the MIT License - see the LICENSE file for details.
