import { col } from '../csv.js'; import { FINANCIAL_COLORS, PALETTE, FONT, axisCommon, periodAxis, titleStyle, legendStyle, lineSeries, footnote, watermarks, LAYOUT, } from '../theme.js'; /** 泡泡玛特经营现金流与净利润:观察利润的现金兑现能力。 */ export function cashConversionChart(rows, { width, height }) { const periods = col(rows, 'period'); return { backgroundColor: '#fff', title: { ...titleStyle, text: '泡泡玛特经营现金流与净利润(年度)', subtext: '现金转换率 = 经营活动现金流净额 / 净利润;单位:亿元', }, legend: { ...legendStyle, top: LAYOUT.legendTop, data: ['经营活动现金流净额', '净利润', '现金转换率'], }, 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: { ...periodAxis, data: periods }, yAxis: [ { ...axisCommon, type: 'value', name: '金额(亿元)', nameLocation: 'middle', nameGap: 52, nameTextStyle: { color: PALETTE.grey, fontSize: 13, fontFamily: FONT }, min: 0, splitLine: { show: true, lineStyle: { color: PALETTE.gridLine } }, }, { ...axisCommon, type: 'value', name: '现金转换率(%)', nameLocation: 'middle', nameGap: 58, nameRotate: -90, nameTextStyle: { color: PALETTE.grey, fontSize: 13, fontFamily: FONT }, min: 0, max: 200, interval: 50, axisLabel: { ...axisCommon.axisLabel, formatter: '{value}%' }, splitLine: { show: false }, }, ], series: [ { name: '经营活动现金流净额', type: 'bar', data: col(rows, 'operating_cash_flow'), barWidth: 31.2, itemStyle: { color: FINANCIAL_COLORS.operatingCashFlow }, label: { show: true, position: 'top', color: PALETTE.ink, fontFamily: FONT, fontSize: 11, formatter: (p) => p.value.toFixed(1) }, }, { name: '净利润', type: 'bar', data: col(rows, 'net_profit'), barWidth: 31.2, itemStyle: { color: FINANCIAL_COLORS.netProfit }, label: { show: true, position: 'top', color: PALETTE.ink, fontFamily: FONT, fontSize: 11, formatter: (p) => p.value.toFixed(1) }, }, { ...lineSeries({ name: '现金转换率', data: col(rows, 'cash_conversion'), color: FINANCIAL_COLORS.cashConversion, formatter: (p) => `${p.value.toFixed(0)}%`, width: 3, }), yAxisIndex: 1, z: 10, }, ], graphic: [ ...watermarks(width, height), footnote('数据来源:泡泡玛特合并现金流量表、利润表(年度口径)| @思考的Joey'), ], }; }