mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 22:12:24 +01:00
Loop chart colors
This commit is contained in:
parent
72d999e759
commit
c1600b90a6
@ -184,12 +184,12 @@ async function load_data() {
|
|||||||
|
|
||||||
function setup_chart(ctx, data) {
|
function setup_chart(ctx, data) {
|
||||||
data.datasets = data.datasets.map((set, i) => {
|
data.datasets = data.datasets.map((set, i) => {
|
||||||
const colorIdx = data.datasets.length - i - 1;
|
const colorIdx = (data.datasets.length - i - 1) % chartColors.length;
|
||||||
return {
|
return {
|
||||||
fill: true,
|
fill: true,
|
||||||
backgroundColor: chartColorsBg[colorIdx] ?? chartColorsBg[0],
|
backgroundColor: chartColorsBg[colorIdx],
|
||||||
borderColor: chartColors[colorIdx] ?? chartColors[0],
|
borderColor: chartColors[colorIdx],
|
||||||
pointBackgroundColor: chartColors[colorIdx] ?? chartColors[0],
|
pointBackgroundColor: chartColors[colorIdx],
|
||||||
...set,
|
...set,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<script src="/static/libs/chart.min.js"></script>
|
<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-adapter-date-fns.bundle.min.js"></script>
|
||||||
<script src="/static/libs/chartjs-plugin-annotation.min.js"></script>
|
<script src="/static/libs/chartjs-plugin-annotation.min.js"></script>
|
||||||
<script src="/static/package_charts.js?v=8"></script>
|
<script src="/static/package_charts.js?v=9"></script>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user