# ECharts-Java **Repository Path**: zhfnss/ECharts-Java ## Basic Information - **Project Name**: ECharts-Java - **Description**: ECharts Java 是一款基于 Apache ECharts 的,简易但全面的数据可视化库。(现支持 Apache ECharts 5.x 版本)。 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 16 - **Forks**: 4 - **Created**: 2023-10-16 - **Last Updated**: 2025-06-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
"We bring better visualization into Java with ECharts"
[中文 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
### 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
For demo codes, please refer to the [docs](https://echarts.icepear.org/) and [example repo](https://github.com/incandescentxxc/ECharts-Java-Examples).
## 🎇 Gallery