financial-charts
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFinancial Charts
金融图表
Create publication-quality financial visualizations: Sankey flows, waterfalls, bar charts, and line charts.
创建具备出版级质量的金融可视化内容:桑基流向图、瀑布图、柱状图和折线图。
Quick Reference
快速参考
| Need | Function | Script |
|---|---|---|
| Income statement flow | | |
| Profit walkdown | | |
| Revenue bridge | | |
| Margin comparison | | |
| Revenue segments | | |
| Trend analysis | | |
| Multi-line comparison | | |
| 需求 | 函数 | 脚本 |
|---|---|---|
| 利润表流向 | | |
| 利润拆解 | | |
| 收入桥接 | | |
| 利润率对比 | | |
| 收入细分板块 | | |
| 趋势分析 | | |
| 多折线对比 | | |
Workflow
工作流程
- Identify chart type from Quick Reference
- Prepare data in required format
- Select theme (default, corporate, dark, apple, tech, financial, minimal)
- Run script with parameters
- Output as .png, .html, or .pdf
- 从快速参考中确定图表类型
- 按要求格式准备数据
- 选择主题(默认、企业、深色、苹果、科技、金融、极简)
- 带参数运行脚本
- 输出为.png、.html或.pdf格式
Example: Income Statement Sankey
示例:利润表桑基图
Creates a flow diagram like Apple's FY22 visualization (see ):
assets/chart-example.pngpython
from scripts.sankey_chart import create_income_statement_sankey
create_income_statement_sankey(
revenue_sources={
"iPhone": 205.5e9,
"Mac": 40.2e9,
"iPad": 29.3e9,
"Wearables": 41.2e9,
"Services": 78.1e9,
},
cost_of_revenue=223.6e9,
operating_expenses={"R&D": 26.2e9, "SG&A": 25.1e9},
other_expenses={"Tax": 19.3e9, "Other": 0.3e9},
company_name="Apple",
fiscal_period="FY22",
theme="apple",
output_path="apple_income_flow.png",
)生成类似苹果FY22可视化效果的流向图(见):
assets/chart-example.pngpython
from scripts.sankey_chart import create_income_statement_sankey
create_income_statement_sankey(
revenue_sources={
"iPhone": 205.5e9,
"Mac": 40.2e9,
"iPad": 29.3e9,
"Wearables": 41.2e9,
"Services": 78.1e9,
},
cost_of_revenue=223.6e9,
operating_expenses={"R&D": 26.2e9, "SG&A": 25.1e9},
other_expenses={"Tax": 19.3e9, "Other": 0.3e9},
company_name="Apple",
fiscal_period="FY22",
theme="apple",
output_path="apple_income_flow.png",
)Example: Waterfall Chart
示例:瀑布图
python
from scripts.waterfall_chart import create_profit_walkdown
create_profit_walkdown(
revenue=100e6,
cost_of_goods_sold=60e6,
operating_expenses={"R&D": 10e6, "SG&A": 15e6},
other_items={"Tax": -3e6},
title="Q4 Profit Walkdown",
output_path="walkdown.png",
)python
from scripts.waterfall_chart import create_profit_walkdown
create_profit_walkdown(
revenue=100e6,
cost_of_goods_sold=60e6,
operating_expenses={"R&D": 10e6, "SG&A": 15e6},
other_items={"Tax": -3e6},
title="Q4 Profit Walkdown",
output_path="walkdown.png",
)Themes
主题
All scripts accept parameter:
theme- - Professional blue/green
default - - Traditional business
corporate - - Dark mode dashboards
dark - - Apple-style clean
apple - - Modern tech
tech - - Banking style
financial - - Grayscale with accents
minimal
所有脚本均支持参数:
theme- - 专业蓝绿色调
default - - 传统商务风格
corporate - - 深色模式仪表盘
dark - - 苹果式简洁风格
apple - - 现代科技风格
tech - - 银行风格
financial - - 灰度配重点色
minimal
Dependencies
依赖项
bash
pip install plotly kaleidobash
pip install plotly kaleidoExtended Reference
扩展参考
For detailed API, all parameters, and advanced customization, see .
references/chart-guide.md如需详细API、所有参数及高级自定义内容,请查看。
references/chart-guide.md