668 Star 1.9K Fork 753

abel533 / ECharts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
PieTest6.java 3.84 KB
一键复制 编辑 原始数据 按行查看 历史
abel533 提交于 2015-06-30 10:40 . 更新GPL授权
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2015 abel533@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.github.abel533.echarts.samples.pie;
import com.github.abel533.echarts.Label;
import com.github.abel533.echarts.code.Orient;
import com.github.abel533.echarts.code.Tool;
import com.github.abel533.echarts.code.X;
import com.github.abel533.echarts.code.Y;
import com.github.abel533.echarts.data.Data;
import com.github.abel533.echarts.series.Pie;
import com.github.abel533.echarts.style.ItemStyle;
import com.github.abel533.echarts.util.EnhancedOption;
import org.junit.Test;
/**
* 复杂的时间轴效果
*
* @author liuzh
*/
public class PieTest6 {
@Test
public void test() {
//地址:http://echarts.baidu.com/doc/example/pie6.html
ItemStyle dataStyle = new ItemStyle();
dataStyle.normal().label(new Label().show(false)).labelLine().show(false);
ItemStyle placeHolderStyle = new ItemStyle();
placeHolderStyle.normal().color("rgba(0,0,0,0)").label(new Label().show(false)).labelLine().show(false);
placeHolderStyle.emphasis().color("rgba(0,0,0,0)");
EnhancedOption option = new EnhancedOption();
option.title().text("你幸福吗?")
.subtext("From ExcelHome")
.sublink("http://e.weibo.com/1341556070/AhQXtjbqh")
.x(X.center)
.y(Y.center)
.itemGap(20)
.textStyle().color("rgba(30,144,255,0.8)")
.fontFamily("微软雅黑")
.fontSize(35)
.fontWeight("bolder");
option.tooltip().show(true).formatter("{a} <br/>{b} : {c} ({d}%)");
option.legend().orient(Orient.vertical)
.x("(function(){return document.getElementById('main').offsetWidth / 2;})()")
.y(56)
.itemGap(12)
.data("68%的人表示过的不错", "29%的人表示生活压力很大", "3%的人表示“我姓曾”");
option.toolbox().show(true).feature(Tool.mark, Tool.dataView, Tool.restore, Tool.saveAsImage);
Pie p1 = new Pie("1");
p1.clockWise(false).radius(125, 150).itemStyle(dataStyle)
.data(new Data("68%的人表示过的不错", 68), new Data("invisible", 32).itemStyle(placeHolderStyle));
Pie p2 = new Pie("2");
p2.clockWise(false).radius(100, 125).itemStyle(dataStyle)
.data(new Data("29%的人表示生活压力很大", 29), new Data("invisible", 71).itemStyle(placeHolderStyle));
Pie p3 = new Pie("3");
p3.clockWise(false).radius(75, 100).itemStyle(dataStyle)
.data(new Data("3%的人表示“我姓曾”", 3), new Data("invisible", 97).itemStyle(placeHolderStyle));
option.series(p1, p2, p3);
option.exportToHtml("pie6.html");
option.view();
}
}
Java
1
https://gitee.com/free/ECharts.git
git@gitee.com:free/ECharts.git
free
ECharts
ECharts
master

搜索帮助