84 lines
2.6 KiB
JavaScript
84 lines
2.6 KiB
JavaScript
import { col } from '../csv.js';
|
||
import {
|
||
PALETTE, FINANCIAL_COLORS, FONT, axisCommon, standalonePeriodAxis, titleStyle, legendStyle,
|
||
financialViewLabel,
|
||
lineDataWithSafeLabels, lineSeries, barSeries, footnote, watermarks, LAYOUT,
|
||
} from '../theme.js';
|
||
|
||
/** 泡泡玛特现金、负债与净营运资本:观察流动性与资金占用。 */
|
||
export function liquidityWorkingCapitalChart(rows, { width, height, view = 'all' }) {
|
||
const periods = col(rows, 'period');
|
||
|
||
return {
|
||
backgroundColor: '#fff',
|
||
title: {
|
||
...titleStyle,
|
||
text: `泡泡玛特现金、负债与净营运资本(${financialViewLabel(view)})`,
|
||
subtext: '净营运资本 = 流动资产 − 流动负债;单位:亿元;H2 为年末时点',
|
||
},
|
||
legend: {
|
||
...legendStyle,
|
||
top: LAYOUT.legendTop,
|
||
data: ['货币资金', '负债合计', '净营运资本'],
|
||
},
|
||
grid: { left: 78, right: 42, top: LAYOUT.gridTop, bottom: 90 },
|
||
tooltip: {
|
||
trigger: 'axis',
|
||
axisPointer: { type: 'shadow' },
|
||
textStyle: { fontFamily: FONT },
|
||
valueFormatter: (value) => `${value.toFixed(1)} 亿元`,
|
||
},
|
||
xAxis: { ...standalonePeriodAxis, data: periods },
|
||
yAxis: {
|
||
...axisCommon,
|
||
type: 'value',
|
||
name: '金额(亿元)',
|
||
nameLocation: 'middle',
|
||
nameGap: 52,
|
||
nameTextStyle: { color: PALETTE.grey, fontSize: 13, fontFamily: FONT },
|
||
min: 0,
|
||
},
|
||
series: [
|
||
{
|
||
...barSeries({
|
||
name: '货币资金',
|
||
data: col(rows, 'cash'),
|
||
color: FINANCIAL_COLORS.investingCashFlow,
|
||
barWidth: 18,
|
||
formatter: (p) => p.value.toFixed(1),
|
||
}),
|
||
emphasis: { focus: 'series' },
|
||
},
|
||
{
|
||
...barSeries({
|
||
name: '负债合计',
|
||
data: col(rows, 'total_liabilities'),
|
||
color: FINANCIAL_COLORS.financingCashFlow,
|
||
barWidth: 18,
|
||
formatter: (p) => p.value.toFixed(1),
|
||
}),
|
||
emphasis: { focus: 'series' },
|
||
},
|
||
{
|
||
...lineSeries({
|
||
name: '净营运资本',
|
||
data: lineDataWithSafeLabels(rows, {
|
||
lineKey: 'net_working_capital',
|
||
barKeys: ['cash', 'total_liabilities'],
|
||
// 净营运资本接近货币资金时,标签置于柱体另一侧。
|
||
closePosition: 'bottom',
|
||
}),
|
||
color: FINANCIAL_COLORS.operatingCashFlow,
|
||
formatter: (p) => p.value.toFixed(1),
|
||
width: 3,
|
||
}),
|
||
z: 10,
|
||
},
|
||
],
|
||
graphic: [
|
||
...watermarks(width, height),
|
||
footnote('数据来源:泡泡玛特合并资产负债表 | @思考的Joey'),
|
||
],
|
||
};
|
||
}
|