JSFiddle - React, Tailwind, and code Playground
by ninachroscicka
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<div id="container" style="height: 400px; min-width: 310px; max-width: 600px; margin: 0 auto"></div>
CSS
.highcharts-tooltip h3 {
margin: 0.3em 0;
}
JavaScript
Highcharts.chart('container', {
chart: {
type: 'bubble',
plotBorderWidth: 0,
zoomType: 'xy'
},
legend: {
enabled: false
},
title: {
text: ''
},
subtitle: {
text: ''
},
xAxis: {
gridLineWidth: 0.15,
title: {
text: 'Popularność'
},
labels: {
format: '{value} %'
},
plotLines: [{
color: '#cecece',
dashStyle: "ShortDot",
width: 2,
value: 65,
label: {
rotation: 0,
y: 15,
style: {
fontStyle: 'italic'
}
},
zIndex: 3
}]
},
yAxis: {
startOnTick: false,
endOnTick: false,
title: {
text: 'Występowanie w N '
},
labels: {
format: '{value} %'
},
maxPadding: 0.2,
plotLines: [{
color: '#cecece',
dashStyle: 'dot',
width: 2,
value: 50,
label: {
align: 'right',
style: {
fontStyle: 'italic'
},
x: -10
},
zIndex: 3
}]
},
tooltip: {
useHTML: true,
headerFormat: '<table>',
pointFormat: '<tr><th colspan="2"><h3>{point.name}</h3></th></tr>' +
'<tr><th>Reakcje wyrażone w [%]:</th><td>{point.x}</td></tr>' +
'<tr><th>Popularność wyrażona w [N]:</th><td>{point.y}</td></tr>',
footerFormat: '</table>',
followPointer: true
},
plotOptions: {
plotLines: [{
color: '#cecece'}],
series: {
dataLabels: {
enabled: true,
format: '{point.name}',
color: '#474747',
style: {
textOutline: false,
...