javascript - How to call Highcharts tooltip formatter function from outside the config object? -


so have interesting problem.

here formatter function inside of chart config object:

in highcharts controller

vm.config = {     options: {         ....         chart: {             ....         },         navigator: {             ....         },         tooltip: {             shared: true,             usehtml: true,             backgroundcolor: null,             borderwidth: 0,             shadow: false,             formatter: function(tooltipobj) {                 return formattooltip(tooltipobj, this.points);             }         },         .... 

i love able call formattooltip function place in app. however, 1) how do that? , 2) how pass in tooltipobj?

for example inside of alertfactory want mouseover event happens when user hovers on plotband, send more information tooltip:

in alertsfactory

var formatplotband = _.curry((color, alert) => {     return {         color : color,          : alert.start_epoch * 1000,            : alert.end_epoch * 1000,         id    :'alert-plotband',         events: {             mouseover: function (e) {                 /*                     somehow here call formattooltip function                     in highcharts controller.                 */             },             mouseout: function (e) {                 .... 

var formatplotband = _.curry((color, alert) => { return {     color : color,      : alert.start_epoch * 1000,        : alert.end_epoch * 1000,     id    :'alert-plotband',     events: {         mouseover: function (e) {             vm.config.options.tooltip.formatter(tooltipobj);             chart.tooltip.refresh([chart.series[0].points[i]])         },         mouseout: function (e) {             .... 

i don't know if vm you're calling chart replace chart in code whatever variable name you're using.


Comments