Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Datasets Overview | ||||||||
Line: 20 to 20 | ||||||||
The following code illustrates adding a layer of data to a bar chart: | ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
Changed: | ||||||||
< < | In this example, there was only one set of data, so the default names were used for creating and linking the data. A more complicated example would be where we have network usage for 3 different servers for a one week period (Mon - Fri). First we would initialize a 'data set' for one of the servers (possibly naming it 'SERVER1') 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, 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 .XY ADD BAR LAYER, then add a 'data group' via.LAYER ADD DATA GROUP. Next we would add 'data set templates' for each of the 3 servers via .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 .LAYER LINK DATASET to link our previously entered data with the 'data set templates. | |||||||
> > | In this example, there was only one set of data, so the default names were used for creating and linking the data. A more complicated example would be where we have network usage for 3 different servers for a one week period (Mon - Fri). First we would initialize a 'data set' for one of the servers (possibly naming it 'SERVER1') 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, 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 .XY ADD BAR LAYER, then add a 'data group' via.LAYER ADD DATA GROUP. Next we would add 'data set templates' for each of the 3 servers via .LAYER ADD DATASET TM. This defines the presentation of our chart, without referring to the actual data. To add the data to our chart, would use .LAYER LINK DATASET TM to link our previously entered data with the 'data set templates. | |||||||
The following illustrates this example:
* | ||||||||
Line: 35 to 35 | ||||||||
| ||||||||
Changed: | ||||||||
< < | GOSUB 0CD .LAYER LINK DATASET | |||||||
> > | GOSUB 0CD .LAYER LINK DATASET TM | |||||||
PASS SERVER2 FIELD SHARE? N PASS DS2 FIELD SHARE? N | ||||||||
Changed: | ||||||||
< < | GOSUB 0CD .LAYER LINK DATASET | |||||||
> > | GOSUB 0CD .LAYER LINK DATASET TM | |||||||
PASS SERVER3 FIELD SHARE? N PASS DS3 FIELD SHARE? N | ||||||||
Changed: | ||||||||
< < | GOSUB 0CD .LAYER LINK DATASET | |||||||
> > | GOSUB 0CD .LAYER LINK DATASET TM | |||||||
* GOSUB :RENDER CHART END | ||||||||
Line: 53 to 53 | ||||||||
GOSUB 0CD .LAYER ADD DATA GROUP * PASS DS1 FIELD SHARE? N | ||||||||
Changed: | ||||||||
< < | GOSUB 0CD .LAYER ADD DATASET | |||||||
> > | GOSUB 0CD .LAYER ADD DATASET TM | |||||||
*
| ||||||||
Line: 66 to 66 | ||||||||
| ||||||||
Changed: | ||||||||
< < | GOSUB 0CD .LAYER ADD DATASET | |||||||
> > | GOSUB 0CD .LAYER ADD DATASET TM | |||||||
*
| ||||||||
Line: 79 to 79 | ||||||||
| ||||||||
Changed: | ||||||||
< < | GOSUB 0CD .LAYER ADD DATASET | |||||||
> > | GOSUB 0CD .LAYER ADD DATASET TM | |||||||
*
| ||||||||
Line: 265 to 265 | ||||||||
RETURN | ||||||||
Changed: | ||||||||
< < | In this example, when we defined the data set templates, we gave each of them a name (DS1, DS2, DS3), and when we added our data sets, we gave each of them a name as well (SERVER1, SERVER2, SERVER3). We were then able to link the date set template with the data set via .LAYER LINK DATASET, passing it the specific names we wanted linked. If we wanted to render this chart with a different set of data, all we have to do is create 3 new data sets, relink them using .LAYER LINK DATASET, and then render the chart again. Notice when we called .XY ADD BAR LAYER, we passed the OFF parameter to suppress the automatic creation and linking of data groups, data set templates and data sets. Since we are managing this ourselves, we did not want the routine to do it for us. Also notice the technique of passing an empty field to .XY ADD BAR LAYER. We wanted to pass the first and third parameters, so we had to have a dummy field to pass as the second parameter (--- TEMP 1 in this case). | |||||||
> > | In this example, when we defined the data set templates, we gave each of them a name (DS1, DS2, DS3), and when we added our data sets, we gave each of them a name as well (SERVER1, SERVER2, SERVER3). We were then able to link the date set template with the data set via .LAYER LINK DATASET TM, passing it the specific names we wanted linked. If we wanted to render this chart with a different set of data, all we have to do is create 3 new data sets, relink them using .LAYER LINK DATASET TM, and then render the chart again. Notice when we called .XY ADD BAR LAYER, we passed the OFF parameter to suppress the automatic creation and linking of data groups, data set templates and data sets. Since we are managing this ourselves, we did not want the routine to do it for us. Also notice the technique of passing an empty field to .XY ADD BAR LAYER. We wanted to pass the first and third parameters, so we had to have a dummy field to pass as the second parameter (--- TEMP 1 in this case). | |||||||
CommentsRead what other users have said about this page or add your own comments. |