The getHtmlData method is not available when using the Chart FX for Java Tag Library. The way the application server treats and compiles JSP pages which contain tags makes impossible to implement a method that writes directly to the output stream.
To work around this limitation, we offer an alternative to generate chart without temporay files when programing with the tag library. The chart will be generated in memory, and a servlet will handle the bitstreaming to the browser. Upon delivery to the client, the chart in memory will be destroyed and the memory freed.
The servlet is included as part of the Tag library implementation (chartfxtags.jar), and in order to use it, the following lines need to be added to the web.xml:
<servlet> <servlet-name>ChartServlet</servlet-name> <servlet-class>com.softwarefx.chartfx.servlets.ChartServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>ChartServlet</servlet-name> <url-pattern>/ChartServlet</url-pattern> </servlet-mapping>
|
In the Tag Library, a new attribute has been added to generate a chart in memory: memImage.
<%@ taglib uri="/chartfxtags" prefix="chartfx"%> <chartfx:chart height="240" width="400" memImage="TRUE" axesStyle="MATH"> <chartfx:axis index="0"> <chartfx:line color="#FF0000" width="2"/> </chartfx:axis> <chartfx:axis index="2"> <chartfx:line color="#FF0000" width="2"/> </chartfx:axis> </chartfx:chart>
|
When this attribute is set to TRUE, Chart FX will generate an imaga tag like this:
<img src="/cfxjava/ChartServlet? clientId=0.03739849629257874&width=400&height=240&outputType=png"/>
|
|