Class PeriodCategoryReport
- 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 categories that
are passed in to the constructor. There will be one column
per category. Records will be classified into columns based
on the contents of the categoryExpression
calculation.
Cell values are summed by the valueExpression
database calculation.
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'. The second column contains the final YEAR of the 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,YEAR,1 - 20,21 - 40,41 - 60,61 - 80,81 - 100,101 - 120,121 - 140,140+,TOTAL 0,0,11291,10678,1357,20235,37621,15600,14596,15108,126486 1,5,9869,9648,4371,20235,37239,14930,12971,12472,121734 2,10,12123,10120,6816,11816,25072,29557,12579,13778,121861 3,15,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 category 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
(htmlText
), 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
Fields inherited from class ca.spatial.reportwriter.GeneralReport
TYPES
Fields inherited from class ca.spatial.reportwriter.Report
AREA, LINE, PIE, SIDE_BY_SIDE_BARS, STACKED_BARS
-
Constructor Summary
ConstructorsConstructorDescriptionPeriodCategoryReport(String filename, String title, String units, AttributeStore sourceDataTable, String reselectExpression, int[] periods, boolean annualize, String htmlText, boolean percent, String valueExpression, String categoryExpression, Comparable[] categories)
The PeriodCategoryReport constructor. -
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.void
setCategories(Comparable[] cats)
void
setCategoryExpression(String exp)
void
setValueExpression(String exp)
Methods inherited from class ca.spatial.reportwriter.GeneralReport
getAnnualize, getDoColumnTotals, getDoRowTotals, getDoSubTotals, getHTMLText, getMaxFractionDigits, getNoChart, getNoTable, getPercent, getPeriods, getReselectExpression, getStore, getTypes, getUnits, setAnnualize, setDoColumnTotals, setDoRowTotals, setDoSubTotals, setHTMLText, setMaxFractionDigits, setNoChart, setNoTable, setPercent, setPeriods, setReselectExpression, setStore, setUnits
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
-
Constructor Details
-
PeriodCategoryReport
public PeriodCategoryReport(String filename, String title, String units, AttributeStore sourceDataTable, String reselectExpression, int[] periods, boolean annualize, String htmlText, boolean percent, String valueExpression, String categoryExpression, Comparable[] categories)The PeriodCategoryReport 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.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).annualize
- A flag to indicate if the values should be annualized. If true then values from period 0 (prior to the start of the simulation) are not shown. All other values are divided by the width of the period.htmlText
- 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.percent
- 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.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. If this parameter is a null value then the report will automatically determine the categories to use when the report is produced, based on the data content.
-
-
Method Details
-
getValueExpression
-
setValueExpression
-
getCategoryExpression
-
setCategoryExpression
-
getCategories
-
setCategories
-
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.
-