Chart widget tags

This page describes an older version, please read about the latest version at:
http://resources.arcgis.com/en/help/flex-viewer/concepts/

Configuration file for the Chart widget

The general structure of the Chart widget configuration file is shown by the conceptual graphic below.

Conceptual overview of configuration options for Chart widget

The file is defined by a <configuration> tag that identifies it as a configuration file for the Viewer. It supports editing the charts in the widget and also enables the widget dialog labels to be changed. It has the following child tags:

<layers>
Container for the widget chart layer sources. It has the following child tag:
<layer>
Specifies the input layer for a chart. Each searchable layer will have its own <layer> tag. It has the following properties and child tags:
  • label—the label of the layer. Use when the layer already exists in the map. The layer must be a feature layer. This is the same label as specified in the main configuration file for the layer to use.
  • url—the uniform resource locator (URL) address of the layer to query for data. Use when the layer does not exist in the map. This is an individual layer within a service and normally ends with a number, such as .../MapServer/0.
<labelfield>
This field will be used as the chart's category field. For example, if the label field is 'NAME' then this field will be used to categorize the chart data. Required.
<fields>
Container for the retrieved fields. It has the following child tag:
<field>
Specific field to be retrieved. It has the following attribute:
  • name—Name of the attribute field on the server side.
<medias>
Which medias to display. It has one child tag:
<media>
Information for how to display media in the Chart widget. This tag has the following attributes:
  • caption—Supports statistic value substitution using the following syntax. See example at the end of this page.
    • {=SUM}
    • {=MIN}
    • {=MAX}
    • {=COUNT}
    • {=AVERAGE}
  • chartfields—Field name (one single field per chart) for data shown in chart. Required.
  • chartnormalizationfield—Value to divide the chart fields value by. Optional.
  • title—Title to display. Optional.
  • type—Type of chart to display. Required. Valid values are:
    • barchart
    • columnchart
    • linechart
    • piechart

Labels

In addition, the configuration file also supports changing the labels used in the widget dialog (this is not shown in the conceptual graphic).

<labels>
Container for labels that can be modified in this widget. It has several child tags:
<selectlabel>
Tooltip for the first titlebar button (default for English is Select).
<resultslabel>
Tooltip for the second titlebar button (default for English is Results).
<layerselectionlabel>
Label for layer selection list (default for English is Select layer).
<drawtoolmenulabel>
Label for draw tool selection icon group (default for English is Select draw tool).
<nolayerslabel>
Label displayed when there are no layers for charting (default for English is No layers).
<nochartdatatodisplaylabel>
Label displayed when there chart has no data (default for English is No chart data to display).
<featurelayernotvisibletext>
Label displayed when the selected layer is not visible or is out of scale (default for English is "feature layer is either not visible or out of scale range").
<rectanglelabel>
Tooltip label for the select by rectangle tool (default for English is Draw Rectangle).
<circlelabel>
Tooltip label for the select by circle tool (default for English is Draw Circle).
<ellipselabel>
Tooltip label for the select by ellipse tool (default for English is Draw Ellipse).
<polygonlabel>
Tooltip label for the select by polygon tool (default for English is Draw Polygon).
<freehandpolygonlabel>
Tooltip label for the select by freehand polygon tool (default for English is Draw Freehand Polygon).
<clearlabel>
Label for the clear selection graphics (default for English is Clear).

Example configuration file:

<configuration>
    <labels>
        <layerselectionlabel>Select layer</layerselectionlabel>
        <drawtoolmenulabel>Select draw tool</drawtoolmenulabel>
    </labels>
    <layers>
        <!-- The label of this layers refer to a layer added in the main configuration file-->
        <layer label="USA Diversity Index">
            <labelfield>NAME</labelfield>
            <fields>
                <field name="NAME"/>
                <field name="DIVINDX_CY"/>
            </fields>
            <medias>
                <media caption="You selected {=COUNT} features"
                       chartfields="DIVINDX_CY"
                       title="Diversity Index"
                       type="barchart"/>
            </medias>
        </layer>
        <layer label="Age statistics" url="http://server.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Median_Age/MapServer/4">
            <labelfield>NAME</labelfield>
            <fields>
                <field name="NAME"/>
                <field name="MEDAGE_CY"/>
                <field name="POPU5_CY"/>
                <field name="POP85_CY"/>
            </fields>
            <medias>
                <media caption="The average median age for these {=COUNT} features is {=AVERAGE}"
                       chartfields="MEDAGE_CY"
                       title="Median Age"
                       type="columnchart"/>
                <media caption="Together these {=COUNT} counties have {=SUM} people in the 0-4 age range"
                       chartfields="POPU5_CY"
                       title="2010 Population, Age 0-4 Years"
                       type="barchart"/>
                <media chartfields="POP85_CY"
                       title="2010 Population, Age 85 Years or Older"
                       type="barchart"/>
            </medias>
        </layer>

        <!-- This layer from a MapService is not drawn on the map but can still be selected from. -->
        <layer label="Income by state" url="http://server.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Median_Household_Income/MapServer/4">
            <labelfield>NAME</labelfield>
            <fields>
                <field name="NAME"/>
                <field name="TOTPOP_CY"/>
                <field name="MEDHINC_CY"/>
            </fields>
            <medias>
                <!-- This example shows the four different types of chart: "barchart", "columnchart", "linechart", "piechart" -->
                <media chartfields="TOTPOP_CY"
                       title="Total Population (pie chart)"
                       type="piechart"/>
                <media chartfields="MEDHINC_CY"
                       title="Median Household Income (bar chart)"
                       type="barchart"/>
                <media chartfields="MEDHINC_CY"
                       title="Median Household Income (line chart)"
                       type="linechart"/>
                <media chartfields="MEDHINC_CY"
                       title="Median Household Income (column chart)"
                       type="columnchart"/>
            </medias>
        </layer>
    </layers>
</configuration>

Test drive the Chart widget.

2/15/2012