Skip to content

wqq-java/ECharts-Java

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

175 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ECharts Java

ECharts ❤️ Java = ECharts Java

Github Actions Status Contributions welcome License Maven Central

Introduction

ECharts Java is a lightweight but comprehensive library for Java developers to easily use JavaScript visualization library Apache ECharts. 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.

Features

  • Simple, clean and organized APIs, supporting method chaining

  • Full coverage of Apache ECharts functionalities

  • Easily integrate with Web Frameworks

  • Flexible export format, including HTML and images

  • Complete and detailed documentation and examples

Installation

For Maven project, includes the following in your pom.xml

<dependency>
  <groupId>org.icepear.echarts</groupId>
  <artifactId>echarts-java</artifactId>
  <version>1.0.0</version>
</dependency>

For Gradle Groovy project, includes

implementation 'org.icepear.echarts:echarts-java:1.0.0'

For more, refer to here.

Usage

Generate Local HTML and Download Image

public static void main(String[] args) {
    Bar bar = new Bar()
            .setTooltip(new Tooltip().setTrigger("axis")
                    .setAxisPointer(new TooltipAxisPointer().setType("shadow")))
            .setLegend(true)
            .addXAxis()
            .addYAxis(new String[] { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" })
            .addSeries(createSeries("Direct", new Number[] { 320, 302, 301, 334, 390, 330, 320 }))
            .addSeries(createSeries("Mail Ad", new Number[] { 120, 132, 101, 134, 90, 230, 210 }))
            .addSeries(createSeries("Affiliate Ad", new Number[] { 220, 182, 191, 234, 290, 330, 310 }))
            .addSeries(createSeries("Video Ad", new Number[] { 150, 212, 201, 154, 190, 330, 410 }))
            .addSeries(createSeries("Search Engine", new Number[] { 820, 832, 901, 934, 1290, 1330, 1320 }));
    Engine engine = new Engine();
    engine.render("index.html", bar);
}

multi-bar-render

Generate Option Object and its Json Representation

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();
    String jsonStr = engine.renderJsonOption(lineChart);
}

Json Representation

Integrate with Spring Web Application

spring-boot-integration

For demo codes, please refer to the docs and example repo.

Gallery

TODO

Authors

Welcome more contribution in the community!

Acknowledgement

License

ECharts Java is available under the Apache License 2.0.

About

A Java Visualization Library based on Apache ECharts 5.x. 基于 Apache ECharts 5.x 的 Java 可视化类库。

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Java 98.2%
  • Python 1.5%
  • Handlebars 0.3%