Minimal highcharts web component wrapper.
npm install highcharts-webcomponent

Highcharts WebComponent wrapper.
- Usable with any Framework.
- Implemented using Lit Element.
```
npm install highcharts-webcomponent`
If Highcharts is not already installed, get the package with Highcharts:`
npm install highcharts highcharts-webcomponent
Live Example: https://webcomponents.dev/edit/ObQbCXjw2znEukL93AU3
1. Import into your project:
`js
import 'highcharts-webcomponent';
OR
`
2. Start using it with any framework
`js`
const options = {
title: {
text: 'My chart'
},
series: [{
data: [1, 2, 3]
}]
}`
- LitHTMLjs
html`
- Vue
`html`
- Angular
`html`
- React
`js
render() {
return (
);
}
// 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
`html`
| Property | Attribute | Type | Default | Description |
|----------------|----------------|--------------------|------------|--------------------------------------------------|
| allowChartUpdate | allowChartUpdate | boolean | true | This wrapper uses chart.update() method to apply new optionsconstructorType
to the chart when changing the parent component.
This option allow to turn off the updating. |
| | constructorType | 'chart' | 'stockChart' | 'mapChart' | 'ganttChart' | 'chart' | String for constructor method. Official constructors:highcharts
- 'chart' for Highcharts charts
- 'stockChart' for Highstock charts
- 'mapChart' for Highmaps charts
- 'ganttChart' for Gantt charts |
| | | | | Used to pass the Highcharts instance after modules are initialized.immutable
If not set the component will try to get the Highcharts from window. |
| | immutable | boolean | false | Reinitialises the chart on prop update (as oppose to chart.update())options
useful in some cases but slower than a regular update. |
| | | Object | required | Highcharts chart configuration object.updateArgs
Please refer to the Highcharts API documentation. |
| | | [boolean, boolean, boolean] | [true, true, true] | Array of update()'s function optional arguments.
Parameters should be defined in the same order like in
native Highcharts function: [redraw, oneToOne, animation].
Here is a more specific description of the parameters. |
| Event | Description |
|--------|--------------------------------------------------|
| load | Event fired after the chart is created. The detail` arg will hold the created chart |