81 lines
2.3 KiB
JavaScript
81 lines
2.3 KiB
JavaScript
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": unit
|
|
}],
|
|
"balloon": {
|
|
"borderThickness": 1,
|
|
"shadowAlpha": 10,
|
|
},
|
|
"graphs": [{
|
|
"id": "g1",
|
|
"balloon":{
|
|
"drop":false,
|
|
"adjustBorderColor":false,
|
|
"color":"#ffffff",
|
|
},
|
|
"bullet": "round",
|
|
"bulletBorderAlpha": 1,
|
|
"bulletColor": "#000000",
|
|
"bulletSize": 5,
|
|
"hideBulletsCount": 50,
|
|
"lineThickness": 2,
|
|
// "title": unit,
|
|
//"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
|
|
});
|
|
}
|