financial-charts

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Financial Charts

金融图表

Create publication-quality financial visualizations: Sankey flows, waterfalls, bar charts, and line charts.
创建具备出版级质量的金融可视化内容:桑基流向图、瀑布图、柱状图和折线图。

Quick Reference

快速参考

NeedFunctionScript
Income statement flow
create_income_statement_sankey()
sankey_chart.py
Profit walkdown
create_profit_walkdown()
waterfall_chart.py
Revenue bridge
create_revenue_bridge()
waterfall_chart.py
Margin comparison
create_margin_comparison_chart()
bar_chart.py
Revenue segments
create_revenue_segment_chart()
bar_chart.py
Trend analysis
create_trend_chart()
line_chart.py
Multi-line comparison
create_multi_line_chart()
line_chart.py
需求函数脚本
利润表流向
create_income_statement_sankey()
sankey_chart.py
利润拆解
create_profit_walkdown()
waterfall_chart.py
收入桥接
create_revenue_bridge()
waterfall_chart.py
利润率对比
create_margin_comparison_chart()
bar_chart.py
收入细分板块
create_revenue_segment_chart()
bar_chart.py
趋势分析
create_trend_chart()
line_chart.py
多折线对比
create_multi_line_chart()
line_chart.py

Workflow

工作流程

  1. Identify chart type from Quick Reference
  2. Prepare data in required format
  3. Select theme (default, corporate, dark, apple, tech, financial, minimal)
  4. Run script with parameters
  5. Output as .png, .html, or .pdf
  1. 从快速参考中确定图表类型
  2. 按要求格式准备数据
  3. 选择主题(默认、企业、深色、苹果、科技、金融、极简)
  4. 带参数运行脚本
  5. 输出为.png、.html或.pdf格式

Example: Income Statement Sankey

示例:利润表桑基图

Creates a flow diagram like Apple's FY22 visualization (see
assets/chart-example.png
):
python
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.png
):
python
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
theme
parameter:
  • default
    - Professional blue/green
  • corporate
    - Traditional business
  • dark
    - Dark mode dashboards
  • apple
    - Apple-style clean
  • tech
    - Modern tech
  • financial
    - Banking style
  • minimal
    - Grayscale with accents
所有脚本均支持
theme
参数:
  • default
    - 专业蓝绿色调
  • corporate
    - 传统商务风格
  • dark
    - 深色模式仪表盘
  • apple
    - 苹果式简洁风格
  • tech
    - 现代科技风格
  • financial
    - 银行风格
  • minimal
    - 灰度配重点色

Dependencies

依赖项

bash
pip install plotly kaleido
bash
pip install plotly kaleido

Extended Reference

扩展参考

For detailed API, all parameters, and advanced customization, see
references/chart-guide.md
.
如需详细API、所有参数及高级自定义内容,请查看
references/chart-guide.md