Class RangePeriodReport
- All Implemented Interfaces:
Selectable<Report>
,Comparable<Report>
sourceDataTable
.
Each row in the report represents data summarized from
a single planning period. All planning periods are reported.
Column values are specified by the array of RangeLabels that
are passed in to the constructor. There will be one column
per RangeLabel. Records will be classified into columns based
on the contents of the rangeColumn
database
variable.
Cell values are summed by the valueColumn
database column.
A reselection expression can be used to limit the number of records that contribute to the table. The reselection expression must evaluate to a boolean (true or false) value.
This class generates reports in three formats: HTML, PNG, and CSV.
Each sub-report contains the same data, formatted appropriately for
the output style. When specifying the filename
parameter do not supply a filename extension.
This report will automatically
create the corresponding ".html", ".png", and ".csv" files.
The default report provided by the ReportWriter
is the HTML format report, which also provides links to the
other two formats.
The CSV sub-report has the simplest formatting. The file contains comma separated text values, and can be read in a text editor or loaded into a spreadsheet. The first row contains the column headings. Subsequent rows contain values for each period. The first column in the table contains the period number, with a column heading of 'PERIOD'. Subsequent columns contain the range labels sorted in alphabetical order, and the final column contains row totals with a column heading of 'TOTAL'. The following shows a sample of a CSV format file:
PERIOD,1 - 20,21 - 40,41 - 60,61 - 80,81 - 100,101 - 120,121 - 140,140+,TOTAL 0,11291,10678,1357,20235,37621,15600,14596,15108,126486 1,9869,9648,4371,20235,37239,14930,12971,12472,121734 2,12123,10120,6816,11816,25072,29557,12579,13778,121861 3,13763,12034,8338,7630,29035,29193,11039,10091,121123 ...
The HTML sub-report contains a table holding similar information to the CSV report. Column headings are based on the range label values.
Besides the table, the HTML report also contains a title,
the name of the scenario, an embedding of a PNG version of
the report, optional supplementary HTML data
(additionalHTML
), a link to the
CSV sub-report, and a link to an index report.
The PNG sub-report shows a stacked-bar chart with one bar for each
period, and one stack for each range. The Y-axis is
automatically scaled to fit the data, and labeled with the
units
parameter. The X-axis displays period numbers.
- See Also:
ReportWriter
,RangeLabel
-
Nested Class Summary
Nested classes/interfaces inherited from class ca.spatial.reportwriter.Report
Report.GetNodesAt
-
Field Summary
FieldsFields inherited from class ca.spatial.reportwriter.Report
AREA, LINE, PIE, SIDE_BY_SIDE_BARS, STACKED_BARS
-
Constructor Summary
ConstructorsConstructorDescriptionRangePeriodReport(String filename, String title, String units, AttributeStore sourceDataTable, String valueExpression, String categoryExpression, Comparable[] categories, String reselectExpression, int[] periods, String additionalHTML, boolean computePercent)
The RangePeriodReport constructor.RangePeriodReport(String filename, String title, String units, AttributeStore sourceDataTable, String valueExpression, String categoryExpression, Comparable[] categories, String reselectExpression, int periods, String additionalHTML, boolean computePercent)
Deprecated.It is preferable to use the constructor that uses the array of period values. -
Method Summary
Modifier and TypeMethodDescriptionca.spatial.reportwriter.Report.DataCache
doReport(String filename, PrintStream out, Map<String,Object> param, ca.spatial.reportwriter.Report.DataCache cache)
The method used by the report writer to format the requested report.boolean
int[]
String[]
getTypes()
An accessor function to retrieve the list of report types supported by this report.getUnits()
void
setAdditionalHTML(String html)
void
setCategories(Comparable[] cats)
void
setCategoryExpression(String exp)
void
setComputePercent(boolean state)
void
setPeriods(int period)
void
setPeriods(int[] periods)
void
setReselectExpression(String exp)
void
void
setValueExpression(String exp)
Methods inherited from class ca.spatial.reportwriter.Report
addDefaultParam, chartImg, compareTo, csvLink, doesAnyTypes, doesCSV, doesGIF, doesHTML, doesPNG, doesType, encodeFileURL, encodeURL, endMainContent, escapeRegexChars, footer, formatColumnHeadings, formatColumnHeadings, getAdditionalFiles, getAttributeStore, getBasepart, getBasepart, getDefaultFilename, getDisplayFormat, getExtension, getExtension, getFilename, getFolderpart, getFolderpart, getLength, getNamepart, getNamepart, getPathToRoot, getReportFor, getTitle, header, htmlText, indexLink, interpolateParams, isDhandler, isIndexed, isSelected, parentIndex, patternToRegex, setAttributeStore, setDefaultParams, setDisplayFormat, setIndexed, setSelected, setTitle, toString, uniqueLabels
-
Field Details
-
TYPES
-
-
Constructor Details
-
RangePeriodReport
public RangePeriodReport(String filename, String title, String units, AttributeStore sourceDataTable, String valueExpression, String categoryExpression, Comparable[] categories, String reselectExpression, int[] periods, String additionalHTML, boolean computePercent)The RangePeriodReport constructor.- Parameters:
filename
- The basename to be used for output from this report. This name must be unique with respect to other reports added to the report writer. The name should not contain a filename extension. The report will add ".html", ".png", or ".csv" as appropriate.title
- The title to be displayed in the HTML and PNG sub-reports. The report writer will automatically append the Scenario Name to the to the report title.units
- The units of measure to be displayed on the Y-axis of the PNG sub-report.sourceDataTable
- The table containing the data to be summarized.valueExpression
- A database expression that evaluates to the value to be summed into the cells of the table.categoryExpression
- A database expression that evaluates to the values to be used to classify the record into a table column.categories
- An array of objects providing the classification scheme and column names to be used for this table. One column will be created for each member of the array. These objects are typicallyString
s orRangeLabel
s.reselectExpression
- An SQL-like expression that will limit the set of records to be used in constructing this table.periods
- The number of periods in the report (including the initial time zero period).additionalHTML
- Artibrary HTML format text that can be added in to the HTML sub-report. This text can contain explanatory text, display a coporate logo, or provide a hyper-link to a related table.computePercent
- A boolean value that indicates if the cell data should be converted to percent of the row total. Percent format data can assist in showing changed in relative composition over time.
-
RangePeriodReport
public RangePeriodReport(String filename, String title, String units, AttributeStore sourceDataTable, String valueExpression, String categoryExpression, Comparable[] categories, String reselectExpression, int periods, String additionalHTML, boolean computePercent)Deprecated.It is preferable to use the constructor that uses the array of period values.The RangePeriodReport constructor. This version of the constructor is deprecated. Use the other constructor that accepts an array of period values.- Parameters:
filename
- The basename to be used for output from this report. This name must be unique with respect to other reports added to the report writer. The name should not contain a filename extension. The report will add ".html", ".png", or ".csv" as appropriate.title
- The title to be displayed in the HTML and PNG sub-reports. The report writer will automatically append the Scenario Name to the to the report title.units
- The units of measure to be displayed on the Y-axis of the PNG sub-report.sourceDataTable
- The table containing the data to be summarized.valueExpression
- A database expression that evaluates to the value to be summed into the cells of the table.categoryExpression
- A database expression that evaluates to the values to be used to classify the record into a table column.categories
- An array of objects providing the classification scheme and column names to be used for this table. One column will be created for each member of the array. These objects are typicallyString
s orRangeLabel
s.reselectExpression
- An SQL-like expression that will limit the set of records to be used in constructing this table.periods
- An array of periods that the report should calculate values for.additionalHTML
- Artibrary HTML format text that can be added in to the HTML sub-report. This text can contain explanatory text, display a coporate logo, or provide a hyper-link to a related table.computePercent
- A boolean value that indicates if the cell data should be converted to percent of the row total. Percent format data can assist in showing changed in relative composition over time.
-
-
Method Details
-
getUnits
-
setUnits
-
getValueExpression
-
setValueExpression
-
getCategoryExpression
-
setCategoryExpression
-
getReselectExpression
-
setReselectExpression
-
getCategories
-
setCategories
-
getAdditionalHTML
-
setAdditionalHTML
-
getPeriods
public int[] getPeriods() -
setPeriods
public void setPeriods(int[] periods) -
setPeriods
public void setPeriods(int period) -
getComputePercent
public boolean getComputePercent() -
setComputePercent
public void setComputePercent(boolean state) -
doReport
public ca.spatial.reportwriter.Report.DataCache doReport(String filename, PrintStream out, Map<String,Object> param, ca.spatial.reportwriter.Report.DataCache cache)Description copied from class:Report
The method used by the report writer to format the requested report. This method is implemented in every custom report. Application programs generally do not need to call this method, but instead use the report writer methods to obtain reports. -
getTypes
Description copied from class:Report
An accessor function to retrieve the list of report types supported by this report. See the documentation for the TYPES variable for the list of sub-types.
-