@sveltejs-labs/chart.js

@sveltejs-labs/chart.js logo

Svelte wrapper for chart.js Open for PRs and contributions!

Install

Install this library with peer dependencies:

bun add @sveltejs-labs/chart.js chart.js
# or
pnpm add @sveltejs-labs/chart.js chart.js
# or
yarn add @sveltejs-labs/chart.js chart.js
# or
npm i @sveltejs-labs/chart.js chart.js

Usage

<script>
  import { Line } from '@sveltejs-labs/chart.js'
</script>

<Line data={...} />

Custom Size

In order for Chart.js to obey the custom size you need to set maintainAspectRatio to false, example:

<Line {data} width={100} height={50} options={{ maintainAspectRatio: false }} />

License

Read LICENSE.md

Top categories

Loading Svelte Themes