ChartDirector 5.0 for python 笔记【6】Circular Label Layout
来源:互联网 发布:macbook pro 2017 知乎 编辑:程序博客网 时间:2024/05/22 11:15
讲解环绕标签布局。
前面的讲的标签都是在饼图的扇区外,其实可以把它放到扇区内。只要把标签的坐标调整为负数值即可。
同时这个例子引入了梯度阴影效果。
源代码:
#-*-encoding:utf-8 -*-from pychartdir import *setLicenseCode("SXZVFNRN9MZ9L8LGA0E2B1BB");#这个是注册,防止有logo产生def createChart(img) :data = [42, 18, 8]labels = ["Agree", "Disagree", "Not Sure"]colors = ['0x66ff66', '0xff6666', '0xffff00'] # 新建PieChart对象。设置背景色为梯度颜色,从0xaaccff变到ffffffc = PieChart(300, 300)c.setBackground(c.linearGradientColor(0, 0, 0, c.getHeight() / 2, '0xaaccff', '0xffffff'), '0x888888')#设置圆角、下落阴影效果c.setRoundedFrame()c.setDropShadow()if img == "0" :c.setPieSize(150, 150, 120)#设置标签位置在圆周的内部40像素c.setLabelPos(-40)else :c.setPieSize(150, 150, 80)# 设置标签在饼图外面20像素处,并加上连接线。c.setLabelPos(20, LineColor)c.setData(data, labels)# 设置饼图扇区颜色c.setColors2(DataColor, colors)# 设置扇区梯度色,并有1像素的半透明黑色边缘c.setSectorStyle(LocalGradientShading, '0xbb000000', 1)c.makeChart("circlelabelpie%s.png" % img)#调用上面的函数产生两个不同的饼图createChart("0")createChart("1")
得到的饼图如下:
可以看到,左边的饼图标签就是在扇区内的。
- ChartDirector 5.0 for python 笔记【6】Circular Label Layout
- ChartDirector 5.0 for python 笔记【5】Side Label Layout
- 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 笔记【0】目录概览
- ChartDirector 5.0 for python 笔记【1】环境介绍和搭建
- ChartDirector 5.0 for python 笔记【9】Exploded Pie Chart
- ChartDirector 5.0 for python 笔记【10】CDML 标记语言
- 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 下篇
- Python label for _ 用法
- label for
- python学习笔记之tkinter中的label
- ASE.ChartDirector.for.Ruby.v4.1.MacOSX
- ASE.ChartDirector.for.Ruby.v4.1.FreeBSD
- ASE.ChartDirector.for.Ruby.v4.1
- 导弹拦截&&http://acm.nyist.net/JudgeOnline/problem.php?pid=79
- Linux内核结构
- 剪刀、石头、布游戏
- wifi 自动化测试脚本
- Struts-初级篇-开发注意问题及小技巧
- ChartDirector 5.0 for python 笔记【6】Circular Label Layout
- android边缓存边播放mp4
- 自学数据分析需要的bat
- 编译器对extern的处理
- 在社会上闯荡必须要牢记的
- Java高新技术2--JAVA中枚举的各种应用以及单例模式
- 【C Prime Plus】学习笔记,Chapter 10,数组和指针之四
- pl/sql 查询数据量大时, 怎么提高输出缓存大小?
- WinDbg安装与使用