Chart description
Class com.gp.api.jsp.MxChartDescription contains
all information about the chart the server needs to create an image. Typically you
would obtain an instance of this class by calling newImageSpec() function of MxServerComponent.
The following fields are required:
- public int width
- Chart's width.
- public int height
- Chart's height.
- public String model
- Chart's model in XML format.
See also Model chapter of this manual.
- public String style
- Chart's style in XML format.
See also Styles chapter of this manual.
The following fields are optional:
- public String type
- Chart's type (PNG|JPG|GIF|WBMP|SVG|SWF|PDF|TIF). When type is not specified the
server will use type defined by MxServerProperties.
- public int rsel
- Chart's row selection.
- public int csel
- Chart's column selection.
- public int ratio
- The chart's scaling ratio. This parameter can should be between 0 and 100 and
becomes convinient when
working with the mobile devices with small screen
- public boolean html
- Tell server to create 508 compliant charts with descriptive text. Default - false.
In addition, the following functions can be used to populate the chart's style and model:
- public void loadStyles(String fileNameOrURL)
- Loads chart's styles from the specified file or URL into style variable.
Note that unless URL prefix is provided, the parameter is considered to be a filename.
- public void linkTo(String fileNameOrURL)
-
Links the chart's contents to XML located in the file or referenced by URL. Note that unless URL prefix
is provided, the parameter is considered to be a filename.
- public void linkTo(Connection con, String sql, boolean isCrosstab, boolean hasRowLabels)
-
Links the chart's contents to the data returned by a database query.
Parameters:
con | - Opened database connection |
sql | - SQL command |
isCrosstab | - true when the query returns data in "Rowlabel", "Collabel", "Value" format instead of row by row list of values |
hasRowLabels | - true when the query returns rowLabels in the first column. |
- public void linkTo(String fname, char sep, char quote, boolean isCrosstab, boolean hasColLabels, boolean hasRowLabels, String encoding)
-
Links the chart's contents to the data located in a delimited file. This function can import data from
any delimited (comma, tab, semicolon, etc.) file that might have quoted values. For example, to parse
file that contains rows like "Year 2001","5","10" you should specify ',' as a separator and '"' as a
quote. To parse file that contains rows like Year 2001;5;10 you should specify ';' as a separator and
'\0' as a quote character.
Parameters:
fname | - Source file name. |
sep | - Delimiter character. |
quote | - Quote character or '\0' for the unquoted files. |
isCrosstab | - true when the file contains data in "Rowlabel", "Collabel", "Value"
format instead of row by
row list of values. |
hasColLabels | - true when the first row contains column labels |
hasRowLabels | - true when the first column contains row labels |
encoding File | - encoding or null for the default encoding |