mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-10 01:23:48 +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) {
|
||||
data.datasets = data.datasets.map((set, i) => {
|
||||
const colorIdx = data.datasets.length - i - 1;
|
||||
const colorIdx = (data.datasets.length - i - 1) % chartColors.length;
|
||||
return {
|
||||
fill: true,
|
||||
backgroundColor: chartColorsBg[colorIdx] ?? chartColorsBg[0],
|
||||
borderColor: chartColors[colorIdx] ?? chartColors[0],
|
||||
pointBackgroundColor: chartColors[colorIdx] ?? chartColors[0],
|
||||
backgroundColor: chartColorsBg[colorIdx],
|
||||
borderColor: chartColors[colorIdx],
|
||||
pointBackgroundColor: chartColors[colorIdx],
|
||||
...set,
|
||||
};
|
||||
});
|
||||
|
@ -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=8"></script>
|
||||
<script src="/static/package_charts.js?v=9"></script>
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user