Skip to content
Jenny Schweers edited this page Apr 14, 2015 · 33 revisions

Graphs

In a suite, an individual detail field may be in the form of a graph.

Overarching Placement

Graphs are defined in suite.xml, inside <detail> blocks, inside <template> blocks, similarly to text templates. To display a graph in case selection or details, add a new <field> to the appropriate <detail> block. The field's header text will be displayed as the graph's title.

Note that the template's "form" attribute must be set to "graph," and the graph must have a type. Supported types:

  • "xy" may be configured to display as a line or scatter chart
  • "time" for xy charts where the x axis uses date or datetime values
  • "bubble" for bubble charts
<detail id="m0_case_long">
  <title>
    <text>
      <locale id="case_lists.m0.title"/>
    </text>
  </title>
  <field>
    <header>
      <text>
        <locale id="case_lists.m0.header"/>
      </text>
    </header>
    <template form="graph">
      <graph type="line">
        <!-- see below -->
      </graph>
    </template>
  </field>
</detail>

Graph

A graph should contain a element for every series to be drawn.

It may contain a configuration element to define the graph's look and feel.

It may contain any number of annotations, which are strings to be drawn at specific points on the graph.

<graph>
  <series type="line">
    <!-- May contain 0..* series. See below. -->
  </series>
  <configuration>
    <!-- May contain a single configuration. See below. -->
  </configuration>
  <annotation>
    <!-- May contain 0..* annotations. See below. -->
  </annotation>
</graph>

Series

A series is primarily defined by a nodeset, x function, and y function. The x and y functions will be applied against each node in the nodeset to generate points on the graph. Nodesets are likely either case data or fixture data.

Any series contained in a bubble graph must also have a radius function, which will determine the size of each bubble.

A series may contain a <configuration> block to customize its look and feel.

<series nodeset="instance('casedb')/casedb/case[index/parent=current()/@case_id]">
  <configuration>
    <!-- see below -->
  </configuration>
  <x function="hours" />
  <y function="contraction_frequency" />
  <radius function="contraction_length" />
</series>

Configuration (series)

Clone this wiki locally