feat: 增加图片合并功能

This commit is contained in:
R524809
2026-09-09 15:31:05 +08:00
parent bab02e1efd
commit 2a38778fa3
57 changed files with 684 additions and 50 deletions
+1 -1
View File
@@ -168,7 +168,7 @@ export function brkHoldingsChart(rows, { width, height }) {
})),
graphic: [
...watermarks(width, height),
footnote('绿色=相对上一年新增;红色=相对上一年清仓;蓝色深浅=相对持股数量 | @思考的Joey'),
footnote('绿色=相对上一年新增;红色=相对上一年清仓;蓝色深浅=相对持股数量 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -72,7 +72,7 @@ export function growthChart(rows, { width, height }) {
],
graphic: [
...watermarks(width, height),
footnote('示例数据 | @思考的Joey'),
footnote('示例数据 | @Joey知行记'),
],
};
}
+5 -1
View File
@@ -26,7 +26,7 @@ import { workingCapitalDaysChart } from './ppmt_working_capital_days.js';
import { expenseStructureChart } from './ppmt_expense_structure.js';
import { channelRevenueChart } from './ppmt_channel_revenue.js';
import { channelShareChart } from './ppmt_channel_share.js';
import { makeRegionChannelShareChart } from './ppmt_channel_share_region.js';
import { makeRegionChannelShareChart, makeRegionChannelAmountChart } from './ppmt_channel_share_region.js';
import { storesRetailChart } from './ppmt_stores_retail.js';
import { storesRobotChart } from './ppmt_stores_robot.js';
import { regionShareChart } from './ppmt_region_share.js';
@@ -70,6 +70,10 @@ export const chartRegistry = {
'ppmt-channel-share-apac': makeRegionChannelShareChart('apac'),
'ppmt-channel-share-americas': makeRegionChannelShareChart('americas'),
'ppmt-channel-share-europe': makeRegionChannelShareChart('europe'),
'ppmt-channel-amount-china': makeRegionChannelAmountChart('china'),
'ppmt-channel-amount-apac': makeRegionChannelAmountChart('apac'),
'ppmt-channel-amount-americas': makeRegionChannelAmountChart('americas'),
'ppmt-channel-amount-europe': makeRegionChannelAmountChart('europe'),
'ppmt-stores-retail': storesRetailChart,
'ppmt-stores-robot': storesRobotChart,
'ppmt-region-share': regionShareChart,
+1 -1
View File
@@ -103,7 +103,7 @@ export function inventoryChart(rows, { width, height }) {
...watermarks(width, height),
footnote(
'周转天数=平均存货÷当期销售成本×期间天数(半年181/年度365,期初=上一年末,日历天数口径);' +
'与公司披露一致:23年133/24年102/25年123/26H1 201天 | @思考的Joey'
'与公司披露一致:23年133/24年102/25年123/26H1 201天 | @Joey知行记'
),
],
};
+1 -1
View File
@@ -74,7 +74,7 @@ export function marginChart(rows, { width, height }) {
],
graphic: [
...watermarks(width, height),
footnote('示例数据 | @思考的Joey'),
footnote('示例数据 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -105,7 +105,7 @@ export function assetsChart(rows, { width, height, view = 'all' }) {
],
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特财报 | @思考的Joey'),
footnote('数据来源:泡泡玛特财报 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -109,7 +109,7 @@ export function ppmtBridgeChart(rows, { width, height }) {
...watermarks(width, height),
footnote(
'各项为占营收百分点,已折算为对净利率影响(×税盾系数)\n' +
'其他收益净额:26H1净损失6.89亿,主要为汇兑损失7.20亿(25H1为汇兑收益1.20亿) | @思考的Joey'
'其他收益净额:26H1净损失6.89亿,主要为汇兑损失7.20亿(25H1为汇兑收益1.20亿) | @Joey知行记'
),
],
};
+1 -1
View File
@@ -89,7 +89,7 @@ export function cashConversionChart(rows, { width, height, view = 'all' }) {
],
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特合并现金流量表、利润表;H2为单独半年 | @思考的Joey'),
footnote('数据来源:泡泡玛特合并现金流量表、利润表;H2为单独半年 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -57,7 +57,7 @@ export function cashflowCompositionChart(rows, { width, height, view = 'all' })
],
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特合并现金流量表;H2为单独半年 | @思考的Joey'),
footnote('数据来源:泡泡玛特合并现金流量表;H2为单独半年 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -122,7 +122,7 @@ export function categoryChart(rows, { width, height, view = 'all' }) {
],
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特财报 | @思考的Joey'),
footnote('数据来源:泡泡玛特财报 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -170,7 +170,7 @@ export function channelRevenueChart(rows, { width, height, view = 'all' }) {
],
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特营收构成表;渠道口径按财报披露 | @思考的Joey'),
footnote('数据来源:泡泡玛特营收构成表;渠道口径按财报披露 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -74,7 +74,7 @@ export function channelShareChart(rows, { width, height, view = 'all' }) {
})),
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特分地区渠道收入披露(中国含港澳台);H2为单半年(全年−H1)\n线上渠道含抽盒机、天猫、抖音、自研APP及官网等 | @思考的Joey'),
footnote('数据来源:泡泡玛特分地区渠道收入披露(中国含港澳台);H2为单半年(全年−H1)\n线上渠道含抽盒机、天猫、抖音、自研APP及官网等 | @Joey知行记'),
],
};
}
+87 -4
View File
@@ -28,28 +28,111 @@ const REGIONS = {
title: '中国区',
source: '中国(含港澳台)',
series: ['retail', 'robot_store', 'roboshop', 'tmall', 'douyin', 'online_other', 'wholesale'],
footnote: '数据来源:泡泡玛特中国区(含港澳台)分渠道收入披露;H2为单半年(全年−H1)\n线上渠道按财报披露拆分为抽盒机、天猫旗舰店、抖音平台与其他线上 | @思考的Joey',
footnote: '数据来源:泡泡玛特中国区(含港澳台)分渠道收入披露;H2为单半年(全年−H1)\n线上渠道按财报披露拆分为抽盒机、天猫旗舰店、抖音平台与其他线上 | @Joey知行记',
},
apac: {
title: '亚太区',
source: '亚太区',
series: ['retail', 'robot_store', 'own_app', 'shopee', 'online_other', 'wholesale'],
footnote: '数据来源:泡泡玛特亚太区分渠道收入披露;H2为单半年(全年−H1)\n线上渠道按财报披露拆分为自研APP及官网、Shopee与其他线上 | @思考的Joey',
footnote: '数据来源:泡泡玛特亚太区分渠道收入披露;H2为单半年(全年−H1)\n线上渠道按财报披露拆分为自研APP及官网、Shopee与其他线上 | @Joey知行记',
},
americas: {
title: '美洲区',
source: '美洲区',
series: ['retail', 'robot_store', 'own_app', 'tiktok', 'amazon', 'online_other', 'wholesale'],
footnote: '数据来源:泡泡玛特美洲区分渠道收入披露;H2为单半年(全年−H1)\n2026H1起TikTok无收入,亚马逊为2026年新开渠道 | @思考的Joey',
footnote: '数据来源:泡泡玛特美洲区分渠道收入披露;H2为单半年(全年−H1)\n2026H1起TikTok无收入,亚马逊为2026年新开渠道 | @Joey知行记',
},
europe: {
title: '欧洲及其他区',
source: '欧洲及其他地区',
series: ['retail', 'robot_store', 'own_app', 'online_other', 'wholesale'],
footnote: '数据来源:泡泡玛特欧洲及其他地区分渠道收入披露;H2为单半年(全年−H1)\n线上渠道按财报披露拆分为自研APP及官网与其他线上 | @思考的Joey',
footnote: '数据来源:泡泡玛特欧洲及其他地区分渠道收入披露;H2为单半年(全年−H1)\n线上渠道按财报披露拆分为自研APP及官网与其他线上 | @Joey知行记',
},
};
/** 轴上限取整齐刻度,柱高比例确定后,段标签的段内/外置可按像素判断(同 ppmt_channel_revenue)。 */
const AMOUNT_NICE_MAX = [10, 20, 25, 50, 60, 80, 100, 120, 150, 200, 250, 300, 400, 500];
/**
* 分地区渠道收入金额堆叠柱:与占比图同源同色,直接使用披露金额(亿元),
* 不做占比×总收入还原。矮段标签外置到柱体右侧的机制同全局渠道金额图。
*/
export function makeRegionChannelAmountChart(regionKey) {
const region = REGIONS[regionKey];
if (!region) throw new Error(`未配置的地区渠道金额图:${regionKey}`);
return function regionChannelAmountChart(rows, { width, height, view = 'all' }) {
const periods = col(rows, 'period');
const barWidth = view === 'all' ? 48 : 80;
const totalMax = Math.max(...rows.map((row) => row.total_revenue));
const axisMax = AMOUNT_NICE_MAX.find((max) => max >= totalMax * 1.02)
?? Math.ceil((totalMax * 1.2) / 100) * 100;
// 绘图区像素高:画布高 − grid top 145 − grid bottom 100(两行脚注)
const pxPerUnit = (height - LAYOUT.gridTop - 100) / axisMax;
const rowOffsets = fanTinyLabelOffsets(rows, region.series, pxPerUnit);
return {
backgroundColor: '#fff',
title: {
...titleStyle,
text: `泡泡玛特${region.title}渠道收入金额(${financialViewLabel(view)})`,
subtext: '堆叠柱为各渠道收入(亿元);矮段数值标注在柱体右侧,线上渠道按披露细分拆分',
},
legend: standardLegend(region.series.map((key) => SERIES[key].name)),
tooltip: {
trigger: 'axis',
axisPointer: { type: 'shadow' },
textStyle: { fontFamily: FONT },
formatter: (params) => {
const row = rows[periods.indexOf(params[0].axisValue)];
return `<b>${params[0].axisValue}</b> ${region.source}总收入 ${row.total_revenue.toFixed(2)} 亿元<br/>${params
.filter((item) => item.value !== null)
.slice()
.reverse()
.map((item) => `${item.marker}${item.seriesName}: ${item.value.toFixed(1)} 亿元`)
.join('<br/>')}`;
},
},
grid: { left: 78, right: 82, top: LAYOUT.gridTop, bottom: 100 },
xAxis: { ...standalonePeriodAxis, data: periods },
yAxis: {
...axisCommon,
type: 'value',
name: '渠道收入(亿元)',
nameLocation: 'middle',
nameGap: 56,
nameTextStyle: { color: PALETTE.grey, fontSize: 13, fontFamily: FONT },
min: 0,
max: axisMax,
interval: axisMax % 4 === 0 ? axisMax / 4 : axisMax / 5,
},
series: region.series.map((key, ci) => barSeries({
name: SERIES[key].name,
data: rows.map((row, ri) => stackedSharePoint(row[key], {
pxPerUnit,
labelColor: SERIES[key].labelColor,
dy: rowOffsets[ri][ci] ?? 0,
})),
color: SERIES[key].color,
barWidth,
stack: `channel-amount-${regionKey}`,
label: {
show: true,
position: 'inside',
fontSize: 11,
fontFamily: FONT,
fontWeight: 500,
overflow: 'none',
formatter: (point) => point.value.toFixed(1),
},
emphasis: { focus: 'series' },
})),
graphic: [
...watermarks(width, height),
footnote(region.footnote),
],
};
};
}
/** 分地区渠道收入占比:线上渠道拆分披露的细分平台,每根柱按当期该地区总收入归一化。 */
export function makeRegionChannelShareChart(regionKey) {
const region = REGIONS[regionKey];
+1 -1
View File
@@ -59,7 +59,7 @@ export function ppmtCoreMarginChart(rows, { width, height, view = 'all' }) {
...watermarks(width, height),
footnote(
'核心利润率由绝对值口径直接计算(核心利润÷营收),比三个比率行相减更准\n' +
'——后者各只存4位小数,累加误差可达0.045pct | @思考的Joey'
'——后者各只存4位小数,累加误差可达0.045pct | @Joey知行记'
),
],
};
+1 -1
View File
@@ -137,7 +137,7 @@ export function ppmtCoreProfitChart(rows, { width, height, view = 'all' }) {
...watermarks(width, height),
footnote(
'核心利润反映主业盈利能力(扣除营销与管理成本);' +
'2025H1/H2同比增速受益于费用率优化和规模效应 | @思考的Joey'
'2025H1/H2同比增速受益于费用率优化和规模效应 | @Joey知行记'
),
],
};
+1 -1
View File
@@ -69,7 +69,7 @@ export function expenseStructureChart(rows, { width, height, view = 'all' }) {
],
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特合并利润表;H2为单独半年 | @思考的Joey'),
footnote('数据来源:泡泡玛特合并利润表;H2为单独半年 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -106,7 +106,7 @@ export function ppmtGrowthChart(rows, { width, height, view = 'all' }) {
})),
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特财报;2020H1/H2非GAAP净利用归母净利替代 | @思考的Joey'),
footnote('数据来源:泡泡玛特财报;2020H1/H2非GAAP净利用归母净利替代 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -76,7 +76,7 @@ export function inventoryBalanceChart(rows, { width, height, view = 'all' }) {
],
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特历年合并资产负债表;存货为报告期末时点数 | @思考的Joey'),
footnote('数据来源:泡泡玛特历年合并资产负债表;存货为报告期末时点数 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -80,7 +80,7 @@ export function ipChart(rows, { width, height, view = 'all' }) {
series,
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特财报 | @思考的Joey'),
footnote('数据来源:泡泡玛特财报 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -143,7 +143,7 @@ export function ppmtIpExMonstersChart(rows, { width, height, view = 'all' }) {
],
graphic: [
...watermarks(width, height),
footnote('除 THE MONSTERS 外其余 IP 合计;同比对去年同半年 | @思考的Joey'),
footnote('除 THE MONSTERS 外其余 IP 合计;同比对去年同半年 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -120,7 +120,7 @@ export function ppmtIpShareChart(rows, { width, height }) {
],
graphic: [
...watermarks(width, height),
footnote('HACIPUPU、BUNNY、PUCKY 等 IP 2026H1 无收入数据,未列入 | @思考的Joey'),
footnote('HACIPUPU、BUNNY、PUCKY 等 IP 2026H1 无收入数据,未列入 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -103,7 +103,7 @@ export function ppmtIpShareHistoryChart(rows, { width, height, view = 'all' }) {
})),
graphic: [
...watermarks(width, height),
footnote('其他IP(含已停单列)= Zsiga、HACIPUPU、BUNNY、PUCKY、小甜豆等 | @思考的Joey'),
footnote('其他IP(含已停单列)= Zsiga、HACIPUPU、BUNNY、PUCKY、小甜豆等 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -77,7 +77,7 @@ export function liquidityWorkingCapitalChart(rows, { width, height, view = 'all'
],
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特合并资产负债表 | @思考的Joey'),
footnote('数据来源:泡泡玛特合并资产负债表 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -110,7 +110,7 @@ export function ppmtMarginsChart(rows, { width, height, view = 'all' }) {
...watermarks(width, height),
footnote(
'毛利率/费用率取自利润表;非国际归母净利率=非GAAP净利÷营业收入,' +
'2020H1/H2非GAAP缺失用归母净利替代 | @思考的Joey'
'2020H1/H2非GAAP缺失用归母净利替代 | @Joey知行记'
),
],
};
+1 -1
View File
@@ -123,7 +123,7 @@ export function profitChart(rows, { width, height, view = 'all' }) {
],
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特财报;H2为单独半年 | @思考的Joey'),
footnote('数据来源:泡泡玛特财报;H2为单独半年 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -120,7 +120,7 @@ export function regionChannelChart(rows, { width, height }) {
})),
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特财报 | @思考的Joey'),
footnote('数据来源:泡泡玛特财报 | @Joey知行记'),
],
};
}
@@ -111,7 +111,7 @@ export function regionChannelYoyTimeseriesChart(rows, { width, height }) {
}],
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特财报;早期海外为合并口径 | @思考的Joey'),
footnote('数据来源:泡泡玛特财报;早期海外为合并口径 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -105,7 +105,7 @@ export function regionShareChart(rows, { width, height, view = 'all' }) {
})),
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特财报;中国含港澳台\n2024H1为按2025年中报披露的分地区同比还原;H2为单半年 | @思考的Joey'),
footnote('数据来源:泡泡玛特财报;中国含港澳台\n2024H1为按2025年中报披露的分地区同比还原;H2为单半年 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -120,7 +120,7 @@ export function regionChannelYoyChart(rows, { width, height }) {
})),
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特财报(2026H1 vs 2025H1同比)| @思考的Joey'),
footnote('数据来源:泡泡玛特财报(2026H1 vs 2025H1同比)| @Joey知行记'),
],
};
}
+1 -1
View File
@@ -104,7 +104,7 @@ export function retailStoreRevenueChart(rows, { width, height, view = 'all' }) {
],
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特历年公告;收入仅含“零售店”渠道;H2收入=全年−H1\n2024年海外各区域缺少期初店数,相关单店收入留空 | @思考的Joey'),
footnote('数据来源:泡泡玛特历年公告;收入仅含“零售店”渠道;H2收入=全年−H1\n2024年海外各区域缺少期初店数,相关单店收入留空 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -102,7 +102,7 @@ export function robotStoreRevenueChart(rows, { width, height, view = 'all' }) {
],
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特历年公告;海外收入=亚太+美洲+欧洲及其他的机器人商店收入;H2收入=全年−H1\n2024H1海外期末机器人商店数未披露,相关单店收入留空 | @思考的Joey'),
footnote('数据来源:泡泡玛特历年公告;海外收入=亚太+美洲+欧洲及其他的机器人商店收入;H2收入=全年−H1\n2024H1海外期末机器人商店数未披露,相关单店收入留空 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -133,7 +133,7 @@ export function sankeyChart(rows, { width, height }) {
],
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特财报 | @思考的Joey'),
footnote('数据来源:泡泡玛特财报 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -128,7 +128,7 @@ export function storesRetailChart(rows, { width, height, view = 'all' }) {
],
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特历年公告;门店数为各期末时点数\n2023年及以前海外合计含港澳台;2024年起港澳台单列,海外=亚太+美洲+欧洲 | @思考的Joey'),
footnote('数据来源:泡泡玛特历年公告;门店数为各期末时点数\n2023年及以前海外合计含港澳台;2024年起港澳台单列,海外=亚太+美洲+欧洲 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -75,7 +75,7 @@ export function storesRetailShareChart(rows, { width, height, view = 'all' }) {
})),
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特历年公告;门店数为各报告期末时点数\n中国=中国内地+港澳台;其他=全球合计−中国−亚太−美洲−欧洲 | @思考的Joey'),
footnote('数据来源:泡泡玛特历年公告;门店数为各报告期末时点数\n中国=中国内地+港澳台;其他=全球合计−中国−亚太−美洲−欧洲 | @Joey知行记'),
],
};
}
+2 -2
View File
@@ -135,8 +135,8 @@ export function storesRobotChart(rows, { width, height, view = 'all' }) {
[
'数据来源:泡泡玛特历年公告;门店数为各期末时点数',
view === 'annual'
? '海外合计2023年及以前含港澳台、其后不含 | @思考的Joey'
: '海外合计2023年及以前含港澳台、其后不含;2024H1海外数量未披露 | @思考的Joey',
? '海外合计2023年及以前含港澳台、其后不含 | @Joey知行记'
: '海外合计2023年及以前含港澳台、其后不含;2024H1海外数量未披露 | @Joey知行记',
].join('\n'),
),
],
+1 -1
View File
@@ -78,7 +78,7 @@ export function workingCapitalDaysChart(rows, { width, height }) {
})),
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特财务指标(合并报表);原始180/360天口径已换算为181/365天 | @思考的Joey'),
footnote('数据来源:泡泡玛特财务指标(合并报表);原始180/360天口径已换算为181/365天 | @Joey知行记'),
],
};
}
+1 -1
View File
@@ -55,7 +55,7 @@ export function twoLineChart(rows, { width, height }) {
],
graphic: [
...watermarks(width, height),
footnote('示例数据 | @思考的Joey'),
footnote('示例数据 | @Joey知行记'),
],
};
}