改进监控页面样式,增加 chart.js 库文件

This commit is contained in:
virusdefender 2015-08-08 22:40:12 +08:00
parent aad9b305ef
commit e9161e8779
3 changed files with 3544 additions and 35 deletions

View File

@ -1,12 +1,30 @@
require(["jquery", "chart"], function ($, Chart) {
var data2 = {
labels: ["January", "February", "March", "April", "May", "June", "July",
"January", "February", "March", "April", "January", "February", "March", "April"],
datasets: [
{
label: "2222222",
fillColor: "rgba(50,187,205,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: [3, 7, 8, 9, 1, 4, 10, 10, 9, 8, 7, 10, 10, 10, 10]
}
]
};
new Chart($("#waiting-queue-chart").get(0).getContext("2d")).Line(data2);
var data = {
labels: ["January", "February", "March", "April", "May", "June", "July",
"January", "February", "March", "April", "January", "February", "March", "April"],
datasets: [
{
label: "11111111",
fillColor: "rgba(220,220,220,0.2)",
strokeColor: "rgba(220,220,220,1)",
fillColor: "rgba(255,255,255,0.2)",
strokeColor: "rgba(250,68,68,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
@ -15,7 +33,7 @@ require(["jquery", "chart"], function ($, Chart) {
},
{
label: "2222222",
fillColor: "rgba(151,187,205,0.2)",
fillColor: "rgba(50,187,205,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
@ -26,31 +44,37 @@ require(["jquery", "chart"], function ($, Chart) {
]
};
Chart.defaults.global.responsive = true;
var myLineChart = new Chart($("#myChart").get(0).getContext("2d")).Line(data);
new Chart($("#judge-instance-chart").get(0).getContext("2d")).Line(data);
var data1 = [
{
value: 300,
color:"#F7464A",
highlight: "#FF5A5E",
label: "Red"
},
{
value: 50,
color: "#46BFBD",
highlight: "#5AD3D1",
label: "Green"
},
{
value: 100,
color: "#FDB45C",
highlight: "#FFC870",
label: "Yellow"
}
];
var data1 = {
labels: ["January", "February", "March", "April", "May", "June", "July",
"January", "February", "March", "April", "January", "February", "March", "April"],
datasets: [
{
label: "2222222",
fillColor: "rgba(50,187,205,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: [3, 7, 8, 9, 1, 4, 10, 10, 9, 8, 7, 10, 10, 10, 10]
},
{
label: "2222222",
fillColor: "rgba(50,187,205,0.2)",
strokeColor: "rgba(252,214,48,1)",
pointColor: "rgba(252,214,48,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: [30, 70, 58, 49, 19, 44, 100, 100, 89, 88, 77, 50, 80, 66, 100]
}
]
};
Chart.defaults.global.responsive = true;
new Chart($("#c1").get(0).getContext("2d")).Line(data1);
new Chart($("#c1").get(0).getContext("2d")).Pie(data1);
new Chart($("#c2").get(0).getContext("2d")).Pie(data1);
});

3477
static/src/js/lib/chart/Chart.js vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -2,18 +2,26 @@
<h1>服务器监控</h1>
<div>
<h3>判题实例数量</h3>
<div>
<canvas id="myChart" style="min-width:100%;max-height: 300px;"></canvas>
<div style="text-align: center;">判题实例数量变化</div>
<h3>等待判题队列长度</h3>
<div id="waiting-queue">
<canvas class="line-chart" id="waiting-queue-chart"></canvas>
</div>
<div style="width: 50%;float: left;">
<canvas id="c1" width="250" height="125"></canvas>
<div style="text-align: center;">内存</div>
</div>
<div style="width: 50%;float: left;">
<canvas id="c2" width="250" height="125"></canvas>
<div style="text-align: center"> cpu</div>
<div>
<h3>【10.1.24.23 - judge1 】</h3>
<div>
<canvas class="line-chart" id="judge-instance-chart"></canvas>
<div class="chart-description">判题实例数量变化</div>
</div>
<div>
<canvas id="c1" class="line-chart"></canvas>
<div class="chart-description">cpu 和 内存</div>
</div>
</div>
</div>