Overview
The svelte-chartjs is a wrapper for chart.js that allows users to integrate chart components into their Svelte applications. It is open for contributions and pull requests, making it a collaborative and community-driven project.
Features
- Custom Size: Users can customize the size of their charts by setting the maintainAspectRatio property to false.
- Migration from v1 to v2: The library introduces several breaking changes in its v2 version, aiming to improve performance, offer new features, and enhance maintainability.
- Change component import path: Users need to update the import path for components when migrating from v1 to v2.
- Tree-shaking: The v2 version of the library is tree-shakable, similar to Chart.js v3. Users can import and register only the controllers, elements, scales, and plugins they intend to use.
- Chart Examples: The library provides various chart examples, including Bar Chart, Bubble Chart, Doughnut Chart, Line Chart, Pie Chart, PolarArea Chart, Radar Chart, and Scatter Chart.
- ChartJS Instance: Users can access and manipulate the ChartJS instance to handle events and perform other actions.
- Documentation: The library provides documentation and demos for the v1 version.
Installation
To install the svelte-chartjs library, use the following npm command:
npm install svelte-chartjs
The installation also requires peer dependencies. If you need an API to fetch data, you can consider using Cube, an open-source API for data apps.
Summary
The svelte-chartjs library is a Svelte wrapper for chart.js, offering a range of features to integrate customizable charts into Svelte applications. It provides examples, migration guides, and documentation for easy implementation. With its collaborative community approach, the library welcomes contributions and pull requests from users.