ChartDirector 5.0 for python 笔记【9】Exploded Pie Chart
来源:互联网 发布:sqlyog导入sql文件报错 编辑:程序博客网 时间:2024/05/22 03:22
本文关于有展开效果的饼图
要点关注:
- PieChart.setSectorStyle设置扇区边缘厚度。
源代码:
#-*-encoding:utf-8 -*-from pychartdir import *setLicenseCode("SXZVFNRN9MZ9L8LGA0E2B1BB");#这个是注册,防止有logo产生data = [21, 18, 15, 12, 8, 24]labels = ["Labor", "Licenses", "Taxes", "Legal", "Facilities", "Production"]colors = ['0x66aaee', '0xeebb22', '0xbbbbbb', '0x8844ff', '0xdd2222', '0x009900']c = PieChart(600, 360)# 使用白色调色板,这样默认的文本和线条就是白色c.setColors(whiteOnBlackPalette)#用垂直梯度色作为背景,从深蓝色到蓝色。c.setBackground(c.linearGradientColor(0, 0, 0, c.getHeight(), '0x000066', '0x0000cc'))c.setRoundedFrame('0xffffff', 20)c.setDropShadow()c.addTitle("Exploded Pie Chart Demonstration", "timesbi.ttf", 18).setMargin2(0, 0, 16, 0)c.setPieSize(300, 195, 110)c.setData(data, labels)#设置扇区颜色c.setColors2(DataColor, colors)# 设置扇区阴影和5像素边缘c.setSectorStyle(LocalGradientShading, '0xbbffffff', 5)#侧边标签方法c.setLabelLayout(SideLayout)t = c.setLabelStyle("arialbd.ttf", 10, '0x000000')t.setBackground(SameAsMainColor, Transparent, softLighting(Right, 0))t.setRoundedCorners(8)c.setLabelFormat( "<*block,halign=center,width=110*>{label}\n<*font=arial.ttf,size=8*>US$ " \ "{value}M ({percent}%)<*/*>")# 将所有扇区从中心展开10像素c.setExplode(-1, 10)c.makeChart("explodedpie.png")
效果图:
- ChartDirector 5.0 for python 笔记【9】Exploded Pie Chart
- 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 笔记【11】Icon Pie Chart 上篇
- ChartDirector 5.0 for python 笔记【7】Pie Chart with Legend 上篇
- 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
- java性能的一些常用的命令与注意点
- gcc 与 glibc 的关系 glibc版本查看
- android中的widget(转)
- 2011,过去的总结
- Watch2Pay :具有信用卡功能的腕表
- ChartDirector 5.0 for python 笔记【9】Exploded Pie Chart
- 摩尔定律
- 黑马程序员_String类-StringBuffer
- dsfsdfsd
- WindRiver开发出Android系统多应用窗口显示
- C/C++格式化字符串说明
- 东北游记一
- Ingri:Dahl——全能时尚的3D眼镜
- JDBC调用存储过程输出游标参数的存储过程