Convert JS code to ES6 module
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

See: http://www.highcharts.com/plugin-registry/single/42/Zero-align%20y-axes

This is a plugin for Highcharts, a charting library. The plugin works by adding a callback to every instance of Highcharts. I'd like to only use it for a specific instance without manipulating every other instance. In other words, it's currently opt-out. I'd like to make it opt-in.

So, I'd like this to be refactored to be an ES6 module that exports an TickPositioner instance that I can use to manually create the callback (currently a part of the plugin).

Will require a codepen/jsfiddle/etc... with the working code and example implementation (page with 2 charts, only 1 showing the plugin working.

Will tip for multiple correct solutions.

Crowdsource coding tasks.

2 Solutions


Here is my version of it where the tick positioner is complete on it own and can be called with the chart to update.

Note that @AjiTae's code has been of help to me...

View Timeline