A Java Visualization Library based on Apache ECharts.

Overview
logo

ECharts Java

"We bring better visualization into Java with ECharts"

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 a Maven project, includes the following in your pom.xml

<dependency>
  <groupId>org.icepear.echartsgroupId>
  <artifactId>echarts-javaartifactId>
  <version>1.0.2version>
dependency>

For a Gradle Groovy project, includes

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

For more, refer to here.

🔭 Usage

Generate Local HTML and Download Image

public static void main(String[] args) {
    // All methods in EChart Java supports method chaining
    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();
    // 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

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,

{
  "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 and example repo.

🎇 Gallery

💡 Authors

Welcome more contribution in the community!

💌 Acknowledgement

🎈 License

ECharts Java is available under the Apache License 2.0.

Comments
  • Complex Encode option question

    Complex Encode option question

    I have now migrated around 60% of my charts to using the ECharts-Java library and have to say it works like a charm. I'm pleasantly surprised that even the more exotic options are exposed through the API, great work!!!

    The part I'm current struggling is to get the more complex Encode to work. For example in a candle stick series I require this as output:

    encode: { x: 0, y: [1, 4, 3, 2] }

    But all examples I could find only have a single key and value. Is the above possible. The following (Kotlin syntax) doesn't compile because setValue doesn't support nested arrays.:

    ` val encode1 = Encode().setItemName(arrayOf("x", "y")).setValue(arrayOf(0, arrayOf(1,4,3,2))

    val series1 = CandlestickSeries() .setEncode(encode1) `

    Thanks in advance for any tips.

    bug 
    opened by jbaron 5
  • add treemap config json files

    add treemap config json files

    I added the configuration json file to generate actual treemap classes. Before generation, I'd like to have these files to be reviewed first. Major things should be noticed include,

    1. TreemapSeriesOption: breadcrumb is the combination of certain fields with BoxLayoutOptionMixin. I created a new file with a new type called TreemapSeriesBreadCrumbOption, which extends BoxLayoutOptionMixin and has those specific fields.
    2. TreemapSeriesBreadCrumbOption: BreadcrumbEmphasisItemStyleOption is a newly named type that does not appear in the original codes.
    3. TreemapSeriesLevelOption: ColorString is actually a type of String, I used "String" directly.
    4. DecalObject: dashArrayX, dashArrayY are some types of Numbers, I used corresponding Number types directly.
    opened by incandescentxxc 4
  • Support for multiple types in one chart

    Support for multiple types in one chart

    Great wrapper around ECharts, also looks easy to use.

    One question I have though, is it possible to mix different series types? For example if I create a CandleStick chart, I can not add series of Line type (or at least not obvious to me how to do this). It seems a chart is limited to a single type (but multiple series of that type can be added), is this correct?

    opened by jbaron 4
  • register custom TypeAdapters

    register custom TypeAdapters

    Would love a way to register Gson custom TypeAdapters so I can stick closer to my domain model for the data in the charts and don't require all types of transformations. Perhaps this is already possible, but couldn't find it in the documentation.

    For example (I use Kotlin), Gson by default doesn't handle Pair, Triple, Instant and my own custom types.

    BTW, I use the engine.renderJsonOption(chart) before sending it to the browser.

    enhancement 
    opened by jbaron 3
  • Dev xxc script

    Dev xxc script

    1. Completed DataZoom and VisualMap Option Interface and Class
    2. Finished WorldPopulationTest
    3. Partially Finished BeijingAQITest with some potential problems to be discussed.
    opened by incandescentxxc 3
  • Great Project

    Great Project

    Not an issue, but a big "Thank You" for releasing this great project.

    I migrated almost all my chart to using the ECharts-Java framework and it works like a charm.

    To see the results, use the below link to open a notebook on mybinder.org (might take some time to build it) and then from the Jupyter menu select "Run -> Run All Cells"

    https://mybinder.org/v2/gh/neurallayer/roboquant-notebook/main?urlpath=lab/tree/tutorials/charts.ipynb

    All the charts you'll see (except the first one) are now using the ECharts-Java library.

    opened by jbaron 2
  • Add support for TreeMap charts

    Add support for TreeMap charts

    Currently there is no support for creating TreeMap type of charts. Would be great to add this (I can then also convert my last chart to ECharts_Java).

    P.S Personally I actually only require little functionality, below is roughly the generated Javascript and as you can see the TreeMap Series specific attributes are very minimal (mostly the breadcrumb attribute). But can imagine others need more functionality.

                {
                    title: {
                        text: 'Asset Performance'
                    },
                    visualMap: {
                       min: -100.0,
                       max: 100.0,
                       dimension: 1,
                       calculable: true,
                       orient: 'horizontal',
                       left: 'center',
                       top: 'top',
                       inRange : { color: ['#FF0000', '#00FF00'] }
                    },
                    tooltip: {
                       position: 'top',
                       formatter: 'some format
                    },
                    toolbox: {
                        feature: {
                            restore: {},
                            saveAsImage: {}
                        }
                    },
                    series : [{
                        name: 'Assets',
                        type: 'treemap',
                        data : ...,
                        breadcrumb : { show: false },
                    }],
                    backgroundColor: 'rgba(0,0,0,0)'
                }
    
    enhancement 
    opened by jbaron 2
  • compilehandlebars bug fixed

    compilehandlebars bug fixed

    1. Fixed a bug in the compileHandleBars function, which prevents compiling assigned templates.
    2. Added corresponding tests for Engine, to avoid such cases happening again.
    opened by incandescentxxc 0
  • 希望可以修改下render方法,以能支持回调函数的写法

    希望可以修改下render方法,以能支持回调函数的写法

    希望可以修改下render方法,以能支持配置中使用回调函数的写法?

    比如: 饼图的Series 里有一个 labelLayout 配置, 这个配置可以写成函数回调的方式: echarts 支持这么设置:

    {
      series:[{
        labelLayout: function (params) {
            const isLeft = params.labelRect.x < myChart.getWidth() / 2;
            const points = params.labelLinePoints;
            // Update the end point.
            points[2][0] = isLeft
              ? params.labelRect.x
              : params.labelRect.x + params.labelRect.width;
            return {
              labelLinePoints: points
            };
          }
       }
      ]
    }
    

    但是 PieSeries 只有这样的配置方法

    PieSeries().setLabelLayout(LabelLayout())
    

    这样怎么配置都没法做到回调里的那种显示方案。

    所以我在想是不是可以弄一个支持回调的类, render 时候可以把这部分渲染为回调函数,以解决这个问题? 比如可以这么配置:

    PieSeries()
       .setLabelLayout(CallbackScript(
         "function (params) {" +
         "   const isLeft = params.labelRect.x < myChart.getWidth() / 2;" +
         "   const points = params.labelLinePoints;" +
         "   // Update the end point." +
         "   points[2][0] = isLeft" +
         "     ? params.labelRect.x" +
         "    : params.labelRect.x + params.labelRect.width;" +
         "  return {" +
         "    labelLinePoints: points" +
         "  };" +
         " }" +
         "}"
    ))
    

    就能在render时得到上面的那个配置

    opened by leacoleaco 0
  • 无法数据转换器

    无法数据转换器 "sort"

    无法 dataset.transform-sort. type = 'sort' 无法构建 { transform: { type: 'sort', config: { dimension: 'score', order: 'desc' } } }

    https://echarts.apache.org/handbook/zh/concepts/data-transform#%E6%95%B0%E6%8D%AE%E8%BD%AC%E6%8D%A2%E5%99%A8-%22sort%22

    https://echarts.apache.org/examples/zh/editor.html?c=data-transform-sort-bar

    opened by xiaomaiyun 0
Releases(v1.0.7)
Owner
ECharts Java Open Source Project
This organization is responsible for the design, develop, and maintain the open source project "ECharts Java".
ECharts Java Open Source Project
Pixeed is an javafx, opencv based photo editing software which is enriched with functionalities listed below.

⭐⭐⭐⭐First Runner Up: ⭐⭐⭐⭐ The only team to dare to take upon themselves the task to make an image editor from scratch. Although it might not be a match for its ubiquitous contemporaries, it has all its basic features covered and easily accessible for even a new user.

Viraj 4 Apr 11, 2022
Simple Java image-scaling library implementing Chris Campbell's incremental scaling algorithm as well as Java2D's "best-practices" image-scaling techniques.

imgscalr - Java Image-Scaling Library http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/ Changelog --------- 4.2 * Added sup

Riyad Kalla 1.1k Jan 5, 2023
Thumbnailator - a thumbnail generation library for Java

March 11, 2021: Thumbnailator 0.4.14 has been released! See Changes for details. Thumbnailator is now available through Maven! What is Thumbnailator?

Chris Kroells 4.5k Jan 5, 2023
ZXing ("Zebra Crossing") barcode scanning library for Java, Android

Project in Maintenance Mode Only The project is in maintenance mode, meaning, changes are driven by contributed patches. Only bug fixes and minor enha

ZXing Project 30.5k Jan 4, 2023
Roman Beskrovnyi 250 Jan 9, 2023
Java library for remapper JARs

Pocolifo's JAR Remapper Making remapping JARs easy, organized, and painless Features Remapping Class remapping Method remapping Field remapping Parame

null 8 Oct 2, 2022
Fast computer vision library for SFM, calibration, fiducials, tracking, image processing, and more.

Table of Contents Introduction Cloning Repository Quick Start Gradle and Maven Building from Source Dependencies Help/Contact Introduction BoofCV is a

Peter Abeles 916 Jan 6, 2023
Java interface to OpenCV, FFmpeg, and more

JavaCV Commercial support: Introduction JavaCV uses wrappers from the JavaCPP Presets of commonly used libraries by researchers in the field of comput

Bytedeco 6.4k Jan 4, 2023
Java JNA wrapper for Tesseract OCR API

Tess4J A Java JNA wrapper for Tesseract OCR API. Tess4J is released and distributed under the Apache License, v2.0. Features The library provides opti

Quan Nguyen 1.3k Dec 28, 2022
TwelveMonkeys ImageIO: Additional plug-ins and extensions for Java's ImageIO

About TwelveMonkeys ImageIO is a collection of plugins and extensions for Java's ImageIO. These plugins extend the number of image file formats suppor

Harald Kuhr 1.6k Jan 5, 2023
Creates ASCII art in Java from Images

Creates ASCII art in Java from Images. It can also save the ASCII art as image (.png) as well

Navjot Singh Rakhra 4 Jul 12, 2022
A tool generating local images based on ECharts-Java

Test plan Local unit testing Docker AWS remote Linux Windows MacOS Integration Test with Snapshot version Introduction This library is used to take sn

ECharts Java Open Source Project 5 Dec 16, 2022
Java dataframe and visualization library

Tablesaw Overview Tablesaw is Java for data science. It includes a dataframe and a visualization library, as well as utilities for loading, transformi

Tablesaw 3.1k Jan 7, 2023
A JavaFX 3D Visualization and Component Library

FXyz3D FXyz3D Core: FXyz3D Client: FXyz3D Importers: A JavaFX 3D Visualization and Component Library How to build The project is managed by gradle. To

null 16 Aug 23, 2020
Flow Visualization Library for JavaFX and VRL-Studio

VWorkflows Interactive flow/graph visualization for building domain specific visual programming environments. Provides UI bindings for JavaFX. See htt

Michael Hoffer 274 Dec 29, 2022
Dex : The Data Explorer -- A data visualization tool written in Java/Groovy/JavaFX capable of powerful ETL and publishing web visualizations.

Dex Dex : The data explorer is a powerful tool for data science. It is written in Groovy and Java on top of JavaFX and offers the ability to: Read in

Patrick Martin 1.3k Jan 8, 2023
A platform for visualization and real-time monitoring of data workflows

Status This project is no longer maintained. Ambrose Twitter Ambrose is a platform for visualization and real-time monitoring of MapReduce data workfl

Twitter 1.2k Dec 31, 2022
IoT Platform, Device management, data collection, processing and visualization, multi protocol, rule engine, netty mqtt client

GIoT GIoT: GIoT是一个开源的IoT平台,支持设备管理、物模型,产品、设备管理、规则引擎、多种存储、多sink、多协议(http、mqtt、tcp,自定义协议)、多租户管理等等,提供插件化开发 Documentation Quick Start Module -> giot-starte

gerry 34 Sep 13, 2022
This is an open source visualization for the C4 model for visualising software architecture.

c4viz: C4 Visualization This is an open source visualization for the C4 model for visualising software architecture. It expects input in the form of a

Peter Valdemar Mørch 40 Dec 6, 2022