JSFiddle - React, Tailwind, and code Playground
by avrelian
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container"></div>
CSS
#container {
min-width: 310px;
max-width: 800px;
height: 400px;
margin: 0 auto
}
JavaScript
Highcharts.setOptions({
lang: {
months: ['января', 'февраля', 'мартя', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря']
}
});
Highcharts.chart('container', {
chart: {
type: 'spline',
zoomType: 'xy',
},
title: {
text: 'График эффективности'
},
yAxis: [
{
lineWidth: 1,
title: {
text: 'Клики'
}
},
{
lineWidth: 1,
opposite: true,
title: {
text: 'Затраты, руб.'
}
},
{
lineWidth: 1,
opposite: true,
title: {
text: 'CTR, %'
}
}
],
legend: {
layout: 'horizontal',
align: 'left',
verticalAlign: 'top',
y: 25
},
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
day: '%Y-%m-%d'
}
},
plotOptions: {
series: {
pointStart: Date.UTC(2010, 1, 5),
pointInterval: 24 * 3600 * 1000, // one day
tooltip: {
dateTimeLabelFormats: {
millisecond:"%A, %b %e, %H:%M:%S.%L",
second:"%A, %b %e, %H:%M:%S",
minute:"%A, %b %e, %H:%M",
hour:"%A, %b %e, %H:%M",
day:"%e %B %Y",
week:"Week from %A, %b %e, %Y",
month:"%B %Y",
year:"%Y"
}
}
},
spline: {
lineWidth: 4,
states: {
hover: {
lineWidth: 5
}
},
marker: {
enabled: false
},
}
},
series: [{
name: 'Клики',
data: [null, null, 57177, 69658, 97031, 119931, 137133, 154175]
}, {
name: 'Затраты',
data: [24916, 24064, 29742, null, 32490, 30282, 38121, 40434]
...