highcharts-vue
highcharts-vue copied to clipboard
Added: HighchartsVue.use for easy registration of features
This PR suggests a much simpler implementation for registering additional Highcharts features, such as exporting, mapChart, and stockChart.
Prior to this PR, the developer had to register the feature like this:
import Highcharts from 'highcharts'
import stockInit from 'highcharts/modules/stock'
stockInit(Highcharts)
However, this doesn't always work, since it sometimes throws an error "TypeError: Cannot read property 'parts/Globals.js' of undefined" as described here...that problem required a (typeof Highcharts === 'object') check, but there's an even simpler way for both you guys and people that use the wrapper. Simply define a "use" property (method) on the wrapper, and let that method handle everything. This results in extremely simple code that's easy to maintain (and less docs to update):
import Vue from 'vue'
import HighchartsVue from 'highcharts-vue' // So, people were already doing this...
import { mapData } from 'js/worldmap'
// Just tell HighchartsVue what features to use:
HighchartsVue.use('exporting')
HighchartsVue.use('stockChart')
HighchartsVue.use('mapChart', { mapName: 'myMapName', mapData })
Easy!
---
Also: the linter required some updating just so I could get the linter to pass
hi richard, do you know how to enable stock tools or indicators ?
Hi @nicqchen , I think these two links will help:
- https://www.highcharts.com/docs/stock/technical-indicator-series --> links to a bunch of demos*. It seems like the indicators are already predefined types
- https://www.highcharts.com/demo/stock/stock-tools-custom-gui --> shows a gui concept with some functionality (I think it's more conceptual, as I can't seem to get all the buttons to work).