Improve chart text contrast

Use a brighter shared chart theme and a dark styled tooltip, with high-contrast pie slice labels.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
leanderandCopilot committed 2026-10-22 04:47:27 +02:00
1 parent 65e532be30
commit 64b77217f4
5 files changed
+72 -14

No files matched your search

@@ -4,6 +4,7 @@ import React from "react";
import { OrderStatsDocument, SchemaOrderStatsByTime } from "../../types";
import { StatsView } from "./StatsView";
import { chartTheme } from "./chartTheme";
const days = { 1: "Mandag", 2: "Tirsdag", 3: "Onsdag", 4: "Torsdag", 5: "Fredag", 6: "Lørdag", 7: "Søndag" };
@@ -25,6 +26,7 @@ const months = {
const OrderBar = ({ data }: { data: BarDatum[] }) => (
<Bar
data={data}
theme={chartTheme}
margin={{ left: 60, bottom: 40 }}
width={1200}
height={400}
@@ -5,6 +5,7 @@ import React from "react";
import { AllProductStatsDocument } from "../../types";
import styles from "./Stats.module.css";
import { StatsView } from "./StatsView";
import { chartTheme } from "./chartTheme";
type UserCount = {
name: string;
@@ -31,6 +32,9 @@ const ProductStats = () => {
}))}
width={400}
height={300}
theme={chartTheme}
arcLabelsTextColor="#17121a"
arcLabelsSkipAngle={8}
/>
</div>
))}
+3 -7
View File
@@ -4,6 +4,7 @@ import React from "react";
import { ProductStatsDocument } from "../../types";
import { StatsView } from "./StatsView";
import { chartTheme, chartTooltipStyle } from "./chartTheme";
const Stats = () => {
const { data, loading } = useQuery(ProductStatsDocument);
@@ -21,6 +22,7 @@ const Stats = () => {
<h2>Kjøp over tid</h2>
<Line
data={series}
theme={chartTheme}
width={1000}
height={400}
margin={{ top: 50, right: 110, bottom: 50, left: 60 }}
@@ -47,13 +49,7 @@ const Stats = () => {
useMesh
pointLabelYOffset={0}
tooltip={({ point }) => (
<div
style={{
background: "white",
padding: "9px 12px",
border: "1px solid #ccc",
}}
>
<div style={chartTooltipStyle}>
<div>
<strong>{point.data.xFormatted}</strong>
</div>
+60
View File
@@ -0,0 +1,60 @@
export const chartTheme = {
background: "transparent",
text: {
fill: "#f7effa",
fontFamily: '"IBM Plex Mono", monospace',
fontSize: 13,
textShadow: "none",
},
axis: {
domain: {
line: { stroke: "#b9a3c5", strokeWidth: 1 },
},
ticks: {
line: { stroke: "#b9a3c5", strokeWidth: 1 },
text: { fill: "#f7effa", fontSize: 12, textShadow: "none" },
},
legend: {
text: { fill: "#f7effa", fontSize: 13, textShadow: "none" },
},
},
grid: {
line: { stroke: "rgba(221, 81, 127, 0.24)", strokeWidth: 1 },
},
legends: {
text: { fill: "#f7effa", fontSize: 12, textShadow: "none" },
title: {
text: { fill: "#f7effa", fontSize: 13, textShadow: "none" },
},
},
labels: {
text: {
fill: "#ffffff",
fontSize: 13,
textShadow: "none",
},
},
tooltip: {
container: {
background: "#2b1733",
color: "#ffffff",
fontFamily: '"IBM Plex Mono", monospace',
fontSize: 13,
border: "1px solid #dd517f",
borderRadius: 4,
boxShadow: "0 4px 16px rgba(0, 0, 0, 0.45)",
},
},
};
export const chartTooltipStyle = {
background: "#2b1733",
color: "#ffffff",
padding: "9px 12px",
border: "1px solid #dd517f",
borderRadius: 4,
boxShadow: "0 4px 16px rgba(0, 0, 0, 0.45)",
fontFamily: '"IBM Plex Mono", monospace',
fontSize: 13,
textShadow: "none",
};