Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added: HighchartsVue.use for easy registration of features #137

Closed

Conversation

richardeschloss
Copy link

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 


@nicqchen
Copy link

nicqchen commented Nov 8, 2020

hi richard, do you know how to enable stock tools or indicators ?

@richardeschloss
Copy link
Author

Hi @nicqchen , I think these two links will help:

@jszuminski jszuminski closed this Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants