"fancier" graph

This commit is contained in:
furo 2021-11-05 14:00:44 +01:00
parent 220734819b
commit 02da36ef6e

View File

@ -140,7 +140,12 @@
<script> <script>
const ctx = document.getElementById("chart").getContext("2d"); const ctx = document.getElementById("chart").getContext("2d");
const graph = {{ data.graphMap | dump | safe }} const graph = {{ data.graphMap | dump | safe }}
const map = "{{ map.map | safe }}"
Chart.defaults.global.defaultFontFamily = "Manrope Regular"
Chart.defaults.global.defaultFontColor = "#9090AF"
console.log(Chart.defaults)
const myChart = new Chart(ctx, { const myChart = new Chart(ctx, {
type: 'line', type: 'line',
options: { options: {
@ -154,10 +159,24 @@
}, },
scales: { scales: {
xAxes: [{ xAxes: [{
gridLines: {
display: true,
color: "#50506F"
},
type: 'time', type: 'time',
time: { time: {
unit: 'year' unit: 'year'
} }
}],
yAxes: [{
gridLines: {
display: true,
color: "#50506F"
},
scaleLabel: {
display: true,
labelString: 'Time (seconds)'
}
}] }]
}, },
elements: { elements: {
@ -167,18 +186,15 @@
line: { line: {
fill: false fill: false
} }
} },
}, },
data: { data: {
datasets: [{ datasets: [{
label: '{{ map.map }}', label: map,
data: graph, data: graph,
color: [ color: [
'#EE588F' '#EE588F'
], ],
backgroundColor: [
'rgba(0, 0, 0, 0)'
],
borderColor: [ borderColor: [
'#FBA7C6' '#FBA7C6'
], ],