Highcharts Demo
author(s): Torstein Hønsi
by AlexLvovsky
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<div id="container" style="height: 400px"></div>
<div id="report"></div>
CSS
.testIcon {
font-family: 'Glyphicons Halflings';
}
.testIcon::before {
content: '/e015';
}
JavaScript
// create the chart
Highcharts.chart('container', {
chart: {
events: {
selection: function(event) {
event.preventDefault();
removeButtons();
const axis = event.xAxis[0].axis;
axis.removePlotBand('selection-plot-band');
axis.addPlotBand({
color: Highcharts.Color('#335cad').setOpacity(0.25).get(),
from: event.xAxis[0].min,
to: event.xAxis[0].max,
id: 'selection-plot-band',
zIndex: 6
});
Highcharts.applyzoombutton = this.renderer.g()
.attr({
zIndex: 25
})
.add(),
buttonApply = this.renderer.button('Apply Zoom', null, null, function() {
// some action
}, {
// zIndex: 20
}, null, null)
.add(Highcharts.applyzoombutton)
.align({
align: 'left',
x: calculateButtonPosition(event, 'apply'),
y: event.target.mouseDownY
}, false, null)
.attr({
id: 'applyzoombutton'
}),
buttonIcon = this.renderer.circle(calculateButtonPosition(event, 'apply') + 40, event.target.mouseDownY + 20, 10)
.attr({
fill: '#FCFFC5',
stroke: 'black',
'stroke-width': 1
})
.add(Highcharts.applyzoombutton);
// .addClass( "testIcon" );
Highcharts.resetzoombutton = this.renderer.button('Reset Zoom', null, null, function() {
removeButtons();
axis.removePlotBand('selection-plot-band');
}, {
zIndex: 20
}, null, null)
.add()
.align({
align: 'left',
x: calculateButtonPosition(event, 'reset'),
y: event.target.mouseDownY
}, false, null)
.attr({
id: 'resetzoombutton'
});
}
},
zoomType: 'x'
},
title: {
text: 'Chart selection demo'
},
subtitle:...