OpenAPI 1.0

com.aquafold.openapi.chart
Interface AQChart


public interface AQChart

Chart

Synopsis:

Chart renders a graphical representation of a set of data, using a series & category data format.

Description:
Chart provides an interface to render an image of a data set. This interface includes methods to access the underlying data model and properties that govern different aspects of the chart's appearance. Once the model is populated with data and the properties are configured, then a chart image can be rendered to a byte array or can be cached for access through a url.


Method Summary
 void addCategoryField(String categoryFieldName)
          Select category from a field in the datasource
 void addSeriesField(String seriesFieldName)
          Add a series from the datasource to the AQChartModel
 String cache(int timeToLive)
          Renders a chart and inserts the resulting image into an image cache, returning a URL string which can be used to access the generated chart.
 List<String> getCategoryFields()
          Get the list of datasource category fields used by the AQChartModel
 AQDataSource getDataSource()
          Get the AQChartModel's datasource.
 AQChartModel getModel()
          Get the Chart's data model.
 AQChartProperties getProperties()
          Get the Chart's properties.
 List<String> getSeriesFields()
          Get the list of datasource series fields used by the AQChartModel
 boolean isCacheValid(String cacheKey)
          Determines whether the specified cache key is still valid (based on its timeToLive)
 byte[] renderToImage(String imageFormat)
          Render the Chart to an array of bytes, using the specified image file format
 void setCategoryFields(String... categoryFieldNames)
          Select categories from one or more fields in the datasource
 void setDataSource(AQDataSet dataSet)
          Use the specified AQDataSet as the AQChartModel's datasource
 void setDataSource(AQDataSource dataSource)
          Use the specified AQDataSource as the AQChartModel's datasource
 void setDataSource(AQPivotDataSet pivotDataSet)
          Use the specified AQPivotDataSet as the AQChartModel's datasource
 void setModel(AQChartModel model)
          Set the Chart's data model.
 void setProperties(AQChartProperties chartProperties)
          Set the Chart's properties.
 void setSeriesFields(String... seriesFieldNames)
          Select series from one or more fields in the datasource
 

Method Detail

getModel

AQChartModel getModel()
Get the Chart's data model.

Returns:
the underlying data model

setModel

void setModel(AQChartModel model)
Set the Chart's data model.

Parameters:
model - set the underlying data model

getProperties

AQChartProperties getProperties()
Get the Chart's properties. The Chart Properties include the Chart Type, Series Functions, Series Colors, Fonts, Legend parameters, etc. see AQChartProperties for details.

Returns:
properties which define how the chart will be rendered (chart types, functions, colors, fonts, etc)

setProperties

void setProperties(AQChartProperties chartProperties)
Set the Chart's properties. The Chart Properties include the Chart Type, Series Functions, Series Colors, Fonts, Legend parameters, etc. see AQChartProperties for details.

Parameters:
chartProperties - Properties which define how the chart will be rendered (chart types, functions, colors, fonts, etc)

setDataSource

void setDataSource(AQDataSet dataSet)
Use the specified AQDataSet as the AQChartModel's datasource

Parameters:
dataSet - AQDataSet containing rows and columns of data

setDataSource

void setDataSource(AQPivotDataSet pivotDataSet)
Use the specified AQPivotDataSet as the AQChartModel's datasource

Parameters:
pivotDataSet - AQPivotDataSet containing rows and columns of data

setDataSource

void setDataSource(AQDataSource dataSource)
Use the specified AQDataSource as the AQChartModel's datasource

Parameters:
dataSource - AQDataSource containing rows and columns of data

getDataSource

AQDataSource getDataSource()
Get the AQChartModel's datasource. Common datasources are Query Analyzer Grid result sets and Pivot Grid result sets.

Returns:
dataSource Chart Model's AQDataSource containing rows and columns of data

addSeriesField

void addSeriesField(String seriesFieldName)
Add a series from the datasource to the AQChartModel

Parameters:
seriesFieldName - Name of field in datasource

getSeriesFields

List<String> getSeriesFields()
Get the list of datasource series fields used by the AQChartModel

Returns:
List of series fields in datasource

setSeriesFields

void setSeriesFields(String... seriesFieldNames)
Select series from one or more fields in the datasource

Parameters:
seriesFieldNames - Names of fields in datasource

addCategoryField

void addCategoryField(String categoryFieldName)
Select category from a field in the datasource

Parameters:
categoryFieldName - Name of field in datasource

getCategoryFields

List<String> getCategoryFields()
Get the list of datasource category fields used by the AQChartModel

Returns:
List of category fields in datasource

setCategoryFields

void setCategoryFields(String... categoryFieldNames)
Select categories from one or more fields in the datasource

Parameters:
categoryFieldNames - Name of field in datasource

renderToImage

byte[] renderToImage(String imageFormat)
                     throws Exception
Render the Chart to an array of bytes, using the specified image file format

Parameters:
imageFormat - Image format ("jpg" or "png")
Returns:
Rendered image in the specified format
Throws:
Exception - during the rendering of the image (e.g. if the specified image format is invalid or unsupported)

cache

String cache(int timeToLive)
             throws Exception
Renders a chart and inserts the resulting image into an image cache, returning a URL string which can be used to access the generated chart. This method is intended for large charts where passing large data sets in a url string is impractical.

Parameters:
timeToLive - Time period in seconds during which the image will remain in the cache.
Returns:
URL string which can be used to access the generated chart
Throws:
Exception - if timeToLive < 0; if exception occurs during the rendering of the image

isCacheValid

boolean isCacheValid(String cacheKey)
Determines whether the specified cache key is still valid (based on its timeToLive)

Parameters:
cacheKey - Cache entry key
Returns:
TRUE if the specified cache entry is valid; FALSE if the cache entry has expired

OpenAPI 1.0


Copyright © 2010 AquaFold, Inc. All Rights Reserved. Use is subject to license terms.