Git Product home page Git Product logo

highcharts-serverside-export's Introduction

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 :

  • Java API corresponding to Highcharts model (kept compatible with Highcharts model hierarchy and properties),
  • Rhino-Apache Batik based renderer : java ChartOptions ==> Rhino ==> Highcharts ==> SVG ==> image (png, JPEG, etc...),

Usage

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

  • With Highcharts, you would generate a javascript chartOptions, which is shown in browser
  • Here, you generate a java chartOptions (same hierarchy, same properties), which is converted in image stream (using Rhino, Highcharts and Batik)

Getting Help

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

Highcharts

Highcharts Serverside Export java doc

  • See embeded java doc (./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"));
	...

}

  • export directory You can choose the export directory by changing the java line :

    • windows : File exportDirectory = new File ("D:\");
    • linux : File exportDirectory = new File ("/home/myself/export-dir");
    • ...
  • SimpleExample shows several cases of charts export :

    • from 'java' chartOptions (column-basic) to png file,
    • from 'java' chartOptions (pie-chart) to png file,
    • from 'java' chartOptions (time-data-with-irregular-intervals) to jpeg file,
    • from 'json' chartOptions (column-basic) to png file,
    • from 'java' chartOptions (column-basic) to json chartOptions (as a String).
  • Please note that following trace do not mean a mistake : log4j:WARN No appenders could be found for logger (org.one2team.highcharts.server.export.util.SVGHighchartsHelper). log4j:WARN Please initialize the log4j system properly. ERROR: The JPEG quality has not been specified. Use the default one: no compression

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

Running the sample

  • jars All the dependencies files are provided in ./lib/

  • Eclipse : The framework is eclipse ready.

    • open the project in eclipse,
    • run SimpleExport
  • other IDE

    • open the project in your favorite IDE,
    • declare all the ./lib jars as dependencies in your project,
    • run SimpleExport

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.

highcharts-serverside-export's People

Contributors

one2team avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

highcharts-serverside-export's Issues

support for new version of highcharts?

Highcharts version 2.3.2 is now out, and they anticipate version 3 in Q3 or Q4 of 2012. Are there plans to update this project for compatibility with the new Highcharts versions? I hope? :-)

The plotted chart is empty even though ChartOption has value in it

Hi,

Forn highcharts-serverside-export source, created maven project with java, JS and jars to be used in my project. My project is Spring-MVC project. I used the sample example provided by highcharts-serverside-export source in my project but it have following problem while exporting chart.

  1. Created a ChartOptions. This ChartOptions have all the data points need to draw the chart.
  2. highcharts-serverside-export exported to PNG with out a graph. The PNG have the chart Title, Sub Title and cordinate name but not the graph. There were no server error while exporting.

Can you help me?

Can't find js file : env.rhino-1.2.js

I'm getting the following error when trying to use this lib:

cannot find js file : env.rhino-1.2.js

Where should this file be found from?

Regards,

Sandeep

Problem with <br> on Highcharts server-side exporter

I am having break tag on Data Labels of highcharts to break that into multi-lines,which leads to exception.
Separately Rhino holds good with break tag.
Separately Highcharts too holds good with break tag,but with one2team break tag is failing,kindly help me on that.

Pie start angle not working

I am working on building a donut chart and the chart renders perfectly in a browser but the rotation is not correct when exporting the image. Any ideas on if this will be fixed?

So far awesome tool though.

doughnut

Can't find js file : env.rhino-1.2.js

I'm getting the following error when trying to use this lib:

Cannot find js file : env.rhino-1.2.js

Where should this file be found from?

Regards,

Greg

problem passing null values to json i.e for missing points

I am using highcharts server side export.I am trying to render an image of graph..I am using json.I have null values(for missing points) in series data.But json is not accepting null unless we give it as 'null'.Due to this the graph image is not getting displayed properly.Can you please help me how to pass data for missing values to json in highcharts serverside export one2team.
For example the data series i have given is

"name:"

  • "'ACTUAL FORECAST'" + ","
  • "fillOpacity:" + "'0.1'" + "," + "data:" + "[" +
    "100000," + "350000," + "441000," + " 'null'," + " 'null'," + " 'null'," + " 'null'," + " 'null'," + " 'null',"
  • " 'null' " +
    Thank you,
    Jackson

Disable credits not working

I have this code:

HighchartsFactory factory = new JSMHighchartsFactory();
ChartOptions chartOptions = factory.createChartOptions();
chartOptions.getCredits().setEnabled(false);
/* more code */

And the resulting PNG is exported with "HighCharts.com" on the bottom right of the image.
There is anything missing on the code?

Appreciate your help.
best regards

Doesn't work with highcharts 2.1.4 - 2.2.1

I've spend few days trying to make it work for at least 2.1.4 or higher... I've got different types of errors and couldn't.
Any plans to support 2.2.1? maybe someone have the solution already?

Exception while running SimpleExport.java

We are looking to export highcharts based charts on the server side. I have deployed the dependent jars on eclipse and I tried running the sample SimpleExport.java, I get the below exception. We are using highcharts 2.2.3. Let me know what is it I am missing?

org.apache.batik.bridge.BridgeException: null:-1
The attribute "y" of the element is invalid
at org.apache.batik.bridge.SVGRectElementBridge.buildShape(SVGRectElementBridge.java:119)
at org.apache.batik.bridge.SVGShapeElementBridge.createGraphicsNode(SVGShapeElementBridge.java:60)
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:213)
at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:219)
at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
at org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:82)
at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:208)
at org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTranscoder.java:92)
at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:142)
at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)
at org.one2team.highcharts.server.export.SVGStreamRenderer.render(SVGStreamRenderer.java:30)
at org.one2team.highcharts.server.export.HighchartsExporter.render(HighchartsExporter.java:44)
at org.one2team.highcharts.server.export.HighchartsExporter.export(HighchartsExporter.java:26)
at examples.SimpleExport.main(SimpleExport.java:34)

Does HighCharts supports jdk1.5?

Hi,

I have my application that uses jdk1.5 and i want to draw charts in my application using highcharts server side library.
Though the compilation of the highcharts java source code has given some problems using jdk1.5,i changed the code by not having override annotation and it got compiled using jdk1.5.

when i execute the highcharts library code in my application ,iam getting the below error.

java.lang.NoSuchFieldError: shellContextFactory
at org.one2team.highcharts.server.export.util.SVGRendererInternal.getContextFactory(SVGRendererInternal.java:188)
at org.one2team.highcharts.server.export.util.SVGRendererInternal.getSVG(SVGRendererInternal.java:42)
at org.one2team.highcharts.server.export.SVGRenderer.render(SVGRenderer.java:26)

Can you please help me on this regard?Also,how does highcharts server side library supports jdk1.5?

Thanks in advance,
Iniyavan

Creating advance charts

Hi,
I´m trying to test this tool and I have seen serveral types of charts that I can create (area, areaspline, column, line, pie, scatter and table) but I don´t find advance charts like 'heatmap', 'bubble chart', 'dynamic chart', 'gauges' ... I´m testing what I will be able to create with this tool.

Thanks

what i missed

if i change highcharts.js to lastest version,It will throw exception like that:

org.mozilla.javascript.EcmaError: TypeError: Cannot find function attachEvent in object [object HTMLDocument]. (highcharts.src.js#14361)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)
at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3660)
at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3679)
at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3743)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2247)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2214)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3143)
at script(highcharts.src.js:14361)
at script(highcharts.src.js:14380)
at script(highcharts.src.js:13071)
at script(highcharts.src.js:12983)
at script(highcharts.src.js:12957)
at script.renderSVGFromObject(svg-renderer-highcharts.js:23)
at script.renderSVGFromJson(svg-renderer-highcharts.js:2)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
at org.mozilla.javascript.Context$1.run(Context.java:504)
at org.mozilla.javascript.Context.call(Context.java:515)
at org.mozilla.javascript.Context.call(Context.java:502)
at org.mozilla.javascript.ScriptableObject.callMethod(ScriptableObject.java:1906)

so what shold i do when use the new version of highchart and export js

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.