Standardize financial chart colors and improve label placement
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { col } from '../csv.js';
|
||||
import {
|
||||
PALETTE, FONT, axisCommon, periodAxis, titleStyle, legendStyle,
|
||||
lineSeries, footnote, watermarks, LAYOUT,
|
||||
PALETTE, FINANCIAL_COLORS, FONT, axisCommon, periodAxis, titleStyle, legendStyle,
|
||||
lineDataWithSafeLabels, lineSeries, barSeries, footnote, watermarks, LAYOUT,
|
||||
} from '../theme.js';
|
||||
|
||||
/** 泡泡玛特现金、负债与净营运资本:观察流动性与资金占用。 */
|
||||
@@ -39,26 +39,35 @@ export function liquidityWorkingCapitalChart(rows, { width, height }) {
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '货币资金',
|
||||
type: 'bar',
|
||||
data: col(rows, 'cash'),
|
||||
barWidth: 18,
|
||||
itemStyle: { color: PALETTE.blue },
|
||||
...barSeries({
|
||||
name: '货币资金',
|
||||
data: col(rows, 'cash'),
|
||||
color: FINANCIAL_COLORS.investingCashFlow,
|
||||
barWidth: 18,
|
||||
formatter: (p) => p.value.toFixed(1),
|
||||
}),
|
||||
emphasis: { focus: 'series' },
|
||||
},
|
||||
{
|
||||
name: '负债合计',
|
||||
type: 'bar',
|
||||
data: col(rows, 'total_liabilities'),
|
||||
barWidth: 18,
|
||||
itemStyle: { color: PALETTE.orange },
|
||||
...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: col(rows, 'net_working_capital'),
|
||||
color: PALETTE.red,
|
||||
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,
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user