SLinearChart

From OSF Wiki
Jump to navigation Jump to search

Introduction

The sLinearChart is a component that displays record (numeric) attributes on a linear chart. It is used to display the values of different attributes of a record description so that users can easily compare the values of these comparable attributes.

The main difference in contrast to the bar chart component is that the linear chart is used to compare comparable attributes (remember that the bar chart can be used to compare any kind of attributes: even if they are not really comparable together). The linear charts are normally used to compare data in sequence: the same indicator over years; or the same indicator over ages (5 years old, 10 years old, etc.), as examples.

Attributes are made comparable in the schema, and they are ordered according to their ordering value, also defined in the schema used by the component, and used to describe target input records.

Important Predicates

No specific predicates are important for the linear chart control. Only the targetAttributes predicates are the important ones. Each of them should describe the target record, and each needs to have a numeric value.

The linear chart is really used to display numeric values of target attributes of a given target record. The input target attributes are defined as "comparableWith" other attributes based on the input schema. Also, the target attributes will be ordered on the X axis of the graph by their "orderingValue".

Here is an example of two comparable attributes with defined ordering values. These are defined in a irXML schema that can be used as an input schema to the component (this is part of the MUNI ontology):

    <muni_PCT142004>

      <comparableWith>muni_PCT142005</comparableWith>

      <orderingValue>101</orderingValue>
	  
      <shortLabel>male: 5 and under</shortLabel>

      <prefLabel>Population for whom poverty status is determined: Income in 1999 below poverty level; Male; Under 5 years</prefLabel>
      <description>Population for whom poverty status is determined: Income in 1999 below poverty level; Male; Under 5 years</description>
      
      <allowedType>Country</allowedType>
      <allowedType>County</allowedType>
      <allowedType>Township</allowedType>
      <allowedType>CensusTract</allowedType>
      <allowedType>Place</allowedType>
      
      <allowedValue>
        <primitive>Integer</primitive>
      </allowedValue>

      <maxValues>1</maxValues>
      
      <displayControl>sBarChart</displayControl>      
      <displayControl>sLinearChart</displayControl>      
    </muni_PCT142004> 
 
    <muni_PCT142005>
      <comparableWith>muni_PCT142004</comparableWith>

      <orderingValue>102</orderingValue>

      <shortLabel>male: 5</shortLabel>

      <prefLabel>Population for whom poverty status is determined: Income in 1999 below poverty level; Male; 5 years</prefLabel>
      <description>Population for whom poverty status is determined: Income in 1999 below poverty level; Male; 5 years</description>
      
      <allowedType>Country</allowedType>
      <allowedType>County</allowedType>
      <allowedType>Township</allowedType>
      <allowedType>CensusTract</allowedType>
      <allowedType>Place</allowedType>
      
      <allowedValue>
        <primitive>Integer</primitive>
      </allowedValue>
      
      <maxValues>1</maxValues>
      
      <displayControl>sBarChart</displayControl>      
      <displayControl>sLinearChart</displayControl>      
    </muni_PCT142005>

Styles

Style Name Description
sLinearChart Style for the main sLinearChart component

AS3 Usage Examples

  /** Create a resultset object instance from the input structXML data */
  var resultset:Resultset = new Resultset(XML(inputData));

  /** Create the sLinearChart component*/
  var semanticLinearChart:sLinearChart = new sLinearChart();

  /** Target type to focus on at load time */
  var targetAttributes:Array = ["http://purl.org/ontology/muni#PCT142004","http://purl.org/ontology/muni#PCT142005"];

  /** Create the schema */
  var schema:Schema = new Schema();
  schema.loadSchema("http://schema.file.url");


  /** Initialize the semantic control */
  semanticLinearChart.percentWidth = 100;
  semanticLinearChart.percentHeight = 100;
  semanticLinearChart.semanticDataProvider = resultset;
  semanticLinearChart.targetAttributes= targetAttributes;
  semanticLinearChart.schema= schema;

  /** Add the sLinearChart  to the main application */
  this.addChild(semanticLinearChart);

MXML Usage Examples

  <sLinearChart semanticDataProvider="{semanticDataProvider}" 
                    targetAttributes="{targetAttributes}"
                    schema="{schema}" />

In this example, we assume that the {semanticDataProvider} variable is a Resultset, where the record description is defined, accessible at the creation time of the sLinearChart. Target attributes are the attributes to focus on at load time. The schema is the conceptual structure to load in the Relation Browser.

Related Libraries

This tool is based on the Axiis Flex project. It has been enhanced for some special purposes of the OSF Widget, but the basis of this component is based on the Axiis framework.

This project is itself related to the Degrafa visualization framework.