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-webcomponent

v1.0.2

Published

Minimal highcharts web component wrapper.

Downloads

257

Readme

Highcharts WebComponent

npm version

Highcharts WebComponent wrapper.

  • Usable with any Framework.
  • Implemented using Lit Element.

Installing

npm install highcharts-webcomponent

If Highcharts is not already installed, get the package with Highcharts:

npm install highcharts highcharts-webcomponent

Demo

Live Example: https://webcomponents.dev/edit/ObQbCXjw2znEukL93AU3

Using

Basic usage example

  1. Import into your project:
import 'highcharts-webcomponent';

OR

<script type="module" src="node_modules/highcharts-webcomponent/build/highcharts-wc.js"></script>
  1. Start using it with any framework
const options = {
  title: {
    text: 'My chart'
  },
  series: [{
    data: [1, 2, 3]
  }]
}
  • LitHTML
html`
<highcharts-chart .options=${options} @load=${this.onChartLoad}>
</highcharts-chart>`
  • Vue
<highcharts-chart :options="options" @load="onChartLoad">
</highcharts-chart>
  • Angular
<highcharts-chart [options]="options" (load)="onChartLoad()">
</highcharts-chart>
  • React
render() {
    return (
        <highcharts-chart ref="chart"></highcharts-chart>
    );
}

// Notice that we added ref attributes for the component.
// This enables us to reference the components in the next step.

componentDidMount() {
    this.refs.chart.options = options;
    this.refs.chart.addEventListener('load', this.onChartLoad);
}
  • AngularJS
<highcharts-chart ng-prop-options="options" ng-on-load="onChartLoad">
</highcharts-chart>

Properties & Events

Properties

| Property | Attribute | Type | Default | Description | |----------------|----------------|--------------------|------------|--------------------------------------------------| | allowChartUpdate | allowChartUpdate | boolean | true | This wrapper uses chart.update() method to apply new optionsto the chart when changing the parent component.This option allow to turn off the updating. | | constructorType | constructorType | 'chart' | 'stockChart' | 'mapChart' | 'ganttChart' | 'chart' | String for constructor method. Official constructors: - 'chart' for Highcharts charts - 'stockChart' for Highstock charts - 'mapChart' for Highmaps charts - 'ganttChart' for Gantt charts | | highcharts | | | | Used to pass the Highcharts instance after modules are initialized.If not set the component will try to get the Highcharts from window. | | immutable | immutable | boolean | false | Reinitialises the chart on prop update (as oppose to chart.update())useful in some cases but slower than a regular update. | | options | | Object | required | Highcharts chart configuration object.Please refer to the Highcharts API documentation. | | updateArgs | | [boolean, boolean, boolean] | [true, true, true] | Array of update()'s function optional arguments.Parameters should be defined in the same order like innative Highcharts function: [redraw, oneToOne, animation]. Here is a more specific description of the parameters. |

Events

| Event | Description | |--------|--------------------------------------------------| | load | Event fired after the chart is created. The detail arg will hold the created chart |