Skip to main content
Windward

HTML Output Charts

Overview

How to use the Windward Engine to directly access image data for charts (and other images) in HTML output. (The following does not apply only to charts in HTML -- it applies to any image output to HTML -- but it is probably most useful for charts.) This is very useful if you would like to handle your own image file storage.

Details

When outputting charts to HTML, Windward produces the chart as an image. After running a report in either the Java or .NET engine, all of the image files are saved as bitmap streams which can be accessed directly from the respective API calls.

.NET Engine

For .NET, this is ReportHTML.Bitmaps, which is an array of HtmlBitmap objects.  The bitmap can be accessed directly as a byte array (after the report has been processed) with:

myReportHtml.Bitmaps[0].Filedata

Java Engine

For Java, the same array can be accessed with ProcessHtmlAPI.getImageNames () which returns an array of HtmlImage objects.  So the equivalent code to access the bitmap stream directly is:

 

myProcessHtml.getImageNames().getStream()

 

Note, in the Java Engine, this will return an OutputStream.

Sample Code and Template

 

Attached is some sample code and a sample template.

Storing Image Data in an HTML File

 

If you are instead interested in simply storing the image data in the HTML file, Windward has a feature called “embedded HTML images.”  It is done with “Base64 encoding,” which converts the image data into data that can be stored as text.  This works because HTML files are stored as text rather than binary, which restricts the domain of the data that can be stored in an HTML file. 

In order to enable embedded images, you must set the property “html.embed_images” to true in your configuration file.

.NET Engine

In the .NET engine, this configuration file is your App.Config file.  Or, programmatically, this can be done with `ReportHtml.EmbedImages = true`.

Java Engine

In the Java engine, the configuration file is sometimes called “WindwardReports.properties.”  Programmatically, embedded images is enabled with `ProcessHtmlAPI.setEmbedImages(true)`.

  • Was this article helpful?