我已经使用 pychart 创建了图表,但输出以 pdf/png/ps 等的形式出现。但我需要这些图表应该进入 excel 表。将此图表提取到工作表的方法是什么。
from pychart import *
import sys
def to_percents(data):
total = float(sum(v for _, v in data))
data[:] = [(k, v / total) for k, v in data]
return data
data = [("foo", 10),("bar", 20), ("baz", 30), ("ao", 40)]
theme.use_color = True
theme.get_options()
ar = area.T(size=(150,150), legend=legend.T(),
x_grid_style = None, y_grid_style = None)
plot = pie_plot.T(data=data, arc_offsets=[0,0,0,0],
shadow = (0, 0, fill_style.gray50),
label_offset = 25,
arrow_style = arrow.a3)
ar.add_plot(plot)
ar.draw()