All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.github.abel533.echarts.Option Maven / Gradle / Ivy
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2015 [email protected]
*
* 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;
import com.github.abel533.echarts.axis.Axis;
import com.github.abel533.echarts.code.Easing;
import com.github.abel533.echarts.code.Symbol;
import com.github.abel533.echarts.code.Trigger;
import com.github.abel533.echarts.option.NoDataLoadingOption;
import com.github.abel533.echarts.series.Parallel;
import com.github.abel533.echarts.series.Series;
import com.github.abel533.echarts.style.ItemStyle;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
/**
* Description: Option
*
* @author liuzh
*/
@Getter
@Setter
public class Option implements Serializable {
private static final long serialVersionUID = 4664955083296866542L;
/**
* 全图默认背景,(详见backgroundColor),默认为无,透明
*/
private Object backgroundColor;
/**
* 数值系列的颜色列表,(详见color),可配数组,eg:['#87cefa', 'rgba(123,123,123,0.5)','...'],当系列数量个数比颜色列表长度大时将循环选取
*/
private List color;
/**
* 非IE8-支持渲染为图片,(详见renderAsImage)
* {boolean | string} false,非IE8-支持渲染为图片,可设为true或指定图片格式(png | jpeg),渲染为图片后实例依然可用(如setOption,resize等),但各种交互失效
*/
private Object renderAsImage;
/**
* 是否启用拖拽重计算特性,默认关闭,(详见calculable,相关的还有 calculableColor, calculableHolderColor, nameConnector, valueConnector)
*/
private Boolean calculable;
/**
* 是否启用图表初始化动画,默认开启,建议IE8-关闭,(详见 animation,相关的还有 addDataAnimation, animationThreshold, animationDuration, animationEasing)
*/
private Boolean animation;
/**
* 时间轴(详见timeline),每个图表最多仅有一个时间轴控件
*/
private Timeline timeline;
/**
* 标题(详见title),每个图表最多仅有一个标题控件
*/
private Title title;
/**
* 工具箱(详见toolbox),每个图表最多仅有一个工具箱
*/
private Toolbox toolbox;
/**
* 提示框(详见tooltip),鼠标悬浮交互时的信息提示
*/
private Tooltip tooltip;
/**
* 图例(详见legend),每个图表最多仅有一个图例,混搭图表共享
*/
private Legend legend;
/**
* 值域选择(详见dataRange),值域范围
*/
private DataRange dataRange;
/**
* 数据区域缩放(详见dataZoom),数据展现范围选择
*/
private List dataZoom;
/**
* 缩放漫游组件(详见RoamController),数据缩放漫游选择
*/
private RoamController roamController;
/**
* 直角坐标系内绘图网格(详见grid)
*/
private Grid grid;
/**
* 直角坐标系中横轴数组(详见xAxis),数组中每一项代表一条横轴坐标轴,标准(1.0)中规定最多同时存在2条横轴
*/
private List xAxis;
/**
* 直角坐标系中纵轴数组(详见yAxis),数组中每一项代表一条纵轴坐标轴,标准(1.0)中规定最多同时存在2条纵轴
*/
private List yAxis;
/**
* 驱动图表生成的数据内容(详见series),数组中每一项代表一个系列的特殊选项及数据
*/
private List series;
/**
* 极坐标
*/
private List polar;
/**
* 默认标志图形类型列表,循环使用
*/
private List symbolList;
/**
* 拖拽重计算提示边框颜色
*/
private String calculableColor;
/**
* 可计算占位提示颜色,默认值 '#ccc'
*/
private String calculableHolderColo;
/**
* 数据合并名字间连接符,默认值'&'
*/
private String nameConnector;
/**
* 数据合并名字与数值间连接符,默认值 ':'
*/
private String valueConnector;
/**
* 是否启用动态数据接口动画效果,默认开启,建议IE8-关闭
*/
private Boolean addDataAnimation;
/**
* 动画元素阀值,产生的图形原素超过2000不出动画,默认开启,建议IE8-关闭
*/
private Integer animationThreshold;
/**
* 进入动画时长,单位ms
*/
private Integer animationDuration;
/**
* 更新动画时长,单位ms
*/
private Integer animationDurationUpdate;
/**
* 主元素的缓动效果
*/
private Easing animationEasing;
/**
* 数据更新动画的缓动效果
*/
private Object animationEasingUpdate;
/**
* 无数据时载入配置
*/
private NoDataLoadingOption noDataLoadingOption;
/**
* 当使用timeline时,每一组数据要放到单独的option中
*/
private List options;
/**
* 样式
*/
private ItemStyle itemStyle;
/**
* 地理坐标系组件
*/
private Geo geo;
/**
* 平行坐标系介绍
*/
private Parallel parallel;
/**
* visualMap 是视觉映射组件,用于进行『视觉编码』,也就是将数据映射到视觉元素(视觉通道)
*/
private List visualMap;
public List visualMap() {
if (this.visualMap == null) {
this.visualMap = new ArrayList();
}
return this.visualMap;
}
public VisualMap visualMapNew() {
VisualMap v = new VisualMap();
this.visualMap().add(v);
return v;
}
public Option visualMap(List visualMap) {
this.visualMap = visualMap;
return this;
}
public List getVisualMap() {
return visualMap;
}
public void setVisualMap(List visualMap) {
this.visualMap = visualMap;
}
public Object animationEasingUpdate() {
return this.animationEasingUpdate;
}
public Option animationEasingUpdate(Object animationEasingUpdate) {
this.animationEasingUpdate = animationEasingUpdate;
return this;
}
public Option animationEasingUpdate(Easing animationEasingUpdate) {
this.animationEasingUpdate = animationEasingUpdate;
return this;
}
public Object getAnimationEasingUpdate() {
return animationEasingUpdate;
}
public void setAnimationEasingUpdate(Object animationEasingUpdate) {
this.animationEasingUpdate = animationEasingUpdate;
}
public Parallel parallel() {
if (this.parallel == null) {
this.parallel = new Parallel();
}
return this.parallel;
}
public Option parallel(Parallel parallel) {
this.parallel = parallel;
return this;
}
public Parallel getParallel() {
return parallel;
}
public void setParallel(Parallel parallel) {
this.parallel = parallel;
}
public Geo geo() {
if (this.geo == null) {
this.geo = new Geo();
}
return this.geo;
}
public Option geo(Geo geo) {
this.geo = geo;
return this;
}
public Geo getGeo() {
return geo;
}
public void setGeo(Geo geo) {
this.geo = geo;
}
/**
* 获取symbolList值
*/
public List symbolList() {
return this.symbolList;
}
/**
* 设置symbolList值
*
* @param symbolList
*/
public Option symbolList(List symbolList) {
if (this.symbolList == null) {
this.symbolList = new LinkedList();
}
this.symbolList = symbolList;
return this;
}
/**
* 设置symbolList值
*
* @param symbolList
*/
public Option symbolList(Symbol... symbolList) {
if (symbolList == null || symbolList.length == 0) {
return this;
}
this.symbolList().addAll(Arrays.asList(symbolList));
return this;
}
/**
* 获取calculableColor值
*/
public String calculableColor() {
return this.calculableColor;
}
/**
* 设置calculableColor值
*
* @param calculableColor
*/
public Option calculableColor(String calculableColor) {
this.calculableColor = calculableColor;
return this;
}
/**
* 获取calculableHolderColo值
*/
public String calculableHolderColo() {
return this.calculableHolderColo;
}
/**
* 设置calculableHolderColo值
*
* @param calculableHolderColo
*/
public Option calculableHolderColo(String calculableHolderColo) {
this.calculableHolderColo = calculableHolderColo;
return this;
}
/**
* 获取nameConnector值
*/
public String nameConnector() {
return this.nameConnector;
}
/**
* 设置nameConnector值
*
* @param nameConnector
*/
public Option nameConnector(String nameConnector) {
this.nameConnector = nameConnector;
return this;
}
/**
* 获取valueConnector值
*/
public String valueConnector() {
return this.valueConnector;
}
/**
* 设置valueConnector值
*
* @param valueConnector
*/
public Option valueConnector(String valueConnector) {
this.valueConnector = valueConnector;
return this;
}
/**
* 获取addDataAnimation值
*/
public Boolean addDataAnimation() {
return this.addDataAnimation;
}
/**
* 设置addDataAnimation值
*
* @param addDataAnimation
*/
public Option addDataAnimation(Boolean addDataAnimation) {
this.addDataAnimation = addDataAnimation;
return this;
}
/**
* 获取animationThreshold值
*/
public Integer animationThreshold() {
return this.animationThreshold;
}
/**
* 设置animationThreshold值
*
* @param animationThreshold
*/
public Option animationThreshold(Integer animationThreshold) {
this.animationThreshold = animationThreshold;
return this;
}
/**
* 获取animationDuration值
*/
public Integer animationDuration() {
return this.animationDuration;
}
/**
* 设置animationDuration值
*
* @param animationDuration
*/
public Option animationDuration(Integer animationDuration) {
this.animationDuration = animationDuration;
return this;
}
/**
* 获取animationDurationUpdate值
*/
public Integer animationDurationUpdate() {
return this.animationDurationUpdate;
}
/**
* 设置animationDurationUpdate值
*
* @param animationDurationUpdate
*/
public Option animationDurationUpdate(Integer animationDurationUpdate) {
this.animationDurationUpdate = animationDurationUpdate;
return this;
}
/**
* 获取animationEasing值
*/
public Easing animationEasing() {
return this.animationEasing;
}
/**
* 设置animationEasing值
*
* @param animationEasing
*/
public Option animationEasing(Easing animationEasing) {
this.animationEasing = animationEasing;
return this;
}
/**
* 获取noDataLoadingOption值
*/
public NoDataLoadingOption noDataLoadingOption() {
if (this.noDataLoadingOption == null) {
this.noDataLoadingOption = new NoDataLoadingOption();
}
return this.noDataLoadingOption;
}
/**
* 设置noDataLoadingOption值
*
* @param noDataLoadingOption
*/
public Option noDataLoadingOption(NoDataLoadingOption noDataLoadingOption) {
this.noDataLoadingOption = noDataLoadingOption;
return this;
}
/**
* 获取itemStyle值
*/
public ItemStyle itemStyle() {
if (this.itemStyle == null) {
this.itemStyle = new ItemStyle();
}
return this.itemStyle;
}
/**
* 设置itemStyle值
*
* @param itemStyle
*/
public Option itemStyle(ItemStyle itemStyle) {
this.itemStyle = itemStyle;
return this;
}
/**
* 获取polar值
*/
public List polar() {
if (this.polar == null) {
this.polar = new ArrayList();
}
return this.polar;
}
/**
* 设置polar值
*
* @param polar
*/
public Option polar(List polar) {
this.polar = polar;
return this;
}
/**
* 设置values值
*
* @param values
*/
public Option polar(Polar... values) {
if (values == null || values.length == 0) {
return this;
}
this.polar().addAll(Arrays.asList(values));
return this;
}
/**
* 设置timeline值
*
* @param timeline
*/
public Option timeline(Timeline timeline) {
this.timeline = timeline;
return this;
}
/**
* 设置title值
*
* @param title
*/
public Option title(Title title) {
this.title = title;
return this;
}
/**
* 标题
*
* @param text
* @return
*/
public Option title(String text) {
this.title().text(text);
return this;
}
/**
* 标题和副标题
*
* @param text
* @param subtext
* @return
*/
public Option title(String text, String subtext) {
this.title().text(text).subtext(subtext);
return this;
}
/**
* 设置toolbox值
*
* @param toolbox
*/
public Option toolbox(Toolbox toolbox) {
this.toolbox = toolbox;
return this;
}
/**
* 设置tooltip值
*
* @param tooltip
*/
public Option tooltip(Tooltip tooltip) {
this.tooltip = tooltip;
return this;
}
/**
* 设置trigger值
*
* @param trigger
*/
public Option tooltip(Trigger trigger) {
this.tooltip().trigger(trigger);
return this;
}
/**
* 设置legend值
*
* @param legend
*/
public Option legend(Legend legend) {
this.legend = legend;
return this;
}
/**
* 设置dataRange值
*
* @param dataRange
*/
public Option dataRange(DataRange dataRange) {
this.dataRange = dataRange;
return this;
}
/**
* 设置dataZoom值
*
* @param dataZoom
*/
public Option dataZoom(List dataZoom) {
this.dataZoom = dataZoom;
return this;
}
/**
* 设置dataZoom值
*
* @param dataZoom
*/
public Option dataZoom(DataZoom... dataZoom) {
if (dataZoom == null || dataZoom.length == 0) {
return this;
}
this.dataZoom().addAll(Arrays.asList(dataZoom));
return this;
}
/**
* 设置grid值
*
* @param grid
*/
public Option grid(Grid grid) {
this.grid = grid;
return this;
}
/**
* 设置xAxis值
*
* @param xAxis
*/
public Option xAxis(List xAxis) {
this.xAxis = xAxis;
return this;
}
/**
* 设置yAxis值
*
* @param yAxis
*/
public Option yAxis(List yAxis) {
this.yAxis = yAxis;
return this;
}
/**
* 设置series值
*
* @param series
*/
public Option series(List series) {
this.series = series;
return this;
}
/**
* 设置options值
*
* @param options
*/
public Option options(List options) {
this.options = options;
return this;
}
/**
* 获取backgroundColor值
*/
public Object backgroundColor() {
return this.backgroundColor;
}
/**
* 设置backgroundColor值
*
* @param backgroundColor
*/
public Option backgroundColor(Object backgroundColor) {
this.backgroundColor = backgroundColor;
return this;
}
/**
* 获取color值
*/
public List color() {
if (this.color == null) {
this.color = new ArrayList();
}
return this.color;
}
/**
* 设置color值
*
* @param colors
*/
public Option color(Object... colors) {
if (colors == null || colors.length == 0) {
return this;
}
this.color().addAll(Arrays.asList(colors));
return this;
}
/**
* 获取renderAsImage值
*/
public Object renderAsImage() {
return this.renderAsImage;
}
/**
* 设置renderAsImage值
*
* @param renderAsImage
*/
public Option renderAsImage(Object renderAsImage) {
this.renderAsImage = renderAsImage;
return this;
}
/**
* 获取calculable值
*/
public Boolean calculable() {
return this.calculable;
}
/**
* 设置calculable值
*
* @param calculable
*/
public Option calculable(Boolean calculable) {
this.calculable = calculable;
return this;
}
/**
* 获取animation值
*/
public Boolean animation() {
return this.animation;
}
/**
* 设置animation值
*
* @param animation
*/
public Option animation(Boolean animation) {
this.animation = animation;
return this;
}
/**
* 时间轴(详见timeline),每个图表最多仅有一个时间轴控件
*/
public Timeline timeline() {
if (this.timeline == null) {
this.timeline = new Timeline();
}
return this.timeline;
}
/**
* 标题(详见title),每个图表最多仅有一个标题控件
*/
public Title title() {
if (this.title == null) {
this.title = new Title();
}
return this.title;
}
/**
* 工具箱(详见toolbox),每个图表最多仅有一个工具箱
*/
public Toolbox toolbox() {
if (this.toolbox == null) {
this.toolbox = new Toolbox();
}
return this.toolbox;
}
/**
* 提示框(详见tooltip),鼠标悬浮交互时的信息提示
*/
public Tooltip tooltip() {
if (this.tooltip == null) {
this.tooltip = new Tooltip();
}
return this.tooltip;
}
/**
* 图例(详见legend),每个图表最多仅有一个图例,混搭图表共享
*/
public Legend legend() {
if (this.legend == null) {
this.legend = new Legend();
}
return this.legend;
}
/**
* 添加图例(详见legend),每个图表最多仅有一个图例,混搭图表共享
*
* @param values
* @return
*/
public Option legend(Object... values) {
this.legend().data(values);
return this;
}
/**
* 值域选择(详见dataRange),值域范围
*/
public DataRange dataRange() {
if (this.dataRange == null) {
this.dataRange = new DataRange();
}
return this.dataRange;
}
/**
* 数据区域缩放(详见dataZoom),数据展现范围选择
*/
public DataZoom dataZoomNew() {
DataZoom dataZoom = new DataZoom();
this.dataZoom().add(dataZoom);
return dataZoom;
}
/**
* 数据区域缩放(详见dataZoom),数据展现范围选择
*/
public List dataZoom() {
if (this.dataZoom == null) {
this.dataZoom = new ArrayList();
}
return this.dataZoom;
}
/**
* 数据缩放漫游选择(详见roamController),数据缩放漫游选择
*/
public RoamController roamController() {
if (this.roamController == null) {
this.roamController = new RoamController();
}
return this.roamController;
}
/**
* 直角坐标系内绘图网格(详见grid)
*/
public Grid grid() {
if (this.grid == null) {
this.grid = new Grid();
}
return this.grid;
}
/**
* 直角坐标系中横轴数组(详见xAxis),数组中每一项代表一条横轴坐标轴,标准(1.0)中规定最多同时存在2条横轴
*/
public List xAxis() {
if (this.xAxis == null) {
this.xAxis = new ArrayList();
}
return this.xAxis;
}
/**
* 添加x轴
*
* @param values
* @return
*/
public Option xAxis(Axis... values) {
if (values == null || values.length == 0) {
return this;
}
if (this.xAxis().size() == 2) {
throw new RuntimeException("xAxis已经存在2个,无法继续添加!");
}
if (this.xAxis().size() + values.length > 2) {
throw new RuntimeException("添加的xAxis超出了最大允许的范围:2!");
}
this.xAxis().addAll(Arrays.asList(values));
return this;
}
/**
* 直角坐标系中横轴数组(详见xAxis),数组中每一项代表一条横轴坐标轴,标准(1.0)中规定最多同时存在2条横轴
*/
public List yAxis() {
if (this.yAxis == null) {
this.yAxis = new ArrayList();
}
return this.yAxis;
}
/**
* 添加y轴
*
* @param values
* @return
*/
public Option yAxis(Axis... values) {
if (values == null || values.length == 0) {
return this;
}
if (this.yAxis().size() == 2) {
throw new RuntimeException("yAxis已经存在2个,无法继续添加!");
}
if (this.yAxis().size() + values.length > 2) {
throw new RuntimeException("添加的yAxis超出了最大允许的范围:2!");
}
this.yAxis().addAll(Arrays.asList(values));
return this;
}
/**
* 驱动图表生成的数据内容(详见series),数组中每一项代表一个系列的特殊选项及数据
*/
public List series() {
if (this.series == null) {
this.series = new ArrayList();
}
return this.series;
}
/**
* 添加数据
*
* @param values
* @return
*/
public Option series(Series... values) {
if (values == null || values.length == 0) {
return this;
}
this.series().addAll(Arrays.asList(values));
return this;
}
/**
* 当使用timeline时,每一组数据要放到单独的option中
*/
public List options() {
if (this.options == null) {
this.options = new ArrayList ();
}
return this.options;
}
/**
* 添加Option数据
*
* @param values
* @return
*/
public Option options(Option... values) {
if (values == null || values.length == 0) {
return this;
}
this.options().addAll(Arrays.asList(values));
return this;
}
}