mirror of
https://github.com/FAUSheppy/open-web-leaderboard.git
synced 2025-12-06 15:11:35 +01:00
implement on click to round
This commit is contained in:
@@ -32,8 +32,9 @@
|
|||||||
</div>
|
</div>
|
||||||
{% include 'footer.html' %}
|
{% include 'footer.html' %}
|
||||||
<script defer>
|
<script defer>
|
||||||
var canvas = document.getElementById("lineChart").getContext('2d');
|
var canvas = document.getElementById("lineChart")
|
||||||
var historicalRank = new Chart(canvas, {
|
var ctx = canvas.getContext('2d');
|
||||||
|
var historicalRank = new Chart(ctx, {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
data: {
|
data: {
|
||||||
labels: [ {{ CSV_MONTH_YEAR_OF_RATINGS | safe }} ],
|
labels: [ {{ CSV_MONTH_YEAR_OF_RATINGS | safe }} ],
|
||||||
@@ -44,7 +45,7 @@
|
|||||||
borderColor: [ 'rgba(200, 99, 132, .7)' ],
|
borderColor: [ 'rgba(200, 99, 132, .7)' ],
|
||||||
borderWidth: 2
|
borderWidth: 2
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
scales: {
|
scales: {
|
||||||
yAxes: [{
|
yAxes: [{
|
||||||
@@ -75,6 +76,16 @@
|
|||||||
responsive: true
|
responsive: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
var datasetHelper = {{ CSV_TIMESTAMPS | safe }}
|
||||||
|
canvas.onclick = function (evt) {
|
||||||
|
var points = historicalRank.getElementsAtEvent(evt);
|
||||||
|
if(points.length != 1){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var timestampMs = datasetHelper[points[0]._index] / 1000
|
||||||
|
var idString = timestampMs.toString()
|
||||||
|
window.location.href = "/round-info?id=" + idString
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user