-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
195 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
echarts4j-project/src/main/java/com/github/koooooo7/echarts4j/chart/BarChart.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,29 @@ | ||
package com.github.koooooo7.echarts4j.chart; | ||
|
||
import com.github.koooooo7.echarts4j.option.chart.XAxis; | ||
import com.github.koooooo7.echarts4j.option.chart.YAxis; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
import java.util.Objects; | ||
|
||
@Data | ||
@SuperBuilder | ||
@EqualsAndHashCode(callSuper = true) | ||
public class BarChart extends BaseChart<BarChart> { | ||
@Builder.Default | ||
private ChartType chartType = ChartType.Bar; | ||
|
||
@Override | ||
public void postProcessor() { | ||
super.postProcessor(); | ||
if (Objects.isNull(getChartOptions().getXAxis())) { | ||
getChartOptions().setXAxis(XAxis.builder().build()); | ||
} | ||
if (Objects.isNull(getChartOptions().getYAxis())) { | ||
getChartOptions().setYAxis(YAxis.builder().build()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
echarts4j-project/src/main/java/com/github/koooooo7/echarts4j/chart/LineChart.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,29 @@ | ||
package com.github.koooooo7.echarts4j.chart; | ||
|
||
import com.github.koooooo7.echarts4j.option.chart.XAxis; | ||
import com.github.koooooo7.echarts4j.option.chart.YAxis; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
import java.util.Objects; | ||
|
||
@Data | ||
@SuperBuilder | ||
@EqualsAndHashCode(callSuper = true) | ||
public class LineChart extends BaseChart<LineChart> { | ||
@Builder.Default | ||
private ChartType chartType = ChartType.Line; | ||
|
||
@Override | ||
public void postProcessor() { | ||
super.postProcessor(); | ||
if (Objects.isNull(getChartOptions().getXAxis())) { | ||
getChartOptions().setXAxis(XAxis.builder().build()); | ||
} | ||
if (Objects.isNull(getChartOptions().getYAxis())) { | ||
getChartOptions().setYAxis(YAxis.builder().build()); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
echarts4j-project/src/main/java/com/github/koooooo7/echarts4j/chart/RadarChart.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.github.koooooo7.echarts4j.chart; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
@Data | ||
@SuperBuilder | ||
@EqualsAndHashCode(callSuper = true) | ||
public class RadarChart extends BaseChart<RadarChart> { | ||
@Builder.Default | ||
private ChartType chartType = ChartType.Radar; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
echarts4j-project/src/main/java/com/github/koooooo7/echarts4j/option/chart/Radar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.github.koooooo7.echarts4j.option.chart; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.github.koooooo7.echarts4j.type.FuncStr; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@Builder | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class Radar { | ||
private String id; | ||
@JsonProperty("zlevel") | ||
private Integer zLevel; | ||
private Integer z; | ||
private FuncStr center; | ||
private Object radius; | ||
private List<IndicatorDataItem> indicator; | ||
|
||
|
||
@Data | ||
@Builder | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public static class IndicatorDataItem { | ||
private String name; | ||
private Integer max; | ||
private Integer min; | ||
private String color; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...ect/src/main/java/com/github/koooooo7/echarts4j/option/series/RadarChartSeriesOption.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.github.koooooo7.echarts4j.option.series; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.github.koooooo7.echarts4j.chart.ChartType; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@SuperBuilder | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@EqualsAndHashCode(callSuper = true) | ||
public class RadarChartSeriesOption extends GenericSeriesOption implements SeriesOption { | ||
@Builder.Default | ||
private String type = ChartType.Radar.getType(); | ||
private List<?> data; | ||
|
||
|
||
@Data | ||
@SuperBuilder | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public static class RadarDataItem { | ||
private String name; | ||
private Integer value; | ||
private String groupId; | ||
private String childGroupId; | ||
private String symbol; | ||
private Object symbolSize; | ||
private Integer symbolRotate; | ||
private Boolean symbolKeepAspect; | ||
private List<?> symbolOffset; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
echarts4j-project/src/test/java/com/github/koooooo7/echarts4j/chart/RadarChartTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.github.koooooo7.echarts4j.chart; | ||
|
||
import com.github.koooooo7.echarts4j.helper.DataHelper; | ||
import com.github.koooooo7.echarts4j.option.ChartOption; | ||
import com.github.koooooo7.echarts4j.option.chart.Legend; | ||
import com.github.koooooo7.echarts4j.option.chart.Radar; | ||
import com.github.koooooo7.echarts4j.option.chart.Title; | ||
import com.github.koooooo7.echarts4j.option.series.RadarChartSeriesOption; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.ArrayList; | ||
import java.util.LinkedHashMap; | ||
import java.util.List; | ||
import java.util.concurrent.ThreadLocalRandom; | ||
|
||
public class RadarChartTests { | ||
@Test | ||
void shouldGenerateScatterChart_WhenCallThePieChartConfig_GivenNecessaryConfigs() { | ||
List<Integer> item = new ArrayList<>(); | ||
List<Integer> item2 = new ArrayList<>(); | ||
for (int i = 0; i < 20; i++) { | ||
item.add(ThreadLocalRandom.current().nextInt(5000, 16000)); | ||
item2.add(ThreadLocalRandom.current().nextInt(5000, 16000)); | ||
} | ||
|
||
final List<LinkedHashMap<String, Object>> finalData = DataHelper.create() | ||
.addNameField() | ||
.addValueField(List.class) | ||
.build() | ||
.addData("Promotion", item) | ||
.addData("Baseline", item2) | ||
.get(); | ||
final List<String> legendDate = new ArrayList<>(); | ||
legendDate.add("Allocated Budget"); | ||
legendDate.add("Actual Spending"); | ||
|
||
final List<Radar.IndicatorDataItem> indicator = new ArrayList<>(); | ||
indicator.add(Radar.IndicatorDataItem.builder().name("Sales").max(16500).build()); | ||
indicator.add(Radar.IndicatorDataItem.builder().name("Administration").max(26000).build()); | ||
indicator.add(Radar.IndicatorDataItem.builder().name("Information Technology").max(35000).build()); | ||
indicator.add(Radar.IndicatorDataItem.builder().name("Customer Support").max(16500).build()); | ||
indicator.add(Radar.IndicatorDataItem.builder().name("Development").max(65000).build()); | ||
indicator.add(Radar.IndicatorDataItem.builder().name("Marketing").max(16500).build()); | ||
|
||
Canvas.builder() | ||
.addCharts(RadarChart.builder() | ||
.options(ChartOption.builder() | ||
.title(Title.builder().text("Basic Radar Chart").build()) | ||
.legend(Legend.builder().data(legendDate).build()) | ||
.radar(Radar.builder() | ||
.indicator(indicator) | ||
.build()) | ||
.build() | ||
.addSeries(RadarChartSeriesOption.builder() | ||
.name("P&L") | ||
.data(finalData) | ||
.build())) | ||
.build()) | ||
.build() | ||
.render(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
echarts4j-project/src/test/java/com/github/koooooo7/echarts4j/chart/ScatterTests.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.