ChartDirector 5.0 for python 笔记【11】Icon Pie Chart 上篇
来源:互联网 发布:mac解压缩软件破解版 编辑:程序博客网 时间:2024/05/21 17:14
本文关于饼图中的个性化icon图标。
要点关注:
- BaseChart.addExtraField用来添加自定义的额外域(field)到图表中。当引用的时候,用{field0}表示第一个添加的额外域,{field1}表示第二个添加的额外域。。。
源代码如下:
#-*-encoding:utf-8 -*-from pychartdir import *setLicenseCode("SXZVFNRN9MZ9L8LGA0E2B1BB");#这个是注册,防止有logo产生data = [72, 18, 15, 12]depths = [30, 20, 10, 10]labels = ["Sunny", "Cloudy", "Rainy", "Snowy"]icons = ["sun.png", "cloud.png", "rain.png", "snowy.png"]c = PieChart(400, 310, metalColor('0xccccff', 0), '0x000000', 1)c.setRoundedFrame()c.setPieSize(200, 180, 100)c.addTitle("Weather Profile in Wonderland", "timesbi.ttf", 15).setBackground( '0xccccff', '0x000000', glassEffect())c.setData(data, labels)# 将图标作为自定义域添加到图表。c.addExtraField(icons)# 用CDML来设置扇区的标签,包含进自定义的图标。c.setLabelFormat( "<*block,valign=absmiddle*><*img={field0}*> <*block*>{label}\n{percent}%<*/*>" \ "<*/*>")c.set3D2(depths)c.setStartAngle(225)c.makeChart("iconpie.png")
最终的效果图:
- ChartDirector 5.0 for python 笔记【11】Icon Pie Chart 上篇
- ChartDirector 5.0 for python 笔记【7】Pie Chart with Legend 上篇
- ChartDirector 5.0 for python 笔记【2】Simple Pie Chart
- ChartDirector 5.0 for python 笔记【3】3D Pie Chart
- ChartDirector 5.0 for python 笔记【4】Multi-Depth Pie Chart
- ChartDirector 5.0 for python 笔记【9】Exploded Pie Chart
- ChartDirector 5.0 for python 笔记【8】Pie Chart with Legend 下篇
- ChartDirector 5.0 for python 笔记【5】Side Label Layout
- ChartDirector 5.0 for python 笔记【6】Circular Label Layout
- ChartDirector 5.0 for python 笔记【0】目录概览
- ChartDirector 5.0 for python 笔记【1】环境介绍和搭建
- ChartDirector 5.0 for python 笔记【10】CDML 标记语言
- python中用matplotlib 画pie chart时避免标题重叠
- chart and pie
- flex3.0 chart pie
- dojo.Chart2D----Pie chart
- Pie Chart "Key"
- Silverlight Pie Chart
- HDU 2816 I Love You Too
- QT中的元对象系统(二):创建自定义的QT类型
- 最快速度找到内存泄漏
- 插入排序
- sql中的case when then else end,列值的选择输出
- ChartDirector 5.0 for python 笔记【11】Icon Pie Chart 上篇
- MPEG-2的系统
- Eclipse找不到C\C++头文件解决
- QT中的元对象系统(一):QVariant的简单说明
- Memory Layout for Multiple and Virtual Inheritance
- 设计模式之—单例模式(Singleton)-Java实现
- 图片数据Base64编解码(java实现)
- 在Linux上建立MySQL 5.0镜像
- oracle物化视图的一般用法