General structure for Chart XML file
<?xml version='1.0' encoding='utf-8' ?>
<visualizations>
  <chart>
    <x_axis/>
    <y_axis/>
    <legend/>
    <series_list >
      <series /> 
         . . .
      <series /> 
    </series_list>
    <filters>
      <filter/>
         . . .
      <filter/>
    </filters>  
  </chart>
</visualizations>

Explorer charts are defined using an XML file, with tags defining general chart characteristics as well as specifics about individual series displayed on the chart. These tags are described below. Examples of various chart types with their associated XML files are available on the Chart Examples page.

The overall structure of a chart XML file is shown to the right. It consists of a series of nested tag that defines various aspects of the chart or charts to be included in a specific visualization.

Below is an example of a simple single-series chart and the XML required to create it

Average Precipitation by Climate Model
<?xml version='1.0' encoding='utf-8' ?>

<visualizations owner='' access='public' force_recalc='1'>

  <chart title='Basin Average Annual Precipitation'
            type='line' bkgr_color='#ffffff'
            input_dir='/Envision/StudyAreas/BigWood/Outputs'
            data_dir ='/Explorer/Topic/Explorer/Charts/Data' >

    <x_axis label='Year'
               src='Ref/Run0/ModelOutput_Ref_Run0.csv'
               col='Year' format='' min_val='auto' max_val='auto'
               type='day'
               start_year='1980'/>

    <y_axis label='Inches'
               src ='auto' 
               format='g' 
               min_val='auto' 
               max_val='auto'  
               type=''/>

    <legend item_width='120' float='1' />

    <series_list >

      <series label='Historic'
                 src='Ref_Historic/Run0/Basin_Climate_Ref_Historic_Run0.csv'
                 col='Basin Mean Daily Precip (mm)' 
                 x_src='Ref_Historic/Run0/Basin_Climate_Ref_Historic_Run0.csv' 
                 x_col='0' 
                 color='black' 
                 width='2' 
                 line_style='solid' 
                 marker='none' 
                 transform='xrange(1,10950);periodmean(365);yscale(14.37)' 
                 /> 

    </series_list>
    
    <filters>
      <filter id='filter' type='textbox' text='' />
    </filters>
  
  </chart>
</visualizations>

Attributes for Chart XML are described next.

Chart XML files are XML-compliant text files consisting of a single <visualizations">tag with the following attributes

AttributeDescriptionRequired?
owner Username of chart ownerNo (defaults to "")
access Chart visibility to other users. One of:
'public': visible to other users, or
private: Not visible to other users
No (defaults to 'public')
force_recalc '1': Regenerate chart data transforms when loading chart, or
'0': Use cached chart data if available
No (defaults to '1')
Child Tags
<chart> Defines the charts to be included in the visualization defined in this Chart XMLYes, if the visualization includes charts.

Within the visualizations, <chart> tag define individual charts to be displayed. Attributes of the chart tag are given below. In addition to these attributes, child tags define various aspects of the chart.

AttributeDescriptionRequired?
title Chart Title to be displayed above the chartNo (defaults to "" )
type Chart type. One of the chart type described below.No (defaults to 'line' )
bkgr_color Background color of the chart. Must be a valid javascript color descriptor (e.g. #rrggbb, or a named color)No (defaults to '#ffffff' (white))
input_dir Directory containing chart input CSV files.No (defaults to "" )
data_dir Directory within which autogenerated chart intermediate CSV files are placedNo (defaults to "" )
Child Tags
<x_axis> Defines characteristics of the chart's X-axisNo
<y_axis> Defines characteristics of the chart's Y-axisNo
<legend> Defines characteristics of the chart's legendNo
<series_list> Defines characteristics of the chart's data seriesNo

The table below provides a list of available chart types.

Chart TypeDescription
Area basic area plot - drawn from x axis to line data
AreaSpline same as Area, but drawn with smoothed line
AreaRange area between low and high series values
AreaSplineRange same as AreaRange, but drawn with smoothed line
StackedArea basic area plot - drawn from x axis to line data
StackedAreaSpline same as Area, but drawn with smoothed line
Bar
BoxPlot
Bubble
Column
ColumnRange
ErrorBar
Funnel
Gauge
Heatmap
Line
Pie
Polygon
Pyramid
Scatter
Radar "polar" with line type
Series
SolidGauge
Spline
Treemap
Waterfall


The X-Axis of a chart is defined within the <x_axis> child tag within the parent <chart> tag. Attributes of the <x_axis> tag are:

AttributeDescriptionRequired?
label X-Axis labelNo (defaults to "" )
src Path to CSV file provinding X-axis data. Not needed if specified at the series levelNo (defaults to 'line' )
col Column name in 'src' CSV file containing X-Axis dataNo (defaults to the first column)
format No (defaults to "" )
min_val Minimum value for the X-AxisNo (auto-determined)
max_val Maximum value for the X-AxisNo (auto-determined)
type One of the chart type described below.No (defaults to "line" )
stacking No
startYear For 0-based data, defines an offset that is added to each X-value.No (defaults to 0)

The Y-Axis of a chart is defined within the <y_axis> child tag within the parent <chart> tag. Attributes of the <y_axis> tag are:

AttributeDescriptionRequired?
label Y-Axis labelNo (defaults to "" )
src Path to CSV file providing Y-axis data, or 'auto', which uses the same source file as the X-axis source. Not needed if specified at the series levelNo (defaults to 'auto' )
format No (defaults to "" )
min_val Minimum value for the Y-AxisNo (auto-determined)
max_val Maximum value for the Y-AxisNo (auto-determined)
type No

The Chart Legend is defined within the <legend> child tag within the parent <chart> tag. Attributes of the <legend> tag are:

AttributeDescriptionRequired?
item_width the width, in pixels, of legend itemsNo (defaults to autosize)
float Flag indicating whether legend should 'float' about the data: 0=don't float, 1=floatNo (defaults to '0' )
layout Determines stacking direction of legend elements in the legend. One of:
'horizontal': legend is layed out horizontally, or
'vertical': legend is layed out vertically
No (defaults to 'vertical')
align Determines horizontal placement of legend on chart. One of: 'left', 'center', or 'rightNo (defaults to 'right')
valign Determines vertical placement of legend on chart. One of: 'top', 'middle', or 'bottomNo (defaults to 'top')

Defining the Chart Series

A Chart Series is a set of data that define a single line (or area) on a chart. Charts can have zero or more series. Each series is defined within the chart's <series_list> tag. Within the <series_list> tag, child <series> tags define individual series. The <series_list> tag has a single, optional attribute, 'autogen'. Setting 'autogen' to 1 will generate a series for every column on the input data source (CSV file) defined for the Y-Axis - this is a good shortcut for rapidly viewing, via a chart, the contents of the CSV file. When defining series manually, use the <series> tag, one for each series. Attributes of the <series> tag are:

<series> AttributeDescriptionRequired?
label Series labelNo (defaults to "" )
type One of the chart type described below.No (defaults to "line" )
src Path to CSV file providing Y-axis data. Yes
col Column name in 'src' CSV file containing Y-Axis dataYes
x_src Path to CSV file provinding X-axis data. Not needed if specified at the series levelNo (defaults to 'line' )
x_col Column name in 'src' CSV file containing X-Axis dataNo (defaults to the first column)
width The width of the line/point used to draw this series (pixels)No (defaults to 1)
color The color used to draw the series. Can be expressed as hex RGB triples (e.g. '#rrggbb', RGBA quads (e.g.'#rrggbbaa'), or 'auto' to autogenerate a color, or a named web color (see https://en.wikipedia.org/wiki/Web_colors )No (defaults to 'auto')
dynamic Indicates the chart should include a time slider. Useful for radar chartsNo (defaults to 'false')
addmeanline For range charts, 'true' indicates a mean line should be generated for the rangeNo (defaults to 'false'
stacking For area charts, 'true' indicates linked series should be stacked No (defaults to 'false')
visible indicates whether the series is initially visible or not. Use 'true' indicates a series is visible, 'false" to indicate it is no.No (defaults to 'true')
line_style Line style used to draw the series. One of:
'solid'
'shortdash'
'shortdot'
'shortdashdot'
'shortdashdotdot'
'dot'
'dash'
'longdash'
'dashdot'
'longdashdot'
'longdashdotdot'
No (defaults to 'solid')
marker Specifies series marker. One of:
'none'
'circle'
'square'
'diamond'
'triangle'
'triangledown'
'url' (pointing to an image used to draw the marker)
No (defaults to 'none' )
marker_radius Size of the marker (pixels)No (auto-determined)
marker_fill color used to fill the marker. Can be expressed as hex RGB triples (e.g. '#rrggbb', RGBA quads (e.g.'#rrggbbaa'), or 'auto' to autogenerate a color, or a named web color (see https://en.wikipedia.org/wiki/Web_colors )No (auto-determined)
link_to specifies an additional series this series is linked to.No (series is unlinked)

Transforms modify the datasets they operate on. Transforms are applied using a pipeline model; multiple transforms operate on a dataset in series. The first listed transform is applied first; the results of that tranform are passed down the pipeline, where the second transform is applied. This process repeats until all transforms have been processed. Note that transforms may change the shape (i.e. number of rows and/or columns) of the dataset; this may have consequences for subsequent transforms in the pipeline. For those transforms that modify the shape of the data, check the "Notes" section below - any shape changes associated with a tranform are noted there.

The table below list transforms available for data manipulation for charting. Multiple tranforms may be specified in a pipeline by separating individual transforms with a ';' (semicolon).

TransformDescriptionParametersNotes
Mathematical operators
'movingavg(windowSize)' Calculates a Moving Average of the serieswindowSize: period over which moving average is calculated
'xscale(scaleFactor)' Multiplies the series x-values scaleFactor: value to multiple series by
'xtranslate(valueToAdd)' Adds a value to the series x-values valueToAdd: Value to add
'yscale(scaleFactor)' Multiplies the series y-values scaleFactor: value to multiple series by
'ytranslate(valueToAdd)' Adds a value to the series y-values valueToAdd: Value to add to the series
'xlog()' Replaces x-values with their natural log None
'xlog10()' Replaces x-values with their log (base 10)None
'ylog()' Replaces y-values with their natural logNone
'ylog10()' Replaces y-values with their log (base 10)None
'integrate()' Replaces each y-value with it's accumulated (integrated) valueNone
Modifying a series using values from a different file
'add(path,column)' Adds values from a second file to the series values path: path the the second CSV file
column: field name in the second file containing values to add/multiple/subtract/divide
'subtract(path,column)' Subtracts values from a second file from the series values
'multiply(path,column)' Multiplies values from a second file to the series values
'divide(path,column)' Divides values from a second file into the series values
Subsampling
'first(n)' Extracts the first 'n' data points out of the seriesn: number of points to extractReduces the number of data points in the series to 'n' points.
'last(n)' Extracts the last 'n' data points out of the seriesn: number of points to extractReduces the number of data points in the series to 'n' points.
'xrange(min,max)' Extracts data points with x-values between 'min' and 'max'min: minimum x-value to be extracted
max: maximum x-value to be extracted
Reduces the number of data points in the series to only thoses whose x-values are between 'min' and 'max'.
'sample(freq, startIndex)' Extracts data points starting at 'startIndex', and extracting every 'freq' pointsfreq: Frequency at which points are sampled
startIndex: 0-based index of the starting point to sample
Reduces the number of data points in the series
Sampling within a period
'periodmean(period)' Calculates within-period mean of a seriesperiod: width of the period (number of data points)Reduces the number of points in the series (one for each period). X-values are replaced with midpoint of the period
'periodmin(period)' Calculates within-period minimum of a seriesperiod: width of the period (number of data points)Reduces the number of points in the series (one for each period). X-values are replaced with midpoint of the period
'periodmax(period)' Calculates within-period maximum of a seriesperiod: width of the period (number of data points)Reduces the number of points in the series (one for each period). X-values are replaced with midpoint of the period
'periodminmax(period)' Calculates within-period mean of a seriesperiod: width of the period (number of data points)Reduces the number of points in the series (one for each period). X-values are replaced with midpoint of the period.
Note that this transforms generates a two-column series, the first containing minimum values, the second containing maximum values.
'periodsum(period)' Calculates within-period sum of a seriesperiod: width of the period (number of data points)Reduces the number of points in the series (one for each period). X-values are replaced with midpoint of the period
'sap(period)' Calculates the sum across successive periods, i.e. the first series value is the sum of the first data value of each period, the second value is the sum of the second data value of each period, etc.period: width of the period (number of data points)Reduces the number of points in the series (one for each period). X-values reflect values assocatiated with the first period.
'map(period)' Calculates the mean across successive periods, i.e. the first series value is the mean of the first data value of each period, the second value is the mean of the second data value of each period, etc.period: width of the period (number of data points)Reduces the number of points in the series (one for each period). X-values reflect values assocatiated with the first period.
Statistics
'variance(period)' Calculates the variance (mean +/- two standard deviations) of a series within a periodperiod: width of the period (number of data points)Reduces the number of points in the series (one for each period).
Note that this transforms generates a two-column series, the first containing the (period mean + 2*StdDev), the second contaiing the (period mean-2*StdDev) values.
'regress()' Regresses the data to a best-fit line, and replaces each point with the regressed value
Integrate/Differentiate
'integrate()' Integrates (accumulates) successive values in the dataset
'differentiate()' Differentiates successive values (returns "deltas" of values between timesteps
Multiseries Transforms. Multiseries are specified by 'piping' together (separating multiple entries using the '|' character) when specifying the 'src' and 'col' <series> attributes, e.g. src='file1|file2|file2' col='col1|col2|col3'. The number of points in each input data series should be the same.
'multiseriesvariance()' Calculates the variance (mean +/- two standard deviations) for each point location across the multiseries.This transforms generates a two-column series from a single-column series, the first containing the (period mean + 2*StdDev), the second containing the (period mean-2*StdDev) values. The number of rows in the series is not affected
'multiseriesminmax()' Generates a two-column series of the range (min and max values) for each point location across the multiseries.This transforms generates a two-column series from a single-column series, the first containing the minimum values, the second containing the maximum values. The number of rows in the series is not affected
'multiseriesmin()' Generates a series containing the minimum value for each point location across the multiseries.
'multiseriesmean()' Generates a series containing the mean value for each point location across the multiseries.
'multiseriesmax()' Generates a series containing the maximum value for each point location across the multiseries.
'multiseriessum()' Generates a series containing the sum of each point location across the multiseries.
Other
'python(path)' Invokes the python file specified in the path argumentpath: python to the python file to execute.Not currently implemented

Including charts in an Explorer page requires adding markup text to the page to include an aspx ChartControl for each chart you want on the page. The ChartControl includes a "Src" attribute that specifies where to find the XML describing the chart. Additionally, each ChartControl must have a unique ID attribute.

This markup text generally takes one of two forms: One presenting the chart with a caption, one without. Examples of both are provided below. In both cases, the real work is done in the <viz:ChartControl> tag.

In both cases, we need to register the ChartControl at the top of the aspx page (after the "Page" directive, before any content sections) as follows:

<%@ Register TagPrefix="viz" Namespace="EnvChart" Assembly="EnvChart" %>

Including a Chart Without a Caption

<viz:ChartControl ID='ch1' Height="560" Src="BasinAvgPrecip.xml" runat="server" ></viz:ChartControl>

Including a Chart and Caption - for this example, we add a caption using a table.

<div>
   <table style="height:560px;width:100%;">
      <tr class="caption" style="width:100%;">
         <td><span style="font-weight:bold;">Average Precipitation by Climate Model</span></td>
      </tr>
      <tr class="chart">
         <td class="chart" style="width:100%;">
            <viz:ChartControl ID='ch1' Height="560" Src="BasinAvgPrecip.xml" runat="server"></viz:ChartControl>
         </td>
      </tr>
   </table>
</div>