My goal is to have a checkbox displayed before each value on the xAxis, and when this checkbox is clicked, it should call my test()
method in Vue. Currently, the test()
method is being called when the buildChart()
method is executed.
buildChart() {
const context = this;
return {
chart: {
height: 500,
type: 'columnrange',
inverted: true,
spacingLeft: 10,
spacingRight: 10,
},
xAxis: {
showEmpty: false,
title: null,
type: 'category',
labels: {
useHTML: true,
formatter() {
// The checkbox is rendered here and should trigger the vue function within the current component context.
return `<input type='checkbox' onchange='${context.test(this.value)}'> ${this.value}`;
},
},
},
};
}
test(value) {
console.log(value);
}