Datasets Overview

This page describes the basic steps and related subroutine calls for supplying data to the charting routines.


Description:

Data is organized into a particular structure: a 'data point' is the smallest unit and represents one unit of data; a 'data set' is a collection of related 'data points'; a 'data group' is a collection of related 'data sets' and a 'layer' is a collection of related 'data groups'. 'Layers', 'data sets' and 'data groups' may be named to allow you to work with more than one set of data at a time. 'data points' and 'data sets' can be created independantly of 'data groups' and 'layers'. You only need to assign the 'data sets' to a 'data group' when you are ready to chart the data. This gives you the flexibilty to plot the same data different ways, or to plot different data.

For example, let's say we have network usage for 3 different servers for a one week period (Mon - Sun). First we would initialize a 'data set' for one of the servers (possibly naming it 'server 1') via .DATASET INITIALIZE. Then we would add each days network usage for that server via .POINT ADD NEW. We would repeat the steps for the second and third server. We now have three 'data sets' that contain the 'data points' of the network usage for each server. To plot this on a bar chart, we would create a 'Layer' for our chart via .XY ADD BAR LAYER, then add a 'data group' via [[

The data to be plotted on a chart is kept in a 'data set'. There is no specific limit to the number of 'points' in your dataset. You can also manage more than one dataset at a time by giving each dataset a unique name when you initialize it.

The general flow is to initialize a dataset, then use various subroutines to add data to your dataset. When you initialize a Pie chart, a dataset is initialized automatically for you. If you already have a dataset initialized when you call the chart initialization routine for a Pie chart, then that dataset will be associated with the new chart.

Certain chart types have specific routines for defining layers of data, ie, a bar chart that plots more than one set of data. These are discussed under the API's for that particular chart type. Pie charts have a specific API that lets you add a datapoint and a label for it at the same time (see Chart design example).

The following code illustrates adding a layer of data to a bar chart:

* ================================================================
*
* Add a bar chart layer to the chart
GOSUB 0CD .XY ADD BAR LAYER
*
* Add data group
GOSUB 0CD .LAYER ADD DATA GROUP
*
* Add dataset
GOSUB 0CD .LAYER ADD DATASET
* ================================================================
* Initialize dataset
* ================================================================
PASS 1 FIELD SHARE? N
GOSUB 0CD .DATASET INITIALIZE
*
* Link dataset to group
GOSUB 0CD .LAYER LINK DATASET
*
* ================================================================
* Add data to dataset
* ================================================================
*
PASS 85 FIELD SHARE? N
GOSUB 0CD .POINT ADD NEW
*
PASS 156 FIELD SHARE? N
GOSUB 0CD .POINT ADD NEW
*
PASS 179.5 FIELD SHARE? N
GOSUB 0CD .POINT ADD NEW
*
PASS 211 FIELD SHARE? N
GOSUB 0CD .POINT ADD NEW
*
PASS 123 FIELD SHARE? N
GOSUB 0CD .POINT ADD NEW

Generally, when you render the chart the API's will use whatever dataset is the 'current' dataset. If you are working with multiple named datasets, there is an API that allows you to change the current dataset.

Comments

Read what other users have said about this page or add your own comments.


-- JeanNeron - 2011-09-21


This topic: Main > WebHome > APPX510Features > CDChartDirectorDesignerAPI > CDOverviewDatasetDefinition
Topic revision: r2 - 2011-10-21 - JeanNeron
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback