Configuration of XMart graphs

Introduction

Note that you must understand the basic structure of your data in order to be able to properly configure the graphing mechanism. Specifically, you must be aware of which dimensions are present in the measures you are trying to display, and which of these dimensions should be ignored or excluded in order to arrive at sensible graphs

Use

The graphing system currently consists of two transformations:
fc_ui The graphing control user interface that allows a user to specify the parameters of a graph, then render that graph. This transform generates an HTML/javascript interface that will allow a user to configure a graph based on their needs and the available metadata from the query to the web services. The interface provides the ability to generate both line and column graphs.
fc_line The FusionChart transformation that creates a data file for use with a FusionCharts visualizations. This transform generates an XML file that is used to populate the data of a FusionChart object. Note that you must write this code yourself.
In order to automatically create graphs, you simply need to specify a base query to populate metadata and generate the graphing user interface using the fc_ui transform. This will allow an end user to create a variety of graphs against the returned data, constrained by your initial configuration settings.
Like all other transformations in this system. these transforms produce HTML or XML by processing the results of a query against the web service using the regular RESTful API. If you wish to render a graph directly from the output of the fc_line transformation, you must write the appropriate javascript code to generate the desired FusionChart element, then specify the XML URL using the setXMLUrl method. This URL follows the RESTful API
If the source data contains more than one measure, the fc_ui transformation will generate a dropdown that will force the user to select one specific measure. If more than one measure is present for the fc_line transformation, the transform will fail as it will not be able to generate a proper series to plot.

Parameters

x-series Specifies the series dimension - each code in the dimensions will be used to generate either a line on the graph, or a set of columns. Only one dimension can be specified for this parameter.
This parameter can be used in both fc_ui and fc_line.
x-axis The dimension to use for the X-axis values. This dimension must have DisplaySequence attributes for each code used so as to be able to create a proper axis. Only one dimension can be specified for this parameter
This parameter can be used in both fc_ui and fc_line.
x-subcap The dimensions to use to create a sub-caption for the graph. The Display value of each code in the specified dimensions will be used. Multiple dimension codes are separated by a semicolon.
This parameter can be used in both fc_ui and fc_line.
x-ignore These dimensions will be ignored by the graphing user interface, ie they will not be displayed for selection, nor will they be passed to the graphing transform.
This parameter can only be used in fc_ui.
x-exclude These dimensions will not be shown in the graphing user interface, and they will be appended to the filter so as to be exluded (ie dimname:-)
This parameter can only be used in fc_ui.
x-size The render size for the graph. You can select from small which is a square that is 271 pixels to a side, medium, which is a square 309 pixels to a side, and large (the default) which is a square 480 pixels to a side. These dimensions have been selected based on the WHO corporate web site display templates.

Using the graphing system with Minerva

You can use the graphing system in minerva by specifying links that use the fc_ui transformation. See below for a configuration example.

Examples

Example 1 Generating a simple data file for a non-disaggregated measure

In this example, we generate data to graph a simple indicator, WHS4_543, BCG Immunization Coverage among 1-year olds, showing data for Canada and Mexico. We build the query in the usual way, specifying the target indicator and filtering for the desired countries. We then specify that the series dimension is COUNTRY, and we wish the X-Axis dimension to be YEAR.

http://hqsudevlin.who.int:8086/athena/data/GHO/WHS4_543?filter=COUNTRY:CAN;COUNTRY:MEX&x-axis=YEAR&x-series=COUNTRY&profile=fc_line
Example 2 Generating a user interface for a simple non-disaggregated measure

We build on Example 1 to now generate an interface to get us to the same graph. in this case, we remove the filter component since we want to be able to select an arbitrary set of countries.

http://hqsudevlin.who.int:8086/athena/data/GHO/WHS4_543?x-axis=YEAR&x-series=COUNTRY&profile=fc_ui&format=html
Example 3 Continuing on, you will see that the previous example showed the Publish State dimension and the WHO Region dimension. For the purpose of graphing both of these are redundant (everything on the production system is marked as publish_state:published and the WHO region dimension can conflict with the country selection, leading to a null set result) so we will now ignore these dimensions in the user interface using the following query:

http://hqsudevlin.who.int:8086/athena/data/GHO/WHS4_543?x-axis=YEAR&x-series=COUNTRY&profile=fc_ui&format=html&x-ignore=PUBLISHSTATE;REGION
Example 4 You can also display regional data using the graphing ui. For this we will use the x-exclude parameter as we need to exclude country specific information. Note that we must first put COUNTRY:- in the filter, but the initial filter setting is not passed on to the graph data generation transform (fc_line) because the filters are effectively reconstructed completely by the user interface

http://hqsudevlin.who.int:8086/athena/data/GHO/WHS4_543?filter=COUNTRY:-;REGION:*&x-axis=YEAR&x-series=REGION&profile=fc_ui&format=html&x-ignore=PUBLISHSTATE;REGION&x-exclude=COUNTRY
Example 5 Generating a graph for disaggregated data

When graphing data that has multiple levels of disaggregation, the user interface will present all non-ignored and non-excluded dimensions to the user and force them to select 1 code for each - these codes will be used to create the subcaption of the graph and will restrict the queries so that each entry in the series consists of one clear sequence of data without replicated data points. For example, charting life expectancy data that is also disaggregated by sex:

http://hqsudevlin.who.int:8086/athena/data/GHO/WHOSIS_000001?x-axis=YEAR&x-series=COUNTRY&profile=fc_ui&format=html&x-ignore=PUBLISHSTATE;REGION;WORLDBANKINCOMEGROUP
Example 6 Sample Minerva menu.xml View element configuration to produce graphs

This example shows a View configuration that allows a user to graph life expectancy data. Note that in XML, you must give the entity code for the '&' character : &
<View id="le-graph"
      type="embedded"
      URL="../athena/data/GHO/WHOSIS_000001,WHOSIS_000015?format=html&amp;profile=fc_ui&amp;x-series=COUNTRY&amp;x-axis=YEAR&amp;x-ignore=WORLDBANKINCOMEGROUP;REGION;PUBLISHSTATE&amp;filter=COUNTRY:*;REGION:AFR;REGION:AMR;REGION:SEAR;REGION:EUR;REGION:EMR;REGION:WPR;SEX:*">
  <Display lang="en">country graph</Display>
</View>