Area-spline
author(s): Torstein Hønsi
by Haze32
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<figure class="highcharts-figure">
<div id="container"></div>
<p class="highcharts-description">
This demo shows a smoothed area chart with an x-axis plot band
highlighting an area of interest at the last two points. Plot bands
and plot lines are commonly used to draw attention to certain areas or
thresholds.
</p>
</figure>
CSS
#container {
height: 490px;
}
.highcharts-figure,
.highcharts-data-table table {
min-width: 310px;
max-width: 800px;
margin: 1em auto;
}
.highcharts-data-table table {
font-family: Verdana, sans-serif;
border-collapse: collapse;
border: 1px solid #ebebeb;
margin: 10px auto;
text-align: center;
width: 100%;
max-width: 500px;
}
.highcharts-data-table caption {
padding: 1em 0;
font-size: 1.2em;
color: #555;
}
.highcharts-data-table th {
font-weight: 600;
padding: 0.5em;
}
.highcharts-data-table td,
.highcharts-data-table th,
.highcharts-data-table caption {
padding: 0.5em;
}
.highcharts-data-table thead tr,
.highcharts-data-table tr:nth-child(even) {
background: #f8f8f8;
}
.highcharts-data-table tr:hover {
background: #f1f7ff;
}
JavaScript
Highcharts.chart('container', {
chart: {
height: 460,
backgroundColor: "transparent",
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: "pie",
marginBottom: 160,
animation: false,
events: {
load: function(){
console.log(this.chartWidth);
console.log(this.chartHeight);
console.log(this.container.style.height);
console.log(this.container.style.width);
}
}
},
title: {
text: ''
},
yAxis: {
},
plotOptions: {
pie: {
shadow: false,
innerSize: '75%',
borderWidth: 0
},
series: {
events: {
mouseOut: function() {
this.points[0].onMouseOver();
},
},
point: {
events: {
//disable click
legendItemClick: function() {
return false;
},
mouseOut: function() {
}
}
}
}
},
tooltip: {
enabled: true,
useHTML: true,
borderWidth: 0,
backgroundColor: 'none',
headerFormat: '',
shadow: false,
hideDelay: 999999999, //keeps tooltip displaying in middle
delayForDisplay: 999999999, //keeps tooltip displaying in middle
style: {
fontSize: '55px',
textAlign: 'left',
color: '#000',
fontWeight: '400',
fontFamily: 'Sanomat Web',
},
formatter: function() {
var width = this.series.chart.plotSizeY
return `<div style="width:calc(${width}px - 150px );margin-left:30px;white-space: normal;"><span style="font-size:.7em; font-weight: 500;">${this.y}%</span><br><div style="font-size:16px; line-height: 18px; font-family: Guardian TextSans Web,sans-serif;">${this.point.name}</div></div>`
},
positioner: function(labelWidth, labelHeight) {
return {
x: (this.chart.plotWidth - labelWidth + 40) / 2,
y: (this.chart.plotHeight - labelHeight ) - 165 / 2
};
}
},
legend: {
floating: false,
enabled:...