How to Base a Chart on Cross-sectional Data

Description

When a data series must be based on multiple fields in a record rather than a single field across multiple records, a Cross-Sectional data series can be created to map multiple columns in a table to one or more sub-series.

Discussion

A Cross-Sectional data series specifies a mapping between columns in a table and one or more sub-series. This is useful when series data spans multiple columns instead of multiple rows. EG, a table that stores quarterly sales data for two years in a single record.

Cross-Section data series can be created for SQL or DBF databases. The Data extraction template defines how to map each row of data from the table into one or more subseries in the data series definition.

To create a Cross-Section data series, follow the steps below:

  1. In the UX Builder Properties, open the Data Series builder by clicking the [...] button for the Data series property.

    images/dataSeriesEdit.png
  2. Create a new Data Series or Edit an Existing one.

    images/dataSeriesCrossSectional1.png
  3. Choose the "CrossSection" data series for your database. The cross-sectional data series available are described below:

    Cross-Sectional
    Description
    SQL-CrossSection

    Create a Cross-Sectional data series for a query against a SQL Database.

    DBF-CrossSection

    Create a Cross-Sectional data series for data from one or more DBF tables.

  4. Define the data query to extract the data from the database. Your query can use arguments to filter the results. Specify an order clause to sort the results.

    images/dataSeriesCrossSectional2.png
  5. Define the Data extraction template for the data series. The extraction template can define multiple sub-series. For example, the Data extraction template below defines a mapping of a table row that holds quarterly sales information for the current year and previous year into three subseries: 'Quarter', 'Sales', and 'SalesPrevious'.

    Quarter|Sales|SalesPrevious
    1st|{Q1_sales}|{Q1_prev_sales}
    2nd|{Q2_sales}|{Q2_prev_sales}
    3rd|{Q3_sales}|{Q3_prev_sales}
    4th|{Q4_sales}|{Q4_prev_sales}
    images/dataSeriesCrossSectional3.png
  6. Save the Data Series.

For a comprehensive guide to create a cross-sectional data series, watch the video below.

The videos demonstrate using a DBF data source. The concepts shown here also apply to the SQL-CrossSection Data Source Type.

Understanding the "CrossSectional" Data Series Type

Download Component

Download DBF Table for Component

See Also