Tags:
view all tags
---+ Datasets Overview _This page describes the basic steps and related subroutine calls for supplying data to the charting routines._ <br />%TOC% ---++ Description: Data and the presentation of data on a chart is separated into distinct areas, by design. This allows you to have a process that produces a chart, but does not have to know anything about the data that is being charted. A separate process can accumulate the data to be charted, then simply run the other process to produce the chart. The actual data is organized into a particular structure: a 'data point' is the smallest unit and represents one unit of data and a 'data set' is a collection of related 'data points'. For presentation purposes, there is a 'data set template', a 'data group', which is a collection of 'date set templates' and a 'layer', which is a collection of 'data groups'. All of the above can be named, or not. If you are working with multiple layers, data groups, data set templates or data sets, you can name them to make charting easier. If you only need one layer, data group, data set template, etc, then you can leave the names blank when you create them. Attributes of 'layers', 'data groups', and 'data set templates' can all be set individually, ie, you can change the color or shape of all the bars in a 'data group' to make it different from other bars. 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 [[CDDatasetInitialize][.DATASET INITIALIZE]]. Then we would add each days network usage for that server via [[CDPointAddNew][.POINT ADD NEW]]. We would repeat the steps for the second and third server, naming each 'data set' as appropriate. 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 [[CDXYAddBarLayer][.XY ADD BAR LAYER]], then add a 'data group' via [[CDLayerAddDataGroup][.LAYER ADD DATA GROUP]]. Next we would add 'data set templates' for each of the 3 servers via [[CDLayerAddDataSet][.LAYER ADD DATASET]]. This defines the presentation of our chart, without referring to the actual data. To add the data to our chart, would use [[CDLayerLinkDataSet][.LAYER LINK DATASET]] to link our previously entered data with the 'data set templates' 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 [[CDOverviewChartDesign][Chart design]] example). The following code illustrates adding a layer of data to a bar chart: <pre><div id="_mcePaste"> * ================================================================</div><div id="_mcePaste"> *</div><div id="_mcePaste"> * Add a bar chart layer to the chart</div><div id="_mcePaste"> GOSUB 0CD .XY ADD BAR LAYER</div><div id="_mcePaste"> *</div><div id="_mcePaste"> * Add data group</div><div id="_mcePaste"> GOSUB 0CD .LAYER ADD DATA GROUP</div><div id="_mcePaste"> *</div><div id="_mcePaste"> * Add dataset</div><div id="_mcePaste"> GOSUB 0CD .LAYER ADD DATASET</div><div id="_mcePaste"> * ================================================================</div><div id="_mcePaste"> * Initialize dataset</div><div id="_mcePaste"> * ================================================================</div><div id="_mcePaste"> PASS 1 FIELD SHARE? N</div><div id="_mcePaste"> GOSUB 0CD .DATASET INITIALIZE</div><div id="_mcePaste"> *</div><div id="_mcePaste"> * Link dataset to group</div><div id="_mcePaste"> GOSUB 0CD .LAYER LINK DATASET</div><div id="_mcePaste"> *</div><div id="_mcePaste"> * ================================================================</div><div id="_mcePaste"> * Add data to dataset</div><div id="_mcePaste"> * ================================================================</div><div id="_mcePaste"> *</div><div id="_mcePaste"> PASS 85 FIELD SHARE? N</div><div id="_mcePaste"> GOSUB 0CD .POINT ADD NEW</div><div id="_mcePaste"> *</div><div id="_mcePaste"> PASS 156 FIELD SHARE? N</div><div id="_mcePaste"> GOSUB 0CD .POINT ADD NEW</div><div id="_mcePaste"> *</div><div id="_mcePaste"> PASS 179.5 FIELD SHARE? N</div><div id="_mcePaste"> GOSUB 0CD .POINT ADD NEW</div><div id="_mcePaste"> *</div><div id="_mcePaste"> PASS 211 FIELD SHARE? N</div><div id="_mcePaste"> GOSUB 0CD .POINT ADD NEW</div><div id="_mcePaste"> *</div><div id="_mcePaste"> PASS 123 FIELD SHARE? N</div><div id="_mcePaste"> GOSUB 0CD .POINT ADD NEW</div></pre> 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._ <br />%COMMENT% -- Main.JeanNeron - 2011-09-21
Edit
|
Attach
|
Watch
|
P
rint version
|
H
istory
:
r9
|
r5
<
r4
<
r3
<
r2
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r3 - 2011-11-03
-
JeanNeron
Home
Site map
Main web
MedicaidBilling web
Sandbox web
TWiki web
Main Web
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
P
P
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Edit
Attach
Copyright © 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