feat: 泡泡玛特增加年度、半年数据区分

This commit is contained in:
2026-08-30 14:49:27 +08:00
parent d010b107aa
commit d51890a450
69 changed files with 1109 additions and 258 deletions
+5 -4
View File
@@ -1,5 +1,6 @@
import {
PALETTE, FONT, axisCommon, categoryAxis, titleStyle, LEGEND_ITEM_WIDTH,
financialViewDisclosure, financialViewLabel, shortStandalonePeriod,
barSeries, footnote, watermarks, LAYOUT,
} from '../theme.js';
@@ -38,7 +39,7 @@ const COLORS = {
const LEGEND_WIDTH = 160;
const LEGEND_RIGHT = 20;
export function ppmtIpShareHistoryChart(rows, { width, height }) {
export function ppmtIpShareHistoryChart(rows, { width, height, view = 'all' }) {
const periods = Object.keys(rows[0]).filter((k) => k !== 'ip');
const names = rows.map((r) => r.ip);
const totals = periods.map((p) => rows.reduce((s, r) => s + r[p], 0));
@@ -49,8 +50,8 @@ export function ppmtIpShareHistoryChart(rows, { width, height }) {
backgroundColor: '#fff',
title: {
...titleStyle,
text: '泡泡玛特各IP半年收入占比(21H1-26H1)',
subtext: '占当期IP收入合计的比重;H2 为下半年单期,非全年累计',
text: `泡泡玛特各IP收入占比(${financialViewLabel(view)})`,
subtext: ['占当期IP收入合计的比重;H2为下半年单期,非全年累计', financialViewDisclosure(view)].filter(Boolean).join('\n'),
},
legend: {
orient: 'vertical',
@@ -89,7 +90,7 @@ export function ppmtIpShareHistoryChart(rows, { width, height }) {
...categoryAxis,
data: periods,
// 只去世纪前缀:这张表的 H2 是单半年,不能简写成「全年」
axisLabel: { ...categoryAxis.axisLabel, formatter: (v) => v.replace(/^20/, '') },
axisLabel: { ...categoryAxis.axisLabel, formatter: shortStandalonePeriod },
},
yAxis: {
...axisCommon,