Class CategoryExpressionReport
- All Implemented Interfaces:
Selectable<Report>
,Comparable<Report>
- Direct Known Subclasses:
CategoryPatternReport
sourceDataTable
.
Each row in the report represents data summarized from
a range of planning periods. Not all planning periods need be
reported.
Column values are calculated from the list of expression. Column headings are specified by the list of labels.
Row labels are specified in the categories
array. There will be one row in the table for each String
in the categories
array.
Records from the sourceDataTable
are classified by
the categoryExpression
to determine which row the record
values should be summed into. Values for each expression are summed into
the approprite column and row.
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 category. The first column in the table contains the category, with a column heading of 'CATEGORY'. Subsequent columns contain the expression labels, and the final column contains row totals with a column heading of 'TOTAL'. There is one row in the csv file for each category.
The following shows a sample of a CSV format file:
CATEGORY,1 - 20,21 - 40,41 - 60,61 - 80,81 - 100,101 - 120,121 - 140,140+,TOTAL A,11291,10678,1357,20235,37621,15600,14596,15108,126486 B,5,9869,9648,4371,20235,37239,14930,12971,12472,121734 C,10,12123,10120,6816,11816,25072,29557,12579,13778,121861 D,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 expression labels.
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
cateogry, with subdivisions for each expression. The Y-axis is
automatically scaled to fit the data, and labeled with the
units
parameter. The X-axis displays category names.
- 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
ConstructorsConstructorDescriptionCategoryExpressionReport(String filename, String title, String units, AttributeStore sourceDataTable, String reselectExpression, int[] periods, boolean annualize, String htmlText, boolean percent, String categoryExpression, Comparable[] categories, String[] expressions, String[] labels)
The CategoryExpressionReport 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.Set the label that describes the category.String[]
String[]
void
setCategories(Comparable[] categories)
void
setCategoryExpression(String categoryExpression)
setCategoryLabel(String label)
void
setExpressions(String[] exprs, String[] labels)
void
setStore(AttributeStore as)
Set the table of data that is used in this report.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, 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
-
CategoryExpressionReport
public CategoryExpressionReport(String filename, String title, String units, AttributeStore sourceDataTable, String reselectExpression, int[] periods, boolean annualize, String htmlText, boolean percent, String categoryExpression, Comparable[] categories, String[] expressions, String[] labels)The CategoryExpressionReport 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.periods
- An array of period numbers that will be used in composing the report. Only values from the specified periods will be used.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
- Additional text that can be used to document the report.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.categoryExpression
- The database calculation containing values to be summed into the rows of the table.categories
- An array of String labels providing the row names to be used for this table.expressions
- A list of expressions that will be summarized in the columns of the report.labels
- A list of labels to use as column headings in the report.
-
-
Method Details
-
setCategoryLabel
-
getCategoryLabel
Set the label that describes the category. This label is displayed in the chart and csv file. -
setCategories
-
getCategories
-
setCategoryExpression
-
getCategoryExpression
-
setExpressions
-
getExpressions
-
getLabels
-
setStore
Description copied from class:GeneralReport
Set the table of data that is used in this report.- Overrides:
setStore
in classGeneralReport
-
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.
-