Skip to content

Commit cf4092c

Browse files
committed
新增EMap,和Map(地图)类完全相同,只是为了避免和java.util.Map同时使用时不方便
新增简单工厂`SeriesFactory`,提供了所有`Series`子类的创建方法
1 parent c70453e commit cf4092c

File tree

4 files changed

+173
-1
lines changed

4 files changed

+173
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070
- `TreeData`添加缺少的两个属性`symbol``symbolSize`#69
7171
- `AxisPointer`增加`show`属性,该属性出现在scatter6的例子中
7272
- `AbstractData`中的`List<Object> data`属性和相关调用都去掉泛型类型`<Object>`
73+
- 新增`EMap`,和`Map`(地图)类完全相同,只是为了避免和`java.util.Map`同时使用时不方便
74+
- 新增简单工厂`SeriesFactory`,提供了所有`Series`子类的创建方法
7375
- `Legend`通用去掉`<Object>`
7476
- 由于fastjson存在多种bug,从这个版本移除`FsonOption`相关的类
7577

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.github.abel533.echarts.series;
2+
3+
/**
4+
* 和Map完全相同,只是为了避免和java.util.Map重名
5+
*
6+
* @author liuzh
7+
*/
8+
public class EMap extends Map {
9+
public EMap() {
10+
}
11+
12+
public EMap(String name) {
13+
super(name);
14+
}
15+
}
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
package com.github.abel533.echarts.series;
2+
3+
/**
4+
* Series工厂类
5+
*
6+
* @author liuzh
7+
*/
8+
public class SeriesFactory {
9+
10+
public static Tree newTree(){
11+
return new Tree();
12+
}
13+
14+
public static Tree newTree(String name){
15+
return new Tree(name);
16+
}
17+
18+
public static Line newLine(){
19+
return new Line();
20+
}
21+
22+
public static Line newLine(String name){
23+
return new Line(name);
24+
}
25+
26+
public static Gauge newGauge(){
27+
return new Gauge();
28+
}
29+
30+
public static Gauge newGauge(String name){
31+
return new Gauge(name);
32+
}
33+
34+
public static Chord newChord(){
35+
return new Chord();
36+
}
37+
38+
public static Chord newChord(String name){
39+
return new Chord(name);
40+
}
41+
42+
public static Bar newBar(){
43+
return new Bar();
44+
}
45+
46+
public static Bar newBar(String name){
47+
return new Bar(name);
48+
}
49+
50+
public static Scatter newScatter(){
51+
return new Scatter();
52+
}
53+
54+
public static Scatter newScatter(String name){
55+
return new Scatter(name);
56+
}
57+
58+
public static Force newForce(){
59+
return new Force();
60+
}
61+
62+
public static Force newForce(String name){
63+
return new Force(name);
64+
}
65+
66+
public static Radar newRadar(){
67+
return new Radar();
68+
}
69+
70+
public static Radar newRadar(String name){
71+
return new Radar(name);
72+
}
73+
74+
public static Pie newPie(){
75+
return new Pie();
76+
}
77+
78+
public static Pie newPie(String name){
79+
return new Pie(name);
80+
}
81+
82+
public static Venn newVenn(){
83+
return new Venn();
84+
}
85+
86+
public static Venn newVenn(String name){
87+
return new Venn(name);
88+
}
89+
90+
public static K newK(){
91+
return new K();
92+
}
93+
94+
public static K newK(String name){
95+
return new K(name);
96+
}
97+
98+
public static EventRiver newEventRiver(){
99+
return new EventRiver();
100+
}
101+
102+
public static EventRiver newEventRiver(String name){
103+
return new EventRiver(name);
104+
}
105+
106+
public static Island newIsland(){
107+
return new Island();
108+
}
109+
110+
public static Island newIsland(String name){
111+
return new Island(name);
112+
}
113+
114+
public static Funnel newFunnel(){
115+
return new Funnel();
116+
}
117+
118+
public static Funnel newFunnel(String name){
119+
return new Funnel(name);
120+
}
121+
122+
public static Treemap newTreemap(){
123+
return new Treemap();
124+
}
125+
126+
public static Treemap newTreemap(String name){
127+
return new Treemap(name);
128+
}
129+
130+
public static Heatmap newHeatmap(){
131+
return new Heatmap();
132+
}
133+
134+
public static Heatmap newHeatmap(String name){
135+
return new Heatmap(name);
136+
}
137+
138+
public static Map newMap(){
139+
return new Map();
140+
}
141+
142+
public static Map newMap(String name){
143+
return new Map(name);
144+
}
145+
146+
public static WordCloud newWordCloud(){
147+
return new WordCloud();
148+
}
149+
150+
public static WordCloud newWordCloud(String name){
151+
return new WordCloud(name);
152+
}
153+
154+
}

src/test/java/com/github/abel533/echarts/samples/map/MapTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import com.github.abel533.echarts.code.X;
2929
import com.github.abel533.echarts.code.Y;
3030
import com.github.abel533.echarts.data.Data;
31+
import com.github.abel533.echarts.series.EMap;
3132
import com.github.abel533.echarts.series.Map;
3233
import com.github.abel533.echarts.series.MapLocation;
3334
import com.github.abel533.echarts.util.EnhancedOption;
@@ -42,7 +43,7 @@ public class MapTest {
4243
public void test() {
4344
//地址:http://echarts.baidu.com/doc/example/map.html
4445
EnhancedOption option = new EnhancedOption();
45-
Map map = new Map("Map");
46+
EMap map = new EMap("Map");
4647
map.mapLocation(new MapLocation(X.left, Y.top, 500));
4748
map.selectedMode(SelectedMode.multiple);
4849
map.itemStyle().normal().borderWidth(2)

0 commit comments

Comments
 (0)