feat: 更新泡泡玛特图表,加入单店收入
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
import { col } from '../csv.js';
|
||||
import {
|
||||
FINANCIAL_COLORS, PALETTE, FONT, axisCommon, standalonePeriodAxis, titleStyle, standardLegend,
|
||||
financialViewLabel, barSeries, lineSeries, footnote, watermarks, LAYOUT,
|
||||
} from '../theme.js';
|
||||
|
||||
/** 泡泡玛特存货余额与同报告期同比:存货为期末时点数。 */
|
||||
export function inventoryBalanceChart(rows, { width, height, view = 'all' }) {
|
||||
const yoy = col(rows, 'yoy').filter(Number.isFinite);
|
||||
const yoyMin = Math.min(0, Math.floor(Math.min(...yoy) / 20) * 20);
|
||||
const yoyMax = Math.max(50, Math.ceil(Math.max(...yoy) / 50) * 50);
|
||||
const barWidth = view === 'all' ? 28.8 : 60.8;
|
||||
|
||||
return {
|
||||
backgroundColor: '#fff',
|
||||
title: {
|
||||
...titleStyle,
|
||||
text: `泡泡玛特存货余额及同比(${financialViewLabel(view)})`,
|
||||
subtext: '柱状为报告期末存货余额;折线为同报告期同比(H1 对 H1、全年对全年)',
|
||||
},
|
||||
legend: standardLegend(['存货余额', '存货同比']),
|
||||
grid: { left: 78, right: 82, top: LAYOUT.gridTop, bottom: 90 },
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { type: 'shadow' },
|
||||
textStyle: { fontFamily: FONT },
|
||||
valueFormatter: (value) => `${value.toFixed(1)}`,
|
||||
},
|
||||
xAxis: { ...standalonePeriodAxis, data: col(rows, 'period') },
|
||||
yAxis: [
|
||||
{
|
||||
...axisCommon,
|
||||
type: 'value',
|
||||
name: '存货余额(亿元)',
|
||||
nameLocation: 'middle',
|
||||
nameGap: 52,
|
||||
nameTextStyle: { color: PALETTE.grey, fontSize: 13, fontFamily: FONT },
|
||||
min: 0,
|
||||
},
|
||||
{
|
||||
...axisCommon,
|
||||
type: 'value',
|
||||
name: '同比(%)',
|
||||
nameLocation: 'middle',
|
||||
nameGap: 58,
|
||||
nameRotate: -90,
|
||||
nameTextStyle: { color: PALETTE.grey, fontSize: 13, fontFamily: FONT },
|
||||
min: yoyMin,
|
||||
max: yoyMax,
|
||||
interval: (yoyMax - yoyMin) / 5,
|
||||
axisLabel: { ...axisCommon.axisLabel, formatter: '{value}%' },
|
||||
splitLine: { show: false },
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
...barSeries({
|
||||
name: '存货余额',
|
||||
data: col(rows, 'inventory'),
|
||||
color: FINANCIAL_COLORS.investingCashFlow,
|
||||
barWidth,
|
||||
formatter: (point) => point.value.toFixed(1),
|
||||
}),
|
||||
emphasis: { focus: 'series' },
|
||||
},
|
||||
{
|
||||
...lineSeries({
|
||||
name: '存货同比',
|
||||
data: col(rows, 'yoy'),
|
||||
color: FINANCIAL_COLORS.cashConversion,
|
||||
formatter: (point) => `${point.value.toFixed(1)}%`,
|
||||
}),
|
||||
yAxisIndex: 1,
|
||||
z: 10,
|
||||
},
|
||||
],
|
||||
graphic: [
|
||||
...watermarks(width, height),
|
||||
footnote('数据来源:泡泡玛特历年合并资产负债表;存货为报告期末时点数 | @思考的Joey'),
|
||||
],
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user