Skip to content

Commit

Permalink
Merge pull request #46 from freelyshadow/master
Browse files Browse the repository at this point in the history
增加图例类型
  • Loading branch information
abel533 committed Jun 24, 2018
2 parents 6f94b23 + e49597a commit ce62f4f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/main/java/com/github/abel533/echarts/Legend.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package com.github.abel533.echarts;

import com.github.abel533.echarts.code.Align;
import com.github.abel533.echarts.code.LegendType;
import com.github.abel533.echarts.code.Orient;
import com.github.abel533.echarts.style.TextStyle;
import lombok.Getter;
Expand All @@ -44,6 +45,12 @@ public class Legend extends Basic<Legend> implements Data<Legend>, Component {
* @see com.github.abel533.echarts.code.Orient
*/
private Orient orient;

/**
* 设置分页方式
*/
private LegendType type ;

/**
* 图例图形宽度
*/
Expand Down Expand Up @@ -93,6 +100,15 @@ public Legend(Object... values) {
this.data(values);
}

public LegendType type(){
return this.type;
}

public Legend type(LegendType type) {
this.type = type;
return this;
}

public Align align() {
return this.align;
}
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/com/github/abel533/echarts/code/LegendType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.github.abel533.echarts.code;

/**
* 图例类型
*
*/
public enum LegendType {
plain,scroll
}
3 changes: 2 additions & 1 deletion src/test/java/com/github/abel533/echarts/OptionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import com.github.abel533.echarts.axis.CategoryAxis;
import com.github.abel533.echarts.axis.ValueAxis;
import com.github.abel533.echarts.code.LegendType;
import com.github.abel533.echarts.code.MarkType;
import com.github.abel533.echarts.code.Tool;
import com.github.abel533.echarts.code.Trigger;
Expand All @@ -45,7 +46,7 @@ public class OptionTest {
@Test
public void basicOption() {
EnhancedOption option = new EnhancedOption();
option.legend().padding(5).itemGap(10).data("ios7", "android4");
option.legend().padding(5).itemGap(10).type(LegendType.scroll).data("ios7", "android4");
option.toolbox().show(true).feature(Tool.dataView, Tool.saveAsImage, Tool.dataZoom, Tool.magicType);
option.tooltip().trigger(Trigger.item);
option.xAxis(new CategoryAxis().data("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"));
Expand Down

0 comments on commit ce62f4f

Please sign in to comment.