Files
lofyerandfactory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> 71db82393a Initial commit
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-07-13 15:38:41 +08:00

35 lines
1.0 KiB
HTML

{# 图表通用常量 + i18n 词典 #}
<script>
const COLORS = {
primary: '#2563eb',
primaryLight: '#93bbfd',
success: '#059669',
warning: '#d97706',
danger: '#dc2626',
gray: '#d1d5db',
grayDark: '#6b7280',
cluster_good: '#2563eb',
cluster_weak: '#f59e0b',
level1: '#ef4444',
level2: '#f59e0b',
level3: '#3b82f6',
level4: '#10b981',
};
// ECharts i18n bundle (injected from Python via Jinja)
const I18N = {{ ec_i18n | tojson }};
const LANG = '{{ lang | default("zh") }}';
// helper:维度名翻译(中文 key → 当前 lang 显示值)
const DIM_T = {{ dim_translation_map | tojson }};
const SUB_T = {{ sub_translation_map | tojson }};
function tDim(name) { return DIM_T[name] || name; }
function tSub(name) { return SUB_T[name] || name; }
// 短名(去掉"力"等后缀)—— 中文版才简化,英文不变
function shortDim(name) {
var n = tDim(name);
if (LANG === 'zh') return n.replace('力', '').replace('教育', '');
return n;
}
</script>