Plot prices using plotly

This commit is contained in:
2022-08-06 22:38:08 +02:00
parent 0f35f0ff91
commit 907bb882a4
3 changed files with 91 additions and 4 deletions

View File

@@ -4,6 +4,7 @@
<link rel="stylesheet" href="/static/classless.css">
<link rel="stylesheet" href="/static/fioul.css">
<link rel="icon" type="image/png" href="/static/favicon.png" />
<script src="/static/plotly-2.12.1.min.js"></script>
</head>
<body>
<h1>Prix du m³ de fioul pour Languidic</h1>
@@ -16,5 +17,27 @@
</tr>
% end
</table>
<div id="price-plot"></div>
<script>
var plotDiv = document.getElementById('price-plot');
var plotData = [{
x: {{ [str(d.date) for d in results] }},
y: {{ [d.price for d in results] }},
type: 'scatter',
}];
var plotLayout = {
margin: { t: 0 }
};
var plotConfig = {
responsive: true,
displaylogo: false,
};
Plotly.newPlot(
plotDiv,
plotData,
plotLayout,
plotConfig,
);
</script>
</body>
</html>