DEV Community

Shriji
Shriji

Posted on

5 4

Svelte XKCD chart

The charts library already have vue and react wrappers so it lacked the svelte version of the library.

Introducing chart.xkcd-svelte

All chart examples can be found here

General usage for svelte and check out the REPL

<script>

    import Chart from 'chart.xkcd-svelte';
    import chartXkcd from 'chart.xkcd';

let options = {
        title: 'What people think', // optional
        data: {
            labels: ['work', 'sleep', 'social'],
            datasets: [{
                data: [30, 10, 60],
            }],
        },
        options: { // optional
            innerRadius: 0,
            legendPosition: chartXkcd.config.positionType.upLeft,
        },
    }
let type = "bar";
</script>
<Chart type={type} options={options} />


Enter fullscreen mode Exit fullscreen mode

Thanks to awesome people at svelte's discord I was able to do this ❤️❤️

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay