npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@highcharts/svelte

v1.1.1

Published

A simple & intuitive Svelte wrapper for Highcharts

Downloads

4,550

Readme

@highcharts/svelte

A lightweight Svelte wrapper for Highcharts, making it easy to integrate Highcharts into your Svelte applications. This package allows you to utilize all the powerful features of Highcharts with the minimalistic approach of Svelte.

Features

  • Simple and easy integration of Highcharts with Svelte.
  • Supports all Highcharts variants including chart, stockChart, mapChart, and ganttChart.
  • Supports all the Highcharts options (https://api.highcharts.com/highcharts/)

Installation

You can install @highcharts/svelte using npm:

npm install @highcharts/svelte highcharts --save

Highcharts is a peer dependency of this package, and you need to install it separately.

Usage

The package exports the Chart, StockChart, MapChart, GanttChart components which accepts 6 props: | Prop | Type | Default | Description | |--------------|--------------------------------------------------------------------|------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------| | options | Highcharts.Options | None | The configuration options for the chart. This is a required prop that defines the Highcharts chart options. | | updateArgs | boolean \| Partial<Highcharts.AnimationOptionsObject> | true | Determines how the chart updates when the options object changes. Can be a boolean or an animation settings object to enable/disable animation during update. | | highcharts | typeof Highcharts | Highcharts | Allows passing a custom instance of Highcharts, which is useful if you want to use a specific version of Highcharts or need to load modules that are not included by default. | | callback | (chart: Highcharts.Chart) => void | () => {} | A callback function that is executed after the chart is instantiated. It receives the chart instance as a parameter. | | chart | Highcharts.Chart \| null | null | If you'd like to have access to the chart instance, you can bind your chart object with Svelte's two-way binding here. |

Example

<script lang="ts">
    import Highcharts from 'highcharts';
    import ExportingModule from 'highcharts/modules/exporting';
    import { Chart } from '@highcharts/svelte'; // Chart is also exported by default

    // Applying a certain Highcharts module
    ExportingModule(Highcharts);

    let options = {
        chart: {
            type: 'line'
        },
        title: {
            text: 'My Chart'
        },
        series: [{
            data: [1, 2, 3, 4, 5]
        }]
    };
</script>

<Chart options={options} highcharts={Highcharts}/>

Online examples

  • Options are reactive, chart is automatically updated: https://stackblitz.com/edit/vitejs-vite-fadf42?file=src%2FApp.svelte
  • You can create Highcharts Stock charts: https://stackblitz.com/edit/vitejs-vite-5ctkzx?file=src%2FApp.svelte
  • You can use Highcharts modules (exporting example): https://stackblitz.com/edit/vitejs-vite-hcvilc?file=src%2FApp.svelte
  • You can access chart instance: https://stackblitz.com/edit/vitejs-vite-tu5pos?file=src%2FApp.svelte

Contributing

Contributions are always welcome! Whether it's submitting a bug report, a pull request, or even suggesting a new feature, all contributions are appreciated. Before contributing, please read the project's contribution guidelines.

Support

If you have any issues with @highcharts/svelte, please open an issue on the GitHub repository. If you have a Highcharts-related question, feel free to contact our support team: https://www.highcharts.com/blog/support/

Helpful resources

  • Highcharts API: https://api.highcharts.com/highcharts/
  • Highcharts docs: https://www.highcharts.com/docs/index
  • Highcharts demos: https://www.highcharts.com/demo