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
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:
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):