commit 09519252c5ee3d6f600baeefd53297ed14170b16 Author: hongawen <83944980@qq.com> Date: Sun Jun 25 13:33:19 2023 +0800 初始化 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f8dae52 --- /dev/null +++ b/.gitignore @@ -0,0 +1,44 @@ +# Compiled class file +*.class + +# Log file +*.log + +# Test file +test.html + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +.classpath +.project +.settings/ +.vscode/ +target/ + +.apt_generated/ +.apt_generated_tests/ + +.factorypath + +.DS_Store + +scripts/java +scripts/*.ts +scripts/*.json +/.idea/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..01442c4 --- /dev/null +++ b/README.md @@ -0,0 +1,172 @@ +
+ logo +
+

ECharts Java

+

+ "We bring better visualization into Java with ECharts" +

+

+ + Github Actions Status + + + Contributions welcome + + + + License + + + Maven Central + +

+ +[中文 README](README.zh.md) + +[Official Documentation](https://echarts.icepear.org/#/) +## 📙 Introduction + +ECharts Java is a lightweight but comprehensive library for Java developers to easily use JavaScript visualization library [Apache ECharts](https://echarts.apache.org/en/index.html). The simple chart mode facilitates users to write visualization fast and easily, empowered by the clean APIs provided by ECharts Java. The advanced mode helps create an `Option` object and its Json representation in chainable Java codes, which includes almost all the features defined in [Apache ECharts](https://echarts.apache.org/en/index.html). Now ECharts Java supports Apache ECharts version 5.x. + +## 🌠 Features + +- Simple, clean and organized APIs, supporting method chaining + +- Full coverage of [Apache ECharts](https://echarts.apache.org/en/index.html) functionalities + +- Easily integrate with Web Frameworks + +- Flexible export format, including HTML and images + +- Complete and detailed documentation and examples + +## 🔬 Installation + +For a Maven project, includes the following in your pom.xml +```xml + + org.icepear.echarts + echarts-java + 1.0.7 + +``` + +For a Gradle Groovy project, includes +``` +implementation 'org.icepear.echarts:echarts-java:1.0.7' +``` + +For more, refer to [here](https://search.maven.org/artifact/org.icepear.echarts/echarts-java/1.0.7/jar). + +## 🔭 Usage + +### Generate Local HTML and Download Image + +```java +public static void main(String[] args) { + // All methods in EChart Java supports method chaining + Bar bar = new Bar() + .setLegend() + .setTooltip("item") + .addXAxis(new String[] { "Matcha Latte", "Milk Tea", "Cheese Cocoa", "Walnut Brownie" }) + .addYAxis() + .addSeries("2015", new Number[] { 43.3, 83.1, 86.4, 72.4 }) + .addSeries("2016", new Number[] { 85.8, 73.4, 65.2, 53.9 }) + .addSeries("2017", new Number[] { 93.7, 55.1, 82.5, 39.1 }); + Engine engine = new Engine(); + // The render method will generate our EChart into a HTML file saved locally in the current directory. + // The name of the HTML can also be set by the first parameter of the function. + engine.render("index.html", bar); +} +``` +multi-bar-render + +### Generate Option Object and its JSON Representation + +```java +public static void main(String[] args) { + Line lineChart = new Line() + .addXAxis(new CategoryAxis() + .setData(new String[] { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" }) + .setBoundaryGap(false)) + .addYAxis() + .addSeries(new LineSeries() + .setData(new Number[] { 820, 932, 901, 934, 1290, 1330, 1320 }) + .setAreaStyle(new LineAreaStyle())); + Engine engine = new Engine(); + // It is recommended that you can get the serialized version of Option in the representation of JSON, which can be used directly in the template or in the RESTful APIs. + String jsonStr = engine.renderJsonOption(lineChart); +} +``` + +The output JSON object will be like the following, + +```json +{ + "xAxis": [ + { + "type": "category", + "data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], + "boundaryGap": false + } + ], + "yAxis": [{ "type": "value" }], + "series": [ + { + "type": "line", + "data": [820, 932, 901, 934, 1290, 1330, 1320], + "areaStyle": {} + } + ] +} +``` + +### Integrate with Spring Web Application + +spring-boot-integration + +For demo codes, please refer to the [docs](https://echarts.icepear.org/) and [example repo](https://github.com/incandescentxxc/ECharts-Java-Examples). + +## 🎇 Gallery + +

+ + + + + + + + + + + + + + + + + + + + + + +

+ +## 💡 Authors +- [@IcePear-Jzx](https://github.com/IcePear-Jzx) +- [@incandescentxxc](https://github.com/incandescentxxc) + +Welcome more contribution in the community! + +## 💌 Acknowledgement +- This project is inspired by the Homework 6 of the course [Principles of Software Construction Objects, Design, and Concurrency](https://cmu-17-214.github.io/f2021/), Fall 2021, at [Carnegie Mellon University](https://www.cmu.edu/). We sincerely thank [Christian](https://www.cs.cmu.edu/~ckaestne/) and [Vincent](https://vhellendoorn.github.io/) for the wonderful course. + +- This project is also inspired by the [pyecharts](https://github.com/pyecharts/pyecharts) and [go-echarts](https://github.com/go-echarts/go-echarts), which are the ECharts siblings in Python and Go languages. + +## 🎈 License + +ECharts Java is available under the [Apache License 2.0](LICENSE). diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..67225d7 --- /dev/null +++ b/pom.xml @@ -0,0 +1,218 @@ + + + + 4.0.0 + + com.njcn + echarts5-java + 0.0.1 + + ECharts5 Java + + 基于《echarts-java》基础上进一步丰富 + + + + + nexus-releases + Nexus Release Repository + http://192.168.1.13:8001/nexus/content/repositories/releases/ + + + nexus-snapshots + Nexus Snapshot Repository + http://192.168.1.13:8001/nexus/content/repositories/snapshots/ + + + + + + njcn + hongawen + 83944980.com + + + + + UTF-8 + 8 + 8 + + + + + junit + junit + 4.12 + test + + + + org.projectlombok + lombok + 1.18.22 + provided + + + + com.google.code.gson + gson + 2.8.9 + + + com.github.jknack + handlebars + 4.2.1 + + + org.slf4j + slf4j-simple + 1.7.25 + + + + + + release + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + + 8 + -Xdoclint:all -Xdoclint:-missing + + + -Xdoclint:all + -Xdoclint:-missing + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.1 + + + + org.projectlombok + lombok + 1.18.22 + + + + + + maven-surefire-plugin + 2.22.1 + + + maven-jar-plugin + 3.0.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + maven-site-plugin + 3.7.1 + + + maven-project-info-reports-plugin + 3.0.0 + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.2 + + + com.puppycrawl.tools + checkstyle + 9.1 + + + + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.2 + + checkstyle.xml + + + + org.apache.maven.plugins + maven-jxr-plugin + 3.1.1 + + + + diff --git a/src/main/resources/base.hbs b/src/main/resources/base.hbs new file mode 100644 index 0000000..999b3cb --- /dev/null +++ b/src/main/resources/base.hbs @@ -0,0 +1,28 @@ + + + + + + ECharts Demo + + + + + +
+
+ + + + \ No newline at end of file diff --git a/src/main/resources/index.hbs b/src/main/resources/index.hbs new file mode 100644 index 0000000..e83217f --- /dev/null +++ b/src/main/resources/index.hbs @@ -0,0 +1,70 @@ + + + + + + ECharts Demo + + + + + +
+
+

ECharts Java

+ +
+
+
+
+ + + + + \ No newline at end of file