This commit is contained in:
@@ -7,22 +7,22 @@
|
||||
'use strict';
|
||||
|
||||
const data = JSON.parse(document.getElementById('chart-data').textContent);
|
||||
const rootStyle = getComputedStyle(document.documentElement);
|
||||
const token = (name, fallback) => rootStyle.getPropertyValue(name).trim() || fallback;
|
||||
|
||||
// 與 design system page-group=analytics 對齊的暖色 palette
|
||||
const chartPalette = {
|
||||
caramel: 'rgba(201, 100, 66, 1)',
|
||||
caramelSoft: 'rgba(201, 100, 66, 0.58)',
|
||||
honey: 'rgba(184, 132, 22, 1)',
|
||||
honeySoft: 'rgba(184, 132, 22, 0.58)',
|
||||
rust: 'rgba(181, 52, 47, 1)',
|
||||
rustSoft: 'rgba(181, 52, 47, 0.48)',
|
||||
mahogany: 'rgba(143, 69, 48, 1)',
|
||||
mahoganySoft: 'rgba(143, 69, 48, 0.12)'
|
||||
caramel: token('--momo-page-chart-2', '#c96442'),
|
||||
caramelSoft: token('--momo-warm-caramel-soft', 'rgba(201, 100, 66, 0.58)'),
|
||||
honey: token('--momo-page-accent', '#c89043'),
|
||||
honeySoft: token('--momo-page-accent-soft', 'rgba(200, 144, 67, 0.14)'),
|
||||
rust: token('--momo-danger-text', '#7a3210'),
|
||||
rustSoft: token('--momo-danger-bg', '#efd3c4')
|
||||
};
|
||||
|
||||
Chart.defaults.color = '#6f665a';
|
||||
Chart.defaults.borderColor = 'rgba(126, 111, 92, 0.18)';
|
||||
Chart.defaults.font.family = "'Noto Sans TC', 'Inter', system-ui, sans-serif";
|
||||
Chart.defaults.color = token('--momo-text-secondary', '#6b6155');
|
||||
Chart.defaults.borderColor = token('--momo-border-light', 'rgba(42, 37, 32, 0.10)');
|
||||
Chart.defaults.font.family = token('--momo-font-family', "'Inter', system-ui, sans-serif");
|
||||
|
||||
// 1) Revenue + YoY
|
||||
new Chart(document.getElementById('revenueChart'), {
|
||||
@@ -70,10 +70,10 @@
|
||||
data: {
|
||||
labels: data.labels,
|
||||
datasets: [{
|
||||
label: '平均客單價 ($)',
|
||||
label: '平均單價 ($)',
|
||||
data: data.aov,
|
||||
borderColor: chartPalette.caramel,
|
||||
backgroundColor: 'rgba(201, 100, 66, 0.12)',
|
||||
backgroundColor: chartPalette.caramelSoft,
|
||||
fill: true, tension: 0.4
|
||||
}]
|
||||
},
|
||||
@@ -92,7 +92,7 @@
|
||||
label: '毛利率 (%)',
|
||||
data: data.margin_rate,
|
||||
borderColor: chartPalette.honey,
|
||||
backgroundColor: 'rgba(184, 132, 22, 0.12)',
|
||||
backgroundColor: chartPalette.honeySoft,
|
||||
fill: true, tension: 0.4
|
||||
}]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user