Skip to content

Commit

Permalink
Fix chart colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Dec 10, 2023
1 parent 5e40ff4 commit 84289c1
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
10 changes: 8 additions & 2 deletions interface/components/lineChart.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@
$: data = {
labels: labels,
datasets: [{ label: type, data: statistics, backgroundColor: [color], borderColor: color, tension: 0.3, pointHitRadius: 15 }],
datasets: [{ label: type, data: statistics, backgroundColor: [color], borderColor: color, tension: 0.2, pointHitRadius: 15, borderWidth: 4 }],
}
let options: ChartOptions<"line"> = {
elements: {
point: {
radius: 0,
},
},
animation: {
onProgress: (context) => {
if (context.initial) {
Expand All @@ -37,6 +42,7 @@
return `${value}${unit}`
},
precision: 2,
color: "#969696",
},
min: zero ? 0 : undefined,
},
Expand All @@ -62,7 +68,7 @@
},
},
legend: {
position: "bottom",
display: false,
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion interface/components/loadChart.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
},
y: {
grid: { display: false },
ticks: { display: true, crossAlign: "far" },
ticks: { display: true, crossAlign: "far", color: "#969696" },
},
},
}
Expand Down
17 changes: 15 additions & 2 deletions interface/components/meterChart.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="meterChart{i}">
<div class="meterChart{id}">
<Bar {data} {options} />
</div>

Expand Down Expand Up @@ -92,7 +92,20 @@
},
y: {
grid: { display: false },
ticks: { display: true, crossAlign: "far" },
ticks: {
display: true,
crossAlign: "far",
color: "#969696",
callback: function (value: number) {
const label = this.getLabelForValue(value)
if (label.length > 18) {
return label.slice(0, 18) + "..."
} else {
return label
}
},
},
},
},
}
Expand Down
3 changes: 2 additions & 1 deletion interface/components/multiLineChart.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
scales: {
y: {
ticks: {
color: "#969696",
callback: (value) => {
return `${value} ${unit}`
},
Expand Down Expand Up @@ -96,7 +97,7 @@
},
},
legend: {
position: "bottom",
display: false,
},
},
}
Expand Down
3 changes: 2 additions & 1 deletion interface/components/usageChart.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
return `${value}${unit}`
},
stepSize: 10,
color: "#969696",
},
},
x: {
Expand All @@ -70,7 +71,7 @@
},
},
legend: {
position: "bottom",
display: false,
},
},
}
Expand Down

0 comments on commit 84289c1

Please sign in to comment.