HyJavaImages HTTP Server

the java api for highcharts

The HyJavaImages HTTP Server is an ADD-ON for the HyJavaImages library. It allows all HyJavaImages requests to be routed to a shared HyJavaImages HTTP server.

This functionality is useful in situations where you have multiple applications using the HyJavaImages library and will allow for efficient use of server resources.

The differences in operation between the standard HyJavaImages library and the HyJavaImages HTTP server are described below.

STANDARD LIBRARY USAGE

Out of the box the HyJavaImages library allows for 2 modes of operation.

Option 1.
Use the Chrome.start() method. This will start a Chrome headless server, creating the specified number of pool pages. The application will have exclusive use of this Chrome headless server.

Option 2.
Use the Chrome.connect() method. This will connect to an existing running Chrome headless server, creating the specified number of pool pages. The application will have exclusive use of the created pool pages but will share the Chrome headless server with other applications.

HTTP SERVER USAGE

The HyJavaImages HTTP server ADD-ON gives us a third option.

Option 3.
Use the Chrome.setViaHTTPServerURL() method. All HyJavaImages image generation methods will now route requests to the HyJavaImages HTTP server.

The HyJavaImages HTTP server will be launched separately by the provided script. The HTTP server will start a Chrome headless server, creating the specified number of pool pages. The HTTP server will have exclusive use of this Chrome headless server.

This allows for efficient use of resources as you will have only one Chrome headless server and one set of pool pages shared by all applications.

The only code change required is to replace the Chrome.start() method with the Chrome.setViaHTTPServerURL() method.

EXAMPLE CODE

// All requests will be routed to the HTTP server
// No need to start or stop the Chrome headless server
Chrome chrome = Chrome.getInstance();
chrome.setViaHTTPServerURL("http://localhost:41772/");

// Generate as many chart images as needed
String base64;
ImageGenerator img = new ImageGenerator();

// Highchart example
img.setJavaScript(LibraryType.HIGHCHARTS, null, "highcharts.js");
base64 = img.toBase64Image("{your chart options...}");    // will now be routed to http://localhost:41772/

// Highstock example
img.setJavaScript(LibraryType.HIGHCHARTS_STOCK, null, "stock/highstock.js");
base64 = img.toBase64Image("{your chart options...}");    // will now be routed to http://localhost:41772/

// ApexCharts example
img.setJavaScript(LibraryType.APEXCHARTS, null);
base64 = img.toBase64Image("{your chart options...}");    // will now be routed to http://localhost:41772/

API DOCUMENTATION

View the API for the HyJavaImages library.

REQUIREMENTS

  • You must have a valid license for the HyJavaImages Library.
  • You must have Chrome 64 or later installed on your system. The library requires a Chrome version that supports the DevTools protocol v1.3.

LIBRARY EVALUATION

A 30 day evaluation version of the HyJavaImages library is available to ensure the library meet your requirements.

The evaluation version is suitable for:

  • Proof of Concept testing
  • Integration testing
  • Performance testing

If you have any further questions on the library or wish to test the evaluation version, please contact our support team via the Contact Us area on the home page.

The Java API’s fully support all chart types and chart options in Highcharts v5.x, v6.x, v7.x, v8.x, v9.x;  Highcharts Stock v8.x, v9.x and ApexCharts v3.x.


Current versions supported are:

HyJavaCharts

HyJavaStock

HyJavaApex

Start the HyJavaCharts demo Java web application


Start the HyJavaStock demo Java web application


Start the HyJavaApex demo Java web application


Start the HyJavaImages demo Java web application