Standardize financial chart colors and improve label placement

This commit is contained in:
R524809
2026-08-28 17:41:48 +08:00
parent 7aab3d7134
commit e5c21c6148
7 changed files with 114 additions and 61 deletions
+2 -8
View File
@@ -1,6 +1,6 @@
import { col } from '../csv.js';
import {
PALETTE, FONT, axisCommon, titleStyle, footnote, watermarks,
PALETTE, BRIDGE_COLORS, FONT, axisCommon, titleStyle, footnote, watermarks,
} from '../theme.js';
/**
@@ -13,12 +13,6 @@ import {
* 税率变化单独成项。恒等式 净利率 = 税前利润率 × (1-税率),
* Δ净 = Δ税前×(1-t₁) − 税前₂×Δt,实测闭合误差 0.00pct。
*/
const COLOR = {
total: '#2F5C85', // 首尾锚点
neg: '#C0392B', // 拖累
pos: '#1A9E5C', // 利好
};
export function ppmtBridgeChart(rows, { width, height }) {
const items = col(rows, 'item');
const types = col(rows, 'type');
@@ -92,7 +86,7 @@ export function ppmtBridgeChart(rows, { width, height }) {
barWidth: 51,
data: values.map((v, i) => ({
value: v,
itemStyle: { color: COLOR[types[i]] },
itemStyle: { color: BRIDGE_COLORS[types[i]] },
})),
label: {
show: true,