Power duration curve
S. Schluricke
by Tenobaal
HTML
<head>
<link href='https://fonts.googleapis.com/css?family=Fira Sans' rel='stylesheet'>
</head>
<body>
<div id="chart1" style="height: 400px; margin-top: 1em"></div>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
</body>
<script>
xArr = [ 0.2, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30 ];
yArrTime = [ "04:36:29", "04:40:36", "04:44:36", "04:48:28", "04:52:14", "04:55:54", "04:59:29", "05:02:58", "05:06:22", "05:09:41", "05:12:56"];
yArrRelative = [ 1.009, 1.007, 1.005, 1.004, 1.002, 1, 0.998, 0.996, 0.994, 0.993, 0.991 ];
data =...
CSS
body {
background-color: #1B4152;
}
#chart1 {
margin: 0 auto;
background-color: #1B4152;
}
JavaScript
var convert = function(seconds){
if (seconds >= 60){
return seconds / 60 + ' min'
}
return seconds + ' s'
}
var chartline = function (datas, title, xname, unit, chart_container) {
var colors = ['rgba(235,93,64,1)', '#A3D3CE', '#63C4C6'];
var options = {
chart: {
renderTo: chart_container,
turboThreshold: 10000,
backgroundColor: null,
zoomType: 'xy',
style: {
fontFamily: 'Fira Sans'
}
},
title: {
text: title,
style: {
fontSize: '24px',
color: 'white'
}
},
xAxis: {
type: 'logarithmic',
min: 5,
tickPositions: [1, 5, 10, 30, 60, 120, 240, 600, 1200, 3600].map((v) => Math.log10(v)),
labels: {
formatter: function () {
return convert(this.value)
},
style: {
fontSize: '16px',
color: 'white'
}
}
},
yAxis: {
title: {
enabled: true,
text: 'Power'
},
labels: {
formatter: function () {
return this.value + 'W'
},
enabled: true,
style: {
fontSize: '16px',
color: 'white'
}
},
gridLineColor: '#6f828c'
},
legend: {
enabled: false
},
series: [{
name: 'Rolling power',
type: 'line',
color: 'rgba(100,194,200,1)',
data: data,
tooltip: {
enabled: false
},
}]
};
var chart = new Highcharts.Chart(options);
};
chartline(data, 'CRP', 'time', 'W', 'chart1');