Show current prices on webapp (table + graph)

This commit is contained in:
2022-08-21 23:42:25 +02:00
parent 45cbfa6775
commit 0e58cb1142
2 changed files with 45 additions and 2 deletions

View File

@@ -14,6 +14,11 @@
<th>1000-1499 L</th>
<th>500-999 L</th>
</tr>
<tr class="current">
<td colspan="2">Actuellement</td>
<td>{{current_1000}}</td>
<td>{{current_500}}</td>
</tr>
% for x in results:
<tr class="{{day_classes[x.date.weekday()]}}">
<td>{{x.date.strftime('%A')}}</td>
@@ -32,13 +37,44 @@
y: {{ [d.price for d in results] }},
type: 'scatter',
name: '1000-1499 L',
marker: {
color: '#1f77b4',
},
},
{
x: {{ [str(d.date) for d in results if d.price500 is not None] }},
y: {{ [d.price500 for d in results if d.price500 is not None] }},
type: 'scatter',
name: '500-999 L',
}];
marker: {
color: '#ff7f0e',
},
},
{
x: [new Date().toJSON().slice(0, 10)],
y: [{{ current_1000 }}],
type: 'scatter',
name: 'today',
showlegend: false,
mode: 'markers',
marker: {
symbol: 'cross',
color: '#1f77b4',
},
},
{
x: [new Date().toJSON().slice(0, 10)],
y: [{{ current_500 }}],
type: 'scatter',
name: 'today',
showlegend: false,
mode: 'markers',
marker: {
symbol: 'cross',
color: '#ff7f0e',
},
},
];
var plotLayout = {
margin: { t: 0 }
};