feat: 构建泡泡玛特相关图表
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
import { col } from '../csv.js';
|
||||
import {
|
||||
PALETTE, FONT, axisCommon, categoryAxis, titleStyle, legendStyle,
|
||||
lineSeries, footnote, watermarks, LAYOUT,
|
||||
} from '../theme.js';
|
||||
|
||||
/**
|
||||
* 图 1:双柱 + 折线,左右双 Y 轴
|
||||
* 存货/营收走左轴(亿元),周转天数走右轴(天)
|
||||
*/
|
||||
export function inventoryChart(rows, { width, height }) {
|
||||
const periods = col(rows, 'period');
|
||||
|
||||
return {
|
||||
backgroundColor: '#fff',
|
||||
title: { ...titleStyle, text: '存货、营收与存货周转天数(半年与年度)' },
|
||||
legend: {
|
||||
...legendStyle,
|
||||
top: LAYOUT.legendTop,
|
||||
data: [
|
||||
{ name: '存货', icon: 'rect' },
|
||||
{ name: '营收', icon: 'rect' },
|
||||
{ name: '存货周转天数', icon: 'emptyCircle' }, // 折线
|
||||
],
|
||||
},
|
||||
grid: { left: 78, right: 82, top: LAYOUT.gridTop, bottom: 90 },
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { type: 'shadow' },
|
||||
textStyle: { fontFamily: FONT },
|
||||
},
|
||||
xAxis: { ...categoryAxis, data: periods },
|
||||
yAxis: [
|
||||
{
|
||||
...axisCommon,
|
||||
type: 'value',
|
||||
name: '金额(亿元)',
|
||||
nameLocation: 'middle',
|
||||
nameGap: 52,
|
||||
nameTextStyle: { color: PALETTE.grey, fontSize: 13, fontFamily: FONT },
|
||||
min: 0,
|
||||
max: 500,
|
||||
interval: 100,
|
||||
},
|
||||
{
|
||||
...axisCommon,
|
||||
type: 'value',
|
||||
name: '同比增速(%)',
|
||||
nameLocation: 'middle',
|
||||
nameGap: 58,
|
||||
nameRotate: -90,
|
||||
nameTextStyle: { color: PALETTE.grey, fontSize: 13, fontFamily: FONT },
|
||||
min: -5,
|
||||
max: 220,
|
||||
interval: 50,
|
||||
axisLabel: {
|
||||
...axisCommon.axisLabel,
|
||||
formatter: '{value}天',
|
||||
},
|
||||
splitLine: { show: false },
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: '存货',
|
||||
type: 'bar',
|
||||
data: col(rows, 'inventory'),
|
||||
barWidth: 22,
|
||||
barGap: '15%',
|
||||
itemStyle: { color: PALETTE.brown },
|
||||
label: {
|
||||
show: true,
|
||||
position: 'top',
|
||||
color: PALETTE.ink,
|
||||
fontSize: 12,
|
||||
fontWeight: 'bold',
|
||||
fontFamily: FONT,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: '营收',
|
||||
type: 'bar',
|
||||
data: col(rows, 'revenue'),
|
||||
barWidth: 22,
|
||||
itemStyle: { color: PALETTE.sand },
|
||||
label: {
|
||||
show: true,
|
||||
position: 'top',
|
||||
color: PALETTE.ink,
|
||||
fontSize: 12,
|
||||
fontFamily: FONT,
|
||||
},
|
||||
},
|
||||
{
|
||||
...lineSeries({
|
||||
name: '存货周转天数',
|
||||
data: col(rows, 'turnover_days'),
|
||||
color: PALETTE.coral,
|
||||
labelPosition: 'bottom',
|
||||
formatter: (p) => `${p.value}天`,
|
||||
}),
|
||||
yAxisIndex: 1,
|
||||
z: 10,
|
||||
},
|
||||
],
|
||||
graphic: [
|
||||
...watermarks(width, height),
|
||||
footnote(
|
||||
'周转天数=平均存货÷当期销售成本×期间天数(半年181/年度365,期初=上一年末,日历天数口径);' +
|
||||
'与公司披露一致:23年133/24年102/25年123/26H1 201天 | @思考的Joey'
|
||||
),
|
||||
],
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user