score:2

first, i would never create a function like s. if you find yourself creating function with arguments like arg1, arg2, arg3, arg4 then something is wrong with your design. ignoring that for a second and answering your question.


highcharts allows you to setup a click event handler for many different components on the plot. you set up these handlers in your plotoptions for that specific component. for instance, if you want to handle a click event on a scatter plot point, you set a handler like this:

   plotoptions: {
        series: {
            point: {
                events: {
                    click: function() {
                        // look at the variable this
                    }
                }
            }
        }
    },

inside the function() the this variable is the item that was clicked on. in the case of a scatter plot point, it is the point object. in this function, you are free to call your s function passing whatever data you want to it queried from the this.

next, if you are creating the close button as a highcharts context button, you would set a click handler on that component. for that handler the this is the chart object.

using this approach you can create a click handler for every component you care about. from those handlers, you call you s function.


Related Query

More Query from same tag