Class CompareChartWriter

java.lang.Object
ca.spatial.reportwriter.Report
ca.spatial.reportwriter.CompareChartWriter
All Implemented Interfaces:
Selectable<Report>, Comparable<Report>

public class CompareChartWriter extends Report
This class creates a chart based on parameters passed on standard input. It is designed to be run in a headless environment. This report is not intended to be used interactively within Patchworks.

Use this command by executing java from the command line. Pipe the commands on standard input, and receive the ourput report on standard output.

The format for the parameters passed through standard input is a series of keywords and options separated by a '=' sign, for example

report=harvest/fmuS23/areaCover
location=/raid/share/Projects/AlPac/FMP_2015/version_4/analysis/scenario_list_s23
xColumn=YEAR
yColumn=TOTAL
normalizeColumn=
title=Comparison of areaCover
xcaption=X
ycaption=Y
scenarioCount=5
scenarioName_0=V6_S23_Base_old
scenarioName_1=V6_S23_base_planned
scenarioName_2=V6_S23_base_roads
scenarioName_3=V6_S23_NRV
scenarioName_4=V6_S23_refinement_v1
scenarioLocation_0=scenarios/S23/V6_S23_Base_old
scenarioLocation_1=scenarios/S23/V6_S23_Base_planned
scenarioLocation_2=scenarios/S23/V6_S23_Base_roads
scenarioLocation_3=scenarios/S23/V6_S23_NRV
scenarioLocation_4=scenarios/S23/V6_S23_refinement_v1
chart.type=line
chart.width=400
chart.height=300
chart.seriescolor_0=#3366cc
chart.linewidth_0=1
Note that the keywords are case sensitive. The meanings of the keywords are as follows:
List of available keywords
KeywordDescription
reportThe name of the report to base the comparison on, relavite to the location and scenario parameters. The report file name should not contain an extention, as .csv will be appended by the tool.
locationThe folder that is the root of the path to the report files.
outputTHe type of output to be produced:
  • binary: the output will be produced in binary png format (default).
  • encoded: the output will be produced in base64 encoded png format.
  • html: the output will be in html format.
xColumnThe column in the report to use for x-axis values. The values must be the same in each report.
yColumnThe column in the report to use for y-axis values.
normalizeColumnIf specified, the y-values will be divided by the value in the normailizeColumn. If not specified or blank then the y-values will not be normalized.
titleTHe title to display on the chart.
xcaptionThe caption to display on the x-axis. It not specified then the xColumn value will be used.
ycaptionThe caption to display on the y-axis. It not specified then the yColumn value will be used.
scenarioCountThe number of scenarios to be compared.
scenarioName_nA name to be used in the legend to represent the nth scenario being compared. Note that scenarios are counted from 0 (the first scenario name is in scenarioName_0).
scenarioLocation_nThe partial file path used to locate the nth scenario to be compared. The complete path to each scenario data file is the combination of the location, scenarioLocation_n, and report variables. Note that scenarios are counted from 0 (the first scenario location is in scenarioLocation_0).
chart.seriescolor_nThe color code in hex RGB triple format to use for data series n. Note that series are counted from 0 (the first series color code is in chart.seriescolor_0).
chart.linewidth_nThe line width in pixels to use for data series n. Note that series are counted from 0 (the first series line width is in chart.linewidth_0).
chart.xaxis.categorySpecify if the x-axis should use a catigorical or numeric axis unis true or false. By default the system will use a numeric axis if the x samples are all numeric and in ascending order.
chart.logRangeAxisSpecify if the y-axis should use a logarithmic scale using true or false.
chart.typeThe type of chart to display, using values of line, area, bar, stackedbar, pie or pie2. The pie2 format transposes sample and series valuies.
chart.widthThe width of the chart in pixels.
chart.heightThe height of the chart in pixels.
chart.referenceA specification for horizontal reference lines to be drawn upon the chart. Multiple line may be specified, each separated with a | character. Lines are specified by a numeric value, followed by an optional color value. For example, "1000;#ff0000|2000;#0000ff|3000" would specify a red line at 1000, a blue line at 2000, and a black line at 3000.
  • Constructor Details

    • CompareChartWriter

      public CompareChartWriter()
  • Method Details

    • init

      public Object[] init(PrintStream out)
    • getTypes

      public String[] 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.
      Specified by:
      getTypes in class Report
    • doReport

      public ca.spatial.reportwriter.Report.DataCache doReport(String reportName, 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.
      Specified by:
      doReport in class Report
      Parameters:
      reportName - The full name of the report to be printed, including the extension of the sub-report (if any).
      out - The output stream to print output on to.
      param - A HashMap containing parameters that modify the report (for example the scenario name).
    • main

      public static void main(String[] args)
      Execute the command, accepting parameters on standard input and producing output on standard output. No parameters are accepted on the command line.