Server tags
This section describes using WebCharts3D server tags to produce interactive images during page processing. (See Overview for more information). Before you start producing images, you will need to setup WebCharts3D on the server as it is described in Setup section.
To produce images using custom tags you need to:
<%@ taglib prefix="ct" uri="http://www.gpoint.com/tld/webcharts50.tld" %>
Name | Type | Description |
style | String | Styles in the XML Format or name of a file that contains styles in XML format. |
type | String | Image type (PNG|JPG|GIF|WBMP|SVF|SVG|PDF|TIF) |
width | int | The width of the chart |
height | int | The height of the chart |
rsel | int | The chart's row selection (-1 by the default) |
csel | int | The chart's column selection (0 by the default) |
html | boolean | Flag telling WebCharts3D to produce 508 compliant charts with HTML description. Default: false. |
connection | java.sql.Connection | Opened SQL connection for data retrieval (Optional) |
location | String | Filename of the file with data. (Optional) |
getImageURL | String | The location and name of the file/servlet that will retrieve stored image from the server. See JSP section of this chapter for more information about getImage.jsp. Default: /getImage.jsp. |
The data for the chart can be specified in a number of ways:
<ct:webchart type="PNG" width="256" height="256" style="..." >
<?xml version="1.0" encoding="UTF-8"?>
<XML type="default">
<ROW Y2000="100" Y2001="200" Y2002="300"></ROW>
</XML>
</ct:webchart>
<csv
| location="location" | - same location as specified in location attribute |
| separator="," | - Field separator (Optional) |
| quote="" | - Quote character or empty string (Optional) |
| isCrosstab="true|false" | - True or false (Optional) |
| hasColLabels="true|false" | - True or false (Optional) |
| hasRowLabels="true|false" | - True or false (Optional) |
| encoding="encoding"/> | - Encoding (Optional) |
<sql isCrosstab="true|false" hasRowLabels="true|false">
SQL Command
</sql>
NOTE
public class MyTaglibComponent extends BodyTagSupport {
...
public int doEndTag() throws JspException {
MxServerComponent server;
try {
server = MxServerComponent.getDefaultInstance(pageContext.getServletContext());
MxChartDescription dsc = server.newImageSpec();
dsc.width = width ;
dsc.height= height;
dsc.type = type ;
dsc.model = getBodyContent().getString(); // Use body as chart's model
dsc.loadStyles(style); // load style from a file
String tag = server.getImageTag(dsc,getImageURL+"?image=");
getBodyContent().getEnclosingWriter().write(tag);
}
catch(java.io.IOException ex) { throw new JspException(ex.toString()); }
return SKIP_BODY;
}