Files
smart-fin-chart/js/charts/ppmt_assets.js
T
2026-09-09 15:31:05 +08:00

112 lines
3.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { col } from '../csv.js';
import {
PALETTE, FONT, axisCommon, standalonePeriodAxis, titleStyle, legendStyle,
financialViewLabel,
lineSeries, footnote, watermarks, LAYOUT,
} from '../theme.js';
/**
* 泡泡玛特资产结构演变图
* 堆叠柱状图展示资产配置,折线图展示总资产增长
*/
export function assetsChart(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: 82, top: LAYOUT.gridTop, bottom: 90 },
tooltip: {
trigger: 'axis',
axisPointer: { type: 'shadow' },
textStyle: { fontFamily: FONT },
},
xAxis: { ...standalonePeriodAxis, data: periods },
yAxis: [
{
...axisCommon,
type: 'value',
name: '金额(亿元)',
nameLocation: 'middle',
nameGap: 52,
nameTextStyle: { color: PALETTE.grey, fontSize: 13, fontFamily: FONT },
min: 0,
max: 350,
interval: 50,
},
{
...axisCommon,
type: 'value',
name: '资产总计(亿元)',
nameLocation: 'middle',
nameGap: 58,
nameRotate: -90,
nameTextStyle: { color: PALETTE.grey, fontSize: 13, fontFamily: FONT },
min: 0,
max: 350,
interval: 50,
splitLine: { show: false },
},
],
series: [
{
name: '类现金',
type: 'bar',
stack: 'assets',
data: col(rows, 'cash_like'),
itemStyle: { color: PALETTE.blue },
emphasis: { focus: 'series' },
},
{
name: '应收账款',
type: 'bar',
stack: 'assets',
data: col(rows, 'receivables'),
itemStyle: { color: PALETTE.orange },
emphasis: { focus: 'series' },
},
{
name: '投资资产',
type: 'bar',
stack: 'assets',
data: col(rows, 'investment'),
itemStyle: { color: PALETTE.purple },
emphasis: { focus: 'series' },
},
{
name: '经营类资产',
type: 'bar',
stack: 'assets',
data: col(rows, 'operating_assets'),
itemStyle: { color: PALETTE.sage },
emphasis: { focus: 'series' },
},
{
...lineSeries({
name: '资产总计',
data: col(rows, 'total_assets'),
color: PALETTE.red,
labelPosition: 'top',
formatter: (p) => p.value.toFixed(1),
width: 3,
}),
yAxisIndex: 1,
z: 10,
},
],
graphic: [
...watermarks(width, height),
footnote('数据来源:泡泡玛特财报 | @Joey知行记'),
],
};
}