Library to manipulate CWP charts, to encode them to files and decode them from files, and to convert them to CBT format.
If you use npm (or alike) to manage dependencies, run
npm install @charwasp/chart-objectto install this library.
Then, you can either use ESM-style import or CommonJS-style require to load the library:
import { Chart } from '@charwasp/chart-object';
const chart = new Chart(0, 2, 1);const { Chart } = require('@charwasp/chart-object');
const chart = new Chart(0, 2, 1);If you want to load the library in a webpage, you can use the self-contained IIFE version
<script src="https://cdn.jsdelivr.net/npm/@charwasp/chart-object@latest/dist/index.iife.min.js"></script>(replace latest with a specific version to avoid breaking changes;
remove the .min to use the unminified version).
After loading this script, the library will be exposed as a global variable CharWasP:
const chart = new CharWasP.Chart(0, 2, 1);You can also use the files in the
dist directory of the
package branch on GitHub to get the library built from the latest commit in the master branch.
Some CDN sources allow you to load files from GitHub, such as jsDelivr:
<script src="https://cdn.jsdelivr.net/gh/charwasp/chart-object@package/dist/index.iife.min.js"></script>There is online documentation.
The doc branch
on GitHub contains the documentation generated from the latest commit in the master branch.
To compile the TypeScript code to JavaScript, run
npm run buildand then the JavaScript code will be in the dist directory.
To run tests, run
npm testThere are also some tests that you can run in a browser.
First build the JavaScript with npm run build, and then
use your favorite web server to host the repo, and then access /test/index.html.
To build the documentation, run
npm run docand then the documentation will be in the doc directory.
AGPL-3.0-or-later.