mirror of https://github.com/statping/statping
parent
13816b2b4b
commit
4777b94851
|
@ -1,12 +1,12 @@
|
||||||
{{define; "charts"}}
|
{{define "charts"}}
|
||||||
{{=; .Start}}
|
{{$start := .Start}}
|
||||||
{{=; .End}}
|
{{$end := .End}}
|
||||||
{{ range .Services }}
|
{{ range .Services }}
|
||||||
var ctx_;{{js .Id}} = document.getElementById("service_{{js .Id}}").getContext('2d');
|
var ctx_{{js .Id}} = document.getElementById("service_{{js .Id}}").getContext('2d');
|
||||||
var chartdata_;{{js .Id}} = new Chart(ctx_;{{js .Id}}, {
|
var chartdata_{{js .Id}} = new Chart(ctx_{{js .Id}}, {
|
||||||
'line',
|
type: 'line',
|
||||||
data;: {
|
data: {
|
||||||
[{
|
datasets: [{
|
||||||
label: 'Response Time (Milliseconds)',
|
label: 'Response Time (Milliseconds)',
|
||||||
data: [],
|
data: [],
|
||||||
backgroundColor: ['{{if .Online}}rgba(47, 206, 30, 0.92){{else}}rgb(221, 53, 69){{end}}'],
|
backgroundColor: ['{{if .Online}}rgba(47, 206, 30, 0.92){{else}}rgb(221, 53, 69){{end}}'],
|
||||||
|
@ -14,33 +14,33 @@ var chartdata_;{{js .Id}} = new Chart(ctx_;{{js .Id}}, {
|
||||||
borderWidth: 1
|
borderWidth: 1
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
options: {
|
||||||
false,
|
maintainAspectRatio: false,
|
||||||
scaleShowValues;: false,
|
scaleShowValues: false,
|
||||||
layout;: {
|
layout: {
|
||||||
{
|
padding: {
|
||||||
0,
|
left: 0,
|
||||||
right;: 0,
|
right: 0,
|
||||||
top;: 0,
|
top: 0,
|
||||||
bottom;: -10
|
bottom: -10
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
hover: {
|
||||||
0,
|
animationDuration: 0,
|
||||||
},
|
},
|
||||||
0,
|
responsiveAnimationDuration: 0,
|
||||||
animation;: {
|
animation: {
|
||||||
3500,
|
duration: 3500,
|
||||||
onComplete;: onChartComplete
|
onComplete: onChartComplete
|
||||||
},
|
},
|
||||||
{
|
legend: {
|
||||||
false
|
display: false
|
||||||
},
|
},
|
||||||
{
|
tooltips: {
|
||||||
false
|
enabled: false
|
||||||
},
|
},
|
||||||
{
|
scales: {
|
||||||
[{
|
yAxes: [{
|
||||||
display: false,
|
display: false,
|
||||||
ticks: {
|
ticks: {
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
|
@ -51,7 +51,7 @@ var chartdata_;{{js .Id}} = new Chart(ctx_;{{js .Id}}, {
|
||||||
display: false
|
display: false
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
xAxes;: [{
|
xAxes: [{
|
||||||
type: 'time',
|
type: 'time',
|
||||||
distribution: 'series',
|
distribution: 'series',
|
||||||
autoSkip: false,
|
autoSkip: false,
|
||||||
|
@ -74,14 +74,13 @@ var chartdata_;{{js .Id}} = new Chart(ctx_;{{js .Id}}, {
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
elements: {
|
||||||
{
|
point: {
|
||||||
0
|
radius: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
)
|
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
function onChartComplete(chart) {
|
function onChartComplete(chart) {
|
||||||
|
@ -142,31 +141,6 @@ function onChartComplete(chart) {
|
||||||
|
|
||||||
$( document ).ready(function() {
|
$( document ).ready(function() {
|
||||||
{{ range .Services }}
|
{{ range .Services }}
|
||||||
AjaxChart(chartdata_;
|
AjaxChart(chartdata_{{js .Id}},{{js .Id}},{{$start}},9999999999,"hour");{{end}}
|
||||||
{
|
|
||||||
{
|
|
||||||
js.Id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
{
|
|
||||||
js.Id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
{
|
|
||||||
$start
|
|
||||||
}
|
|
||||||
}
|
|
||||||
,
|
|
||||||
9999999999, "hour";
|
|
||||||
)
|
|
||||||
{
|
|
||||||
{
|
|
||||||
end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
Loading…
Reference in New Issue