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: {
type: 'spline'
},
title: {
text: 'Number of arrived vessels in Bahia Port'
},
subtitle: {
text: "OCTOBER 2016"
},
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: {
type: 'datetime',
dateTimeLabelFormats: { // don't display the dummy year
month: '%e. %b',
year: '%b'
},
title: {
text: 'Date'
}
},
yAxis: [{
title: {
text: 'number of vessels'
},
min: 0
}, { // Secondary yAxis
title: {
text: 'Volume',
style: {
color: Highcharts.getOptions().colors[0]
}
},
labels: {
format: '{value} mt',
style: {
color: Highcharts.getOptions().colors[0]
}
},
opposite: true
}],
tooltip: {
headerFormat: '<b>{series.name}</b><br>',
pointFormat: '{point.x:%e. %b}: {point.y:.2f} m'
},
plotOptions: {
spline: {
marker: {
enabled: true
}
}
},
series: [{
name: 'Bahia Blanca',
// Define the data points. All series have a dummy year
// of 1970/71 in order to be compared on the same x axis. Note
// that in JavaScript, monthsSnow depth at Vikjafjellet, Norway start at 0 for January, 1 for February etc.
data: [
[Date.UTC(2016, 9,1),112],
[Date.UTC(2016, 9, 2),127],
[Date.UTC(2016, 9, 3),148],
...