V2.0 五大核心增强: 锚点定位/原生图表/插件架构/WebSocket/LLM智能
This commit is contained in:
34
ppt_manager/scripts/trade_chart.py
Normal file
34
ppt_manager/scripts/trade_chart.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
from loguru import logger
|
||||
|
||||
def generate(output_dir):
|
||||
logger.info("开始生成进出口贸易图表")
|
||||
|
||||
months = ['1月', '2月', '3月', '4月', '5月', '6月']
|
||||
exports = np.random.randint(2800, 3200, 6)
|
||||
imports = np.random.randint(2000, 2400, 6)
|
||||
|
||||
data = pd.DataFrame({
|
||||
'月份': months,
|
||||
'出口(亿美元)': exports,
|
||||
'进口(亿美元)': imports
|
||||
})
|
||||
data = data.set_index('月份')
|
||||
|
||||
from dynamic_generator import DynamicContentGenerator
|
||||
generator = DynamicContentGenerator()
|
||||
output_path = generator.generate_chart_matplotlib(
|
||||
data,
|
||||
title='进出口贸易情况',
|
||||
x_label='月份',
|
||||
y_label='金额 (亿美元)',
|
||||
filename='trade_chart.png',
|
||||
kind='bar'
|
||||
)
|
||||
|
||||
return output_path
|
||||
|
||||
if __name__ == "__main__":
|
||||
from pathlib import Path
|
||||
generate(Path.cwd())
|
||||
Reference in New Issue
Block a user