one2team / highcharts-serverside-export

Server side export for highcharts
92 stars 91 forks source link

Highcharts Serverside Export

The primary goal of the Highcharts Serverside Export framework (HSE) is to provide a java API for Highcharts including image generation capabilities.

Solution features :

Usage

You can use the framework to generate in java an image file out of a Highcharts chart.

Getting Help

To start to use it, you need to know Highcharts API.

Highcharts

Highcharts Serverside Export java doc

Rhino

Batik SVG Toolkit

Quick Start

A java sample : SimpleExport (test/examples/SimpleExport.java)

public static void main (String[] args) {

    // This executable expects an export directory as input
    File exportDirectory = new File (args [0]);

    // ====================================================================
    // ChartOptions creation
    // ----------------------
    //  The createHighchartsDemoColumnBasic method describes the creation of 
    //   a java chartOption. It is a java equivalent to javascript Highcharts sample
    //   (see http://highcharts.com/demo/column-basic)
    ChartOptions chartOptions1 = SamplesFactory.getSingleton ().createColumnBasic ();

    // ====================================================================
    // Chart export
    // ----------------
    // Inputs :
    //    1. chartOptions : the java ChartOptions to be exported,
    //    2. exportFile  : file to export to.
    HighchartsExporter pngExporter = ExportType.png.createExporter ();
    pngExporter.export (chartOptions1, null, new File (exportDirectory, "column-basic.png"));
    ...

}

SamplesFactory contains three methods that generate equivalent of Highcharts demo gallery examples :

Running the sample

Copyright and License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.