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 @@ +