From 60293d6a2737d1fb4921bae52c2320acfc652736 Mon Sep 17 00:00:00 2001 From: Joachim Lusiardi Date: Thu, 28 Apr 2016 07:53:53 +0200 Subject: [PATCH 1/6] Demo Chart --- app/rollerverbrauch/templates/statistics.html | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/app/rollerverbrauch/templates/statistics.html b/app/rollerverbrauch/templates/statistics.html index 9fd7b0f..417b583 100644 --- a/app/rollerverbrauch/templates/statistics.html +++ b/app/rollerverbrauch/templates/statistics.html @@ -58,5 +58,102 @@ }); +
+ + + + + {% endblock %} From ef976299dcecbfcea6bdc2d9891f37042ac391bc Mon Sep 17 00:00:00 2001 From: Joachim Lusiardi Date: Thu, 28 Apr 2016 22:33:14 +0200 Subject: [PATCH 2/6] Fix PEP8 error --- app/rollerverbrauch/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/rollerverbrauch/__init__.py b/app/rollerverbrauch/__init__.py index 495ab17..664e15d 100644 --- a/app/rollerverbrauch/__init__.py +++ b/app/rollerverbrauch/__init__.py @@ -179,7 +179,7 @@ def create_pit_stop_form(vid): form.litres.default = last_pitstop.litres form.date.default = date.today() form.process() - return render_template('newPitStopForm.html', form=form, vehicle = vehicle) + return render_template('newPitStopForm.html', form=form, vehicle=vehicle) @app.route('/pitstops', methods=['GET']) From 161cc16498a6fb1de50a9b4045d6efcb54545d70 Mon Sep 17 00:00:00 2001 From: Joachim Lusiardi Date: Sat, 30 Apr 2016 06:41:59 +0200 Subject: [PATCH 3/6] continued work ok charts --- app/rollerverbrauch/static/main.js | 81 ++++++++++- app/rollerverbrauch/templates/layout.html | 1 + app/rollerverbrauch/templates/statistics.html | 129 ++++++------------ app/rollerverbrauch/tools.py | 1 + 4 files changed, 125 insertions(+), 87 deletions(-) diff --git a/app/rollerverbrauch/static/main.js b/app/rollerverbrauch/static/main.js index 8b13789..dc9ca89 100644 --- a/app/rollerverbrauch/static/main.js +++ b/app/rollerverbrauch/static/main.js @@ -1 +1,80 @@ - +function createChart(id, data, unit) { + return AmCharts.makeChart(id, { + "type": "serial", + //"theme": "chalk", + //"marginRight": 40, + //"marginLeft": 40, + //"autoMarginOffset": 20, + "mouseWheelZoomEnabled":true, + "dataDateFormat": "YYYY-MM-DD", + "valueAxes": [{ + "id": "v1", + "axisAlpha": 0, + "position": "left", + "ignoreAxisWidth":true, + "title": "Fuelled litres" + }], + "balloon": { + "borderThickness": 1, + "shadowAlpha": 10 + }, + "graphs": [{ + "id": "g1", + "balloon":{ + "drop":true, + "adjustBorderColor":false, + "color":"#ffffff" + }, + "bullet": "round", + "bulletBorderAlpha": 1, + "bulletColor": "#000000", + "bulletSize": 5, + "hideBulletsCount": 50, + "lineThickness": 2, + "title": "Fuelled litres", + //"useLineColorForBulletBorder": true, + "valueField": "value", + "balloonText": "[[value]] "+unit+"" + }], + "chartScrollbar": { + "graph": "g1", + "oppositeAxis":false, + "offset":30, + "scrollbarHeight": 80, + "backgroundAlpha": 0, + "selectedBackgroundAlpha": 0.1, + "selectedBackgroundColor": "#888888", + "graphFillAlpha": 0, + "graphLineAlpha": 0.5, + "selectedGraphFillAlpha": 0, + "selectedGraphLineAlpha": 1, + "autoGridCount":true, + "color":"#AAAAAA" + }, + "chartCursor": { + "pan": true, + "valueLineEnabled": true, + "valueLineBalloonEnabled": true, + "cursorAlpha":1, + "cursorColor":"#258cbb", + "limitToGraph":"g1", + "valueLineAlpha":0.2, + "valueZoomable":true + }, + "valueScrollbar":{ + "oppositeAxis":false, + "offset":50, + "scrollbarHeight":10 + }, + "categoryField": "date", + "categoryAxis": { + "parseDates": true, + "dashLength": 1, +// "minorGridEnabled": true + }, + "export": { + "enabled": true + }, + "dataProvider": data + }); +} diff --git a/app/rollerverbrauch/templates/layout.html b/app/rollerverbrauch/templates/layout.html index e44af45..2f4f726 100644 --- a/app/rollerverbrauch/templates/layout.html +++ b/app/rollerverbrauch/templates/layout.html @@ -94,6 +94,7 @@ +