JSFiddle - React, Tailwind, and code Playground
by Joanna Sobańska
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
JavaScript
$(function () {
$('#container').highcharts({
chart: {
zoomType: 'xy'
},
title: {
text: 'Volume and number of vessels in ports'
},
subtitle: {
text: 'Click the port to get details'
},
colors:["rgb(37,102,118)", "rgb(114,229,239)", "rgb(47,66,133)", "rgb(202,211,250)", "rgb(34,130,245)", "rgb(48,88,252)","rgb(112,165,193)"],
xAxis: [{
categories: ['Bahia', 'Paranagua', 'Santos', 'Tubarao', 'Barcarena','Necochea'],
crosshair: true
}],
yAxis: [{ // Primary yAxis
labels: {
format: '{value}',
style: {
color: Highcharts.getOptions().colors[1]
}
},
title: {
text: 'Number of vessels',
style: {
color: Highcharts.getOptions().colors[1]
}
}
}, { // Secondary yAxis
title: {
text: 'Tonnage',
style: {
color: Highcharts.getOptions().colors[0]
}
},
labels: {
format: '{value} mt',
style: {
color: Highcharts.getOptions().colors[0]
}
},
opposite: true
}],
tooltip: {
shared: true
},
legend: {
layout: 'vertical',
align: 'left',
x: 120,
verticalAlign: 'top',
y: 100,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
},
series: [{
name: 'volume',
type: 'column',
yAxis: 1,
data: [102,150,131,141,112,120 ],
tooltip: {
valueSuffix: 'mt'
}
},
{
...