rollerverbrauch/app/static/js/main.js

81 lines
2.3 KiB
JavaScript
Raw Normal View History

2016-04-30 06:41:59 +02:00
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,
2016-05-02 06:42:43 +02:00
// "title": unit
2016-04-30 06:41:59 +02:00
}],
"balloon": {
"borderThickness": 1,
2016-05-02 06:42:43 +02:00
"shadowAlpha": 10,
2016-04-30 06:41:59 +02:00
},
"graphs": [{
"id": "g1",
"balloon":{
2016-05-02 07:59:14 +02:00
"drop":false,
2016-04-30 06:41:59 +02:00
"adjustBorderColor":false,
2016-05-02 06:42:43 +02:00
"color":"#ffffff",
2016-04-30 06:41:59 +02:00
},
"bullet": "round",
"bulletBorderAlpha": 1,
"bulletColor": "#000000",
"bulletSize": 5,
"hideBulletsCount": 50,
"lineThickness": 2,
2016-05-02 06:42:43 +02:00
// "title": unit,
2016-04-30 06:41:59 +02:00
//"useLineColorForBulletBorder": true,
"valueField": "value",
"balloonText": "<span style='font-size:18px;'>[[value]] "+unit+"</span>"
}],
"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
});
}