Skip to content

Commit b05e06b

Browse files
Allow bar graphs vs line graphs #111
2 parents f1bc3b6 + 0554a01 commit b05e06b

File tree

9 files changed

+45
-9
lines changed

9 files changed

+45
-9
lines changed

dsmr_frontend/templates/dsmr_frontend/archive.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@
269269
datasets: [{
270270
data: electricity1,
271271
label: "{% trans 'Electricity 1 (low tariff)' %}",
272-
fillColor: "rgba(255,255,255,0.2)",
272+
fillColor: "rgba(160,0,0,0.1)",
273273
strokeColor: "rgba(160,0,0,1)",
274274
pointColor: "rgba(160,0,0,1)",
275275
pointStrokeColor: "#fff",
@@ -278,7 +278,7 @@
278278
}, {
279279
data: electricity2,
280280
label: "{% trans 'Electricity 2 (high tariff)' %}",
281-
fillColor: "rgba(255,255,255,0.2)",
281+
fillColor: "rgba(255,0,0,0.1)",
282282
strokeColor: "rgba(255,0,0,1)",
283283
pointColor: "rgba(255,0,0,1)",
284284
pointStrokeColor: "#fff",
@@ -306,7 +306,7 @@
306306
datasets: [{
307307
data: electricity1_returned,
308308
label: "{% trans 'Electricity 1 returned (low tariff)' %}",
309-
fillColor: "rgba(255,255,255,0.2)",
309+
fillColor: "rgba(200,200,100,0.1)",
310310
strokeColor: "rgba(200,200,100,1)",
311311
pointColor: "rgba(200,200,100,1)",
312312
pointStrokeColor: "#fff",
@@ -315,7 +315,7 @@
315315
}, {
316316
data: electricity2_returned,
317317
label: "{% trans 'Electricity 1 returned (high tariff)' %}",
318-
fillColor: "rgba(255,255,255,0.2)",
318+
fillColor: "rgba(39,194,76,0.1)",
319319
strokeColor: "rgba(39,194,76,1)",
320320
pointColor: "rgba(39,194,76,1)",
321321
pointStrokeColor: "#fff",
@@ -343,7 +343,7 @@
343343
datasets: [{
344344
data: gas,
345345
label: "{% trans 'Gas' %}",
346-
fillColor: "rgba(255,255,255,0.2)",
346+
fillColor: "rgba(250,133,0,0.1)",
347347
strokeColor: "rgba(250,133,0,1)",
348348
pointColor: "rgba(250,133,0,1)",
349349
pointStrokeColor: "#fff",

dsmr_frontend/templates/dsmr_frontend/dashboard.html

+10-4
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@
106106
<div class="panel">
107107
<header class="panel-heading">
108108
{{ consumption.day }}
109+
110+
<small class="pull-right">
111+
<a href="{% url 'admin:dsmr_stats_note_add' %}?day={% now 'd-m-Y' %}">
112+
<span class="badge bg-green"><i class="fa fa-plus"></i> &nbsp; {% trans "Add note for today" %}</span>
113+
</a>
114+
</small>
109115
</header>
110116
<div class="panel-body">
111117
<table class="table table-condensed">
@@ -254,7 +260,7 @@
254260
datasets: [{
255261
data: {{ electricity_y|safe }},
256262
label: "{% trans 'Electricity' %}",
257-
fillColor: "rgba(255,255,255,0.2)",
263+
fillColor: "rgba(255,0,0,0.1)",
258264
strokeColor: "rgba(255,0,0,1)",
259265
pointColor: "rgba(255,0,0,1)",
260266
pointStrokeColor: "#fff",
@@ -277,7 +283,7 @@
277283
datasets: [{
278284
data: {{ electricity_returned_y|safe }},
279285
label: "{% trans 'Electricity returned' %}",
280-
fillColor: "rgba(255,255,255,0.2)",
286+
fillColor: "rgba(0,255,0,0.1)",
281287
strokeColor: "rgba(39,194,76,1)",
282288
pointColor: "rgba(39,194,76,1)",
283289
pointStrokeColor: "#fff",
@@ -300,7 +306,7 @@
300306
datasets: [{
301307
data: {{ gas_y|safe }},
302308
label: "{% trans 'Gas' %}",
303-
fillColor: "rgba(255,255,255,0.2)",
309+
fillColor: "rgba(250,133,0,0.1)",
304310
strokeColor: "rgba(250,133,0,1)",
305311
pointColor: "rgba(250,133,0,1)",
306312
pointStrokeColor: "#fff",
@@ -323,7 +329,7 @@
323329
datasets: [{
324330
data: {{ temperature_y|safe }},
325331
label: "{% trans 'Temperature' %}",
326-
fillColor: "rgba(255,255,255,0.2)",
332+
fillColor: "rgba(35,183,229,0.1)",
327333
strokeColor: "rgba(35,183,229,1)",
328334
pointColor: "rgba(35,183,229,1)",
329335
pointStrokeColor: "#fff",

dsmr_frontend/templates/dsmr_frontend/fragments/archive-xhr-statistics.html

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
<div class="panel">
66
<header class="panel-heading">
77
{{ title|unlocalize }}
8+
9+
{% if selected_level == 'days' %}
10+
<small class="pull-right">
11+
<a href="{% url 'admin:dsmr_stats_note_add' %}?day={{ selected_datetime|date:django_date_format }}">
12+
<span class="badge bg-green"><i class="fa fa-plus"></i> &nbsp; {% trans "Add note for this date" %}</span>
13+
</a>
14+
</small>
15+
{% endif %}
816
</header>
917
<div class="panel-body">
1018
<table class="table table-condensed">

dsmr_frontend/views/archive.py

+3
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ def get_context_data(self, **kwargs):
7272

7373
context_data['notes'] = Note.objects.filter(day=selected_datetime.date())
7474

75+
context_data['selected_level'] = selected_level
76+
context_data['selected_datetime'] = selected_datetime
77+
context_data['django_date_format'] = 'DJANGO_DATE_FORMAT'
7578
return context_data
7679

7780

dsmr_stats/admin.py

+9
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,12 @@ class NoteAdmin(admin.ModelAdmin):
1111
formfield_overrides = {
1212
models.CharField: {'widget': widgets.Textarea},
1313
}
14+
15+
def get_form(self, request, obj=None, **kwargs):
16+
form = super(NoteAdmin, self).get_form(request, obj, **kwargs)
17+
day = request.GET.get('day')
18+
19+
if day:
20+
form.base_fields['day'].initial = day
21+
22+
return form

dsmrreader/formats/en/formats.py

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
DSMR_DATEPICKER_LOCALE_FORMAT = 'mm/dd/yyyy'
88
DSMR_DATEPICKER_DATE_FORMAT = 'm/d/Y'
99
DSMR_DATEPICKER_MONTH = 'F Y'
10+
11+
DJANGO_DATE_FORMAT = 'Y-m-d'

dsmrreader/formats/nl/formats.py

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
DSMR_DATEPICKER_LOCALE_FORMAT = 'dd-mm-yyyy'
88
DSMR_DATEPICKER_DATE_FORMAT = 'd-m-Y'
99
DSMR_DATEPICKER_MONTH = 'F Y'
10+
11+
DJANGO_DATE_FORMAT = 'd-m-Y'
137 Bytes
Binary file not shown.

dsmrreader/locales/nl/LC_MESSAGES/django.po

+6
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,9 @@ msgstr "Kosten"
381381
msgid "Total"
382382
msgstr "Totaal"
383383

384+
msgid "Add note for today"
385+
msgstr "Voeg notitie toe voor vandaag"
386+
384387
msgid "Recent electricity consumed (watt)"
385388
msgstr "Recent elektriciteitsverbruik (Watt)"
386389

@@ -399,6 +402,9 @@ msgstr "Elektriciteit"
399402
msgid "Temperature"
400403
msgstr "Temperatuur"
401404

405+
msgid "Add note for this date"
406+
msgstr "Voeg notitie toe voor deze datum"
407+
402408
msgid "Deploy"
403409
msgstr "Uitrollen"
404410

0 commit comments

Comments
 (0)