问题
I create a highchart but some functionality is not enable in highchart.
- linear scale button
- log scale button
- zoom button(zoom like when i click zoom button its cover full screen )
like this image
This image has 3 manor buttons.
回答1:
You can add additional buttons to your chart by exporting buttons configuration. To change axis scale, use update method with proper axis type. To apply full screen view, you can toggle some CSS class.
Highcharts.stockChart('container', {
exporting: {
buttons: {
customButton: {
text: 'Linear',
onclick: function() {
this.yAxis[0].update({
type: 'linear'
});
}
},
customButton2: {
text: 'Logarithmic',
onclick: function() {
this.yAxis[0].update({
type: 'logarithmic'
});
}
},
customButton3: {
text: 'Zoom',
onclick: function() {
$('#container').toggleClass('modal');
this.reflow();
}
}
}
},
rangeSelector: {
inputPosition: {
align: 'left'
}
},
series: [{
data: [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
}]
});
Live demo: https://jsfiddle.net/BlackLabel/w5Laobgc/
API Reference:
https://api.highcharts.com/class-reference/Highcharts.Axis#update
https://api.highcharts.com/highstock/exporting.buttons
来源:https://stackoverflow.com/questions/51839509/how-can-highcharts-linear-scale-or-log-scale-button-enabel-and-zoom-in-or-out-fu