A tool generating local images based on ECharts-Java

Overview

Test plan

  • Local unit testing
  • Docker
  • AWS remote
    • Linux
    • Windows
    • MacOS
  • Integration Test with Snapshot version

Introduction

This library is used to take snapshots of the charts generated by ECharts-Java. Now it supports images in PNG and JPEG formats with pixelRatio control. Base64 is also supported. We plan to support SVG in the near future. (It is still in the testing stage, please file an issue if you spot a bug.).

Prerequisite

To use this library, make sure you've installed phantomjs.

For Mac users using brew,

brew install phantomjs

For AWS Linux users,

sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2

sudo mkdir /opt/phantomjs

bzip2 -d phantomjs-2.1.1-linux-x86_64.tar.bz2

sudo tar -xvf phantomjs-2.1.1-linux-x86_64.tar --directory /opt/phantomjs/ --strip-components 1

sudo ln -s /opt/phantomjs/bin/phantomjs /usr/bin/phantomjs

For other users, please refer to the official website of phantomjs for downloading details.

For Mac users, if you encounter the error "phantomjs cannot be opened because the developer cannot be verified.", please refer to the solution here.

Installation

For a maven project, includes the following in your pom.xml

TBC

For a gradle project, includes the following

TBC

Usage

Snapshot.java is providing several APIs to be used, which includes takeSnapshot() and saveSnapshot().

SnapshotSettingsBuilder.java

It constructs an object with the following properties related to metadata of the snapshot.

Required:

  • String fileType: the fileType of the image. Now we support "png" and "jpg".
  • Option option: must have this field if Chart chart is not specified. This is the option object of ECharts.
  • Chart<?,?> chart: must have this field if Option option is not specified. This is the chart object defined in ECharts-Java.

Optional:

  • int delay: the waiting time (in second) of an image to be fully rendered. Since some ECharts have the animation effects, it is suggested to wait for a few seconds before making a snapshot. The default value is 2.
  • double pixelRation: the pixel ration of an image. It is defined here.

takeSnapshot(SnapshotSettingsBuilder settings)

This function takes an object related to the settings of snapshot, and returns a base64 string of the image.

    SnapshotSettingsBuilder builder = new SnapshotSettingsBuilder(option, "png");
    return Snapshot.takeSnapshot(builder);

saveSnapshot(String imageData, String path)

This function takes the base64 string of an image, and saves the image by the suffix specified by path. E.g. if the path is ./test.png, it will store the image as png file. Now only PNG and JPG are supported. Any other file types will lead to a file with plain base64 string of that image. Note that the file type should be consistent with the one used in takeSnapshot.

    SnapshotSettingsBuilder builder = new SnapshotSettingsBuilder(option, "jpg", 1, 2);
    Snapshot.saveSnapshot(Snapshot.takeSnapshot(builder), "./test.jpg");
You might also like...

Project for coding information into images via teganography and cryptography.

Project for coding information into images via teganography and cryptography.

SecurePic This project is created as part of the 'Software Engineering' lecture in summer semester 2022 in the Applied Computer Science course at DHBW

Jun 6, 2022

Z2Laser - a simple Java-based tool to convert Z movements in your G-Code files to Laser on or off commands

Z2Laser - a simple Java-based tool to convert Z movements in your G-Code files to Laser on or off commands

Feb 20, 2022

Team 5468's 2022 FRC robot code. This code is written in Java and is based off of WPILib's Java control system and utilizes a command based system

FRC 2022 Team 5468's 2022 FRC robot code. This code is written in Java and is based off of WPILib's Java control system and utilizes a command based s

Oct 4, 2022

This app/widget is based on the work of Anthony (tonesto7), which is in turn based on the earlier work of David Schablowsky

This app/widget is based on the work of Anthony (tonesto7), which is in turn based on the earlier work of David Schablowsky

Mustang Mach-E Widget for Android Intro This app/widget is based on the work of Anthony (tonesto7), which is in turn based on the earlier work of Davi

Nov 15, 2022

A Text Based, Turn-Based, Strategy Game to be played in console

ConsoleGame A Text Based, Turn-Based, Strategy Game to be played in console. Feel free to fix any retardation in my code (meaning bugs, stupid/spaghet

Jul 17, 2022

JHook - A tool that can dynamically modify Java classes at runtime.

JHook A tool that can dynamically modify Java classes at runtime. Demo Tested on Java 1.8 - Java 17, just support JDK package com.binklac.jhook.test;

Dec 23, 2022

Sniffy - interactive profiler, testing and chaos engineering tool for Java

Sniffy - interactive profiler, testing and chaos engineering tool for Java

Sniffy Sniffy is a Java profiler which shows the results directly in your browser. It also brings profiling to your unit (or rather component) tests a

Dec 23, 2022

A tool which enhances your pojo, powered by java-agent.

A tool which enhances your pojo, powered by java-agent.

Oct 8, 2022

Classpy is a GUI tool for investigating Java class file, Lua binary chunk, Wasm binary code, and other binary file formats.

Classpy is a GUI tool for investigating Java class file, Lua binary chunk, Wasm binary code, and other binary file formats.

Classpy Classpy is a GUI tool for investigating Java class file, Lua binary chunk, Wasm binary code, and other binary file formats. Inspiration This t

Dec 17, 2022
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
Aye - an open source tool for scanning images on Kubernetes cluster

Aye is an open source tool for scanning images on Kubernetes cluster. It uses Anchore CLI behind the scenes to get information about all images that are currently on the cluster. It also provides Prometheus metrics for each image, so teams are aware of different levels of vulnerabilities found inside them.

null 4 Sep 4, 2022
A command-line tool to generate different types of noise as images.

noisegen A command-line tool to generate different types of noise as images. Usage Run one of the releases, either the JAR using java -jar noisegen-0.

Tommy Ettinger 6 Jul 21, 2022
Save local logcat via Java wiithout root

Save Logcat Android Simple way to save local logcat via Java wiithout root. It does not save full logcat from device, just only from the app. Save log

Menu Modder 5 Jun 30, 2022
JavaFX or Swing + jpackage + Maven template project for generating native desktop applications.

Java + Maven + GitHub Actions = Native Desktop Apps JavaFX or Swing + jpackage + Maven template project for generating native desktop applications. Go

Will Iverson 243 Dec 24, 2022
🏗 Build container images for your Java applications.

Jib ☑️ Jib User Survey What do you like best about Jib? What needs to be improved? Please tell us by taking a one-minute survey. Your responses will h

null 12.4k Jan 9, 2023
Processing and node.js project for rendering MouseGAN images from RunwayML

Computer MouseGAN Processing and node.js project for rendering MouseGAN images from RunwayML. Usage Clone or download this repository. git clone https

Coding Train 17 Apr 1, 2022
a simple program to turn stockX images into gifs!

StockX Gif Converter make stockx images look cool Idea I got this idea from Fyko/stockx-gif-next Usage import me.brennan.stockxgiffer.StockXGiffer; p

Brennan 7 Jul 19, 2022
An Android library for managing images and the memory they use.

Fresco Fresco is a powerful system for displaying images in Android applications. Fresco takes care of image loading and display, so you don't have to

Meta 16.9k Jan 3, 2023
Powerful and flexible library for loading, caching and displaying images on Android.

Universal Image Loader The great ancestor of modern image-loading libraries :) UIL aims to provide a powerful, flexible and highly customizable instru

Sergey Tarasevich 16.8k Jan 2, 2023
Library to generate images from layers

react-native-image-generator Library for generate images from other images Installation yarn add react-native-image-generator Usage import { generate

Evgeny Usov 13 Nov 16, 2022