Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加图例类型 #46

Merged
merged 1 commit into from
Jun 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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