Last active
July 3, 2020 17:23
-
-
Save FrancoisCapon/433b759b0626ab7976bee5743b8c61a6 to your computer and use it in GitHub Desktop.
Chart.js for CTF Dashboard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<link href="mini-default.css" rel="stylesheet"> | |
<script src="chart.bundle.min.js"></script> | |
</head> | |
<body> | |
<h1>Chart.js for CTF Dashboard</h1> | |
<canvas id="chartTime" width="2" height="1"></canvas> | |
<script> | |
var ctx = document.getElementById('chartTime').getContext('2d'); | |
Chart.defaults.global.elements.line.tension = 0.1; | |
Chart.defaults.global.elements.line.fill = false; | |
Chart.defaults.global.elements.point.radius = 7.5; | |
Chart.defaults.global.elements.point.hoverRadius = 10; | |
Chart.defaults.global.defaultFontFamily = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', Helvetica, sans-serif"; // copy minicss | |
var chart = new Chart(ctx, { | |
type: 'line', | |
data: { | |
datasets: [{ | |
borderColor: 'red', | |
backgroundColor: 'red', | |
label: 'PlayerOne (∑45)', | |
data: [{ | |
x: new Date(2020, 05, 28, 19, 05), | |
y: 5 | |
}, { | |
x: new Date(2020, 05, 28, 19, 12), | |
y: 25 | |
}, { | |
x: new Date(2020, 05, 28, 19, 43), | |
y: 45 | |
}] | |
}, | |
{ | |
borderColor: 'blue', | |
backgroundColor: 'blue', | |
label: 'PlayerTwo (∑65)', | |
data: [{ | |
x: new Date(2020, 05, 28, 19, 10), | |
y: 10 | |
}, { | |
x: new Date(2020, 05, 28, 19, 20), | |
y: 30 | |
}, { | |
x: new Date(2020, 05, 28, 19, 35), | |
y: 35 | |
}, { | |
x: new Date(2020, 05, 28, 19, 50), | |
y: 65 | |
}] | |
}, | |
], | |
}, | |
options: { | |
scales: { | |
xAxes: [{ | |
type: 'time', | |
time: { | |
unit: 'minute', | |
stepSize: 15, | |
min: new Date(2020, 05, 28, 19, 00), | |
max: new Date(2020, 05, 28, 20, 00), | |
displayFormats: { | |
minute: 'kk:mm' | |
}, | |
tooltipFormat: 'kk:mm', | |
}, | |
scaleLabel: { | |
display: true, | |
labelString: 'Hour' | |
} | |
}], | |
yAxes: [{ | |
ticks: { | |
suggestedMin: 0, | |
suggestedMax: 100 | |
}, | |
scaleLabel: { | |
display: true, | |
labelString: 'Points' | |
} | |
}] | |
}, | |
title: { | |
display: true, | |
text: 'TOP 10' | |
}, | |
legend: { | |
position: 'right' | |
}, | |
tooltips: { | |
titleAlign: 'center', | |
borderColor: '#EEEEEE', | |
borderWidth: 2 | |
}, | |
layout: { | |
padding: 15 | |
} | |
} | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
merci M. pour votre retour on s'en occupe !