Statistics: Rotate annotation and add shadow

This commit is contained in:
rubenwardy 2022-11-11 01:18:31 +00:00
parent 6212b95a4d
commit 292b4f5483
2 changed files with 7 additions and 4 deletions

@ -18,7 +18,7 @@ const chartColors = [
const annotationNov5 = {
type: 'line',
type: "line",
borderColor: annotationColor,
borderWidth: 1,
click: function({chart, element}) {
@ -30,8 +30,11 @@ const annotationNov5 = {
display: true,
position: "end",
color: "#00bc8c",
rotation: "auto",
backgroundShadowColor: "rgba(0, 0, 0, 0.4)",
shadowBlur: 3,
},
scaleID: 'x',
scaleID: "x",
value: "2022-11-05",
};
@ -73,7 +76,7 @@ async function load_data() {
const numberOfDays = Math.round((endDate.valueOf() - startDate.valueOf()) / SECONDS_IN_A_DAY) + 1;
const dates = [...Array(numberOfDays)].map((_, i) => {
const date = new Date(startDate.valueOf() + i*SECONDS_IN_A_DAY);
return date.toISOString().split('T')[0];
return date.toISOString().split("T")[0];
});
const total7 = sum(json.platform_minetest.slice(-7)) + sum(json.platform_other.slice(-7));

@ -2,7 +2,7 @@
<script src="/static/libs/chart.min.js"></script>
<script src="/static/libs/chartjs-adapter-date-fns.bundle.min.js"></script>
<script src="/static/libs/chartjs-plugin-annotation.min.js"></script>
<script src="/static/package_charts.js?v=7"></script>
<script src="/static/package_charts.js?v=8"></script>
{% endmacro %}