Skip to content

Commit ee56ec9

Browse files
committed
增加2.1.9的多项属性。
1 parent 91c9e6c commit ee56ec9

File tree

6 files changed

+290
-11
lines changed

6 files changed

+290
-11
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#ECharts - Java类库
22

3-
**当前版本2.1.8.4**
3+
**当前版本2.1.9**
44

55
本项目是一个供Java开发使用的ECharts的开发包,主要目的是方便在Java中构造ECharts中可能用到的全部数据结构,如完整的结构Option。Option中的数据Series,包含Bar-柱状图,Line-折线图,Pie-饼图,Chord-和弦图等,支持ECharts中的所有图表。支持所有的Style类,如AreaStyle,ChordStyle,ItemStyle,LineStyle,LinkStyle等等。支持多种Data数据类型,一个通用的Data数据,以及PieData,MapData,ScatterData,KData等针对性的数据结构。
66

@@ -10,9 +10,15 @@
1010

1111
**由于本项目反馈的bug并不多,为了方便每一个开发人员,每次修复bug都会发布一个小版本,并且bug修复只针对当前的大版本进行修复。**
1212

13+
##2.1.9
14+
15+
- `Node`节点增加`label`属性[#963](https://github.com/ecomfe/echarts/issues/963)
16+
- `Chord`图表加入`categories,nodes,links`三项属性
17+
- `Tooltip`加入`enterable`属性,含义未知
18+
1319
##2.1.8.4
1420

15-
解决`MarkLine`缺少`smooth`属性的问题,这是2.1.8的最后一个版本。
21+
- 解决`MarkLine`缺少`smooth`属性的问题,这是2.1.8的最后一个版本。
1622

1723
##2.1.8.3
1824

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
<groupId>com.github.abel533</groupId>
3030
<artifactId>ECharts</artifactId>
31-
<version>2.1.8.4</version>
31+
<version>2.1.9</version>
3232
<packaging>jar</packaging>
3333

3434
<name>ECharts</name>

src/main/java/com/github/abel533/echarts/Tooltip.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ public class Tooltip extends Basic<Tooltip> implements Component {
6666
* 动画变换时长,单位s,如果你希望tooltip的跟随实时响应,showDelay设置为0是关键,同时transitionDuration设0也会有交互体验上的差别
6767
*/
6868
private Double transitionDuration;
69+
/**
70+
* 2.1.9新增属性,默认true,含义未知
71+
*
72+
* @since 2.1.9
73+
*/
74+
private Boolean enterable;
6975
/**
7076
* 提示边框圆角,单位px,默认为4
7177
*/
@@ -237,6 +243,15 @@ public Tooltip transitionDuration(Double transitionDuration) {
237243
return this;
238244
}
239245

246+
public Boolean enterable(){
247+
return this.enterable;
248+
}
249+
250+
public Tooltip enterable(Boolean enterable){
251+
this.enterable = enterable;
252+
return this;
253+
}
254+
240255
/**
241256
* 获取borderRadius值
242257
*/
@@ -404,6 +419,14 @@ public void setTransitionDuration(Double transitionDuration) {
404419
this.transitionDuration = transitionDuration;
405420
}
406421

422+
public Boolean getEnterable() {
423+
return enterable;
424+
}
425+
426+
public void setEnterable(Boolean enterable) {
427+
this.enterable = enterable;
428+
}
429+
407430
/**
408431
* 获取borderRadius值
409432
*/

src/main/java/com/github/abel533/echarts/series/Chord.java

Lines changed: 214 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,36 @@
2626

2727
import com.github.abel533.echarts.code.SeriesType;
2828
import com.github.abel533.echarts.code.Sort;
29-
import com.github.abel533.echarts.code.Symbol;
29+
import com.github.abel533.echarts.series.force.Category;
30+
import com.github.abel533.echarts.series.force.Link;
31+
import com.github.abel533.echarts.series.force.Node;
32+
33+
import java.util.ArrayList;
34+
import java.util.Arrays;
35+
import java.util.List;
3036

3137
/**
3238
* Description: Chord
3339
*
3440
* @author liuzh
3541
*/
3642
public class Chord extends Series<Chord> {
43+
/**
44+
* 力导向图中节点的分类
45+
*/
46+
private List<Category> categories;
47+
/**
48+
* 力导向图的顶点数据
49+
*/
50+
private List<Node> nodes;
51+
/**
52+
* 力导向图的边数据
53+
*/
54+
private List<Link> links;
55+
/**
56+
* ribbonType的和弦图节点使用扇形绘制,边使用有大小端的ribbon绘制,可以表示出边的权重,图的节点边之间必须是双向边,非ribbonType的和弦图节点使用symbol绘制,边使用贝塞尔曲线,不能表示边的权重,但是可以使用单向边
57+
*/
58+
private Boolean ribbonType;
3759
/**
3860
* 每个sector之间的间距(用角度表示)
3961
*/
@@ -97,6 +119,165 @@ public Chord(String name) {
97119
this.type(SeriesType.chord);
98120
}
99121

122+
/**
123+
* 设置categories值
124+
*
125+
* @param categories
126+
*/
127+
public Chord categories(List<Category> categories) {
128+
this.categories = categories;
129+
return this;
130+
}
131+
132+
/**
133+
* 设置nodes值
134+
*
135+
* @param nodes
136+
*/
137+
public Chord nodes(List<Node> nodes) {
138+
this.nodes = nodes;
139+
return this;
140+
}
141+
142+
/**
143+
* 设置links值
144+
*
145+
* @param links
146+
*/
147+
public Chord links(List<Link> links) {
148+
this.links = links;
149+
return this;
150+
}
151+
152+
/**
153+
* 力导向图中节点的分类
154+
*/
155+
public List<Category> categories() {
156+
if (this.categories == null) {
157+
this.categories = new ArrayList<Category>();
158+
}
159+
return this.categories;
160+
}
161+
162+
/**
163+
* 添加节点分类
164+
*
165+
* @param values
166+
* @return
167+
*/
168+
public Chord categories(Category... values) {
169+
if (values == null || values.length == 0) {
170+
return this;
171+
}
172+
this.categories().addAll(Arrays.asList(values));
173+
return this;
174+
}
175+
176+
/**
177+
* 添加节点分类,使用分类名
178+
*
179+
* @param names
180+
* @return
181+
*/
182+
public Chord categories(String... names) {
183+
if (names == null || names.length == 0) {
184+
return this;
185+
}
186+
for (String name : names) {
187+
this.categories().add(new Category(name));
188+
}
189+
return this;
190+
}
191+
192+
/**
193+
* 添加节点分类,使用分类名
194+
*
195+
* @param values
196+
* @return
197+
*/
198+
public Chord categories(Object... values) {
199+
if (values == null || values.length == 0) {
200+
return this;
201+
}
202+
for (Object value : values) {
203+
if (value instanceof String) {
204+
this.categories().add(new Category((String) value));
205+
} else if (value instanceof Category) {
206+
this.categories().add((Category) value);
207+
}
208+
//其他忽略
209+
}
210+
return this;
211+
}
212+
213+
/**
214+
* 力导向图的顶点数据
215+
*/
216+
public List<Node> nodes() {
217+
if (this.nodes == null) {
218+
this.nodes = new ArrayList<Node>();
219+
}
220+
return this.nodes;
221+
}
222+
223+
/**
224+
* 添加力导向图的顶点数据
225+
*
226+
* @param values
227+
* @return
228+
*/
229+
public Chord nodes(Node... values) {
230+
if (values == null || values.length == 0) {
231+
return this;
232+
}
233+
this.nodes().addAll(Arrays.asList(values));
234+
return this;
235+
}
236+
237+
/**
238+
* 力导向图的边数据
239+
*/
240+
public List<Link> links() {
241+
if (this.links == null) {
242+
this.links = new ArrayList<Link>();
243+
}
244+
return this.links;
245+
}
246+
247+
/**
248+
* 添加力导向图的边数据
249+
*
250+
* @param values
251+
* @return
252+
*/
253+
public Chord links(Link... values) {
254+
if (values == null || values.length == 0) {
255+
return this;
256+
}
257+
this.links().addAll(Arrays.asList(values));
258+
return this;
259+
}
260+
261+
/**
262+
* 获取ribbonType值
263+
*
264+
* @return
265+
*/
266+
public Boolean ribbonType(){
267+
return this.ribbonType;
268+
}
269+
270+
/**
271+
* 设置ribbonType值
272+
*
273+
* @param ribbonType
274+
* @return
275+
*/
276+
public Chord ribbonType(Boolean ribbonType){
277+
this.ribbonType = ribbonType;
278+
return this;
279+
}
280+
100281
/**
101282
* 获取padding值
102283
*/
@@ -299,6 +480,38 @@ public Chord matrix(Object[][] matrix) {
299480
return this;
300481
}
301482

483+
public List<Category> getCategories() {
484+
return categories;
485+
}
486+
487+
public void setCategories(List<Category> categories) {
488+
this.categories = categories;
489+
}
490+
491+
public List<Node> getNodes() {
492+
return nodes;
493+
}
494+
495+
public void setNodes(List<Node> nodes) {
496+
this.nodes = nodes;
497+
}
498+
499+
public List<Link> getLinks() {
500+
return links;
501+
}
502+
503+
public void setLinks(List<Link> links) {
504+
this.links = links;
505+
}
506+
507+
public Boolean getRibbonType() {
508+
return ribbonType;
509+
}
510+
511+
public void setRibbonType(Boolean ribbonType) {
512+
this.ribbonType = ribbonType;
513+
}
514+
302515
/**
303516
* 获取padding值
304517
*/

src/main/java/com/github/abel533/echarts/series/force/Node.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,26 @@ public Node name(String name) {
7373
return this;
7474
}
7575

76+
/**
77+
* 获取label值
78+
*
79+
* @since 2.1.9
80+
*/
81+
public String label() {
82+
return (String) get("label");
83+
}
84+
85+
/**
86+
* 设置label值
87+
*
88+
* @param label
89+
* @since 2.1.9
90+
*/
91+
public Node label(String label) {
92+
put("label", label);
93+
return this;
94+
}
95+
7696
/**
7797
* 获取value值
7898
*/
@@ -413,4 +433,20 @@ public Integer getCategory() {
413433
public void setCategory(Integer category) {
414434
put("category", category);
415435
}
436+
437+
/**
438+
* 获取label值
439+
*/
440+
public String getLabel() {
441+
return (String) get("label");
442+
}
443+
444+
/**
445+
* 设置label值
446+
*
447+
* @param label
448+
*/
449+
public void setLabel(String label) {
450+
put("label", label);
451+
}
416452
}

0 commit comments

Comments
 (0)