mirror of https://github.com/jumpserver/jumpserver
dashboard
parent
9d44bc1593
commit
cf8af114fe
|
@ -36,8 +36,8 @@ def index(request):
|
||||||
path1, path2 = u'仪表盘', 'Dashboard'
|
path1, path2 = u'仪表盘', 'Dashboard'
|
||||||
dic = {}
|
dic = {}
|
||||||
li_date, li_str = getDaysByNum(7)
|
li_date, li_str = getDaysByNum(7)
|
||||||
li_str = json.dumps(li_str)
|
# li_str = json.dumps(li_str)
|
||||||
print li_str
|
# print li_str, type(li_str)
|
||||||
today = datetime.datetime.now().day
|
today = datetime.datetime.now().day
|
||||||
from_week = datetime.datetime.now() - datetime.timedelta(days=7)
|
from_week = datetime.datetime.now() - datetime.timedelta(days=7)
|
||||||
week_data = Log.objects.filter(start_time__range=[from_week, datetime.datetime.now()])
|
week_data = Log.objects.filter(start_time__range=[from_week, datetime.datetime.now()])
|
||||||
|
|
|
@ -58,13 +58,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>{{ li_str }}</div>
|
|
||||||
<div id="high" style="width:100%;height:400px;"></div>
|
<div id="high" style="width:100%;height:400px;"></div>
|
||||||
|
</br>
|
||||||
|
<div id="dynamic" style="width:100%;height:400px;"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var cate = {{ li_str }};
|
var cate = {{ li_str|safe }};
|
||||||
$(function () {
|
$(function () {
|
||||||
$('#high').highcharts({
|
$('#high').highcharts({
|
||||||
title: {
|
title: {
|
||||||
|
@ -79,7 +80,8 @@ $(function () {
|
||||||
type: 'datetime',
|
type: 'datetime',
|
||||||
categories: cate
|
categories: cate
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis:{
|
||||||
|
min: 0,
|
||||||
title: {
|
title: {
|
||||||
text: '登录次数'
|
text: '登录次数'
|
||||||
},
|
},
|
||||||
|
@ -105,6 +107,83 @@ $(function () {
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
Highcharts.setOptions({
|
||||||
|
global: {
|
||||||
|
useUTC: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var chart;
|
||||||
|
$('#dynamic').highcharts({
|
||||||
|
chart: {
|
||||||
|
type: 'spline',
|
||||||
|
animation: Highcharts.svg, // don't animate in old IE
|
||||||
|
marginRight: 10,
|
||||||
|
events: {
|
||||||
|
load: function() {
|
||||||
|
|
||||||
|
// set up the updating of the chart each second
|
||||||
|
var series = this.series[0];
|
||||||
|
setInterval(function() {
|
||||||
|
var x = (new Date()).getTime(), // current time
|
||||||
|
y = Math.random();
|
||||||
|
series.addPoint([x, y], true, true);
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
text: 'Live random data'
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
type: 'datetime',
|
||||||
|
tickPixelInterval: 150
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
title: {
|
||||||
|
text: 'Value'
|
||||||
|
},
|
||||||
|
plotLines: [{
|
||||||
|
value: 0,
|
||||||
|
width: 1,
|
||||||
|
color: '#808080'
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
formatter: function() {
|
||||||
|
return '<b>'+ this.series.name +'</b><br/>'+
|
||||||
|
Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'<br/>'+
|
||||||
|
Highcharts.numberFormat(this.y, 2);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
enabled: false
|
||||||
|
},
|
||||||
|
exporting: {
|
||||||
|
enabled: false
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
name: 'Random data',
|
||||||
|
data: (function() {
|
||||||
|
// generate an array of random data
|
||||||
|
var data = [],
|
||||||
|
time = (new Date()).getTime(),
|
||||||
|
i;
|
||||||
|
|
||||||
|
for (i = -19; i <= 0; i++) {
|
||||||
|
data.push({
|
||||||
|
x: time + i * 1000,
|
||||||
|
y: Math.random()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
})()
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue