File: BarChartMacro.net

package info (click to toggle)
dxsamples 4.4.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 26,340 kB
  • sloc: ansic: 10,079; sh: 8,445; java: 1,772; makefile: 1,102
file content (371 lines) | stat: -rw-r--r-- 13,155 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
//
// time: Wed Jun 11 14:07:40 1997
//
// version: 3.1.1 (format), 3.1.4 (DX)
//
//
// Begin MDF
// MODULE BarChart
// CATEGORY Annotation
// DESCRIPTION creates a barchart
// INPUT data; value list or string list; (none); bar chart data
// INPUT barlabels; string list; (no default); label list for bar chart
// INPUT labels; string list; (no default); horizontal and vertical labels for chart
// INPUT corners; vector list or object; (automatic); [xmin, ymin], [xmax, ymax] limits
// INPUT aspect[visible:0]; scalar or string; 1; aspect ratio
// INPUT adjust[visible:0]; flag; (no default); adjust endpoints to tic locations
// INPUT frame[visible:0]; integer; 0; framing for plot
// INPUT grid[visible:0]; integer; 0; place grid on plot (0, 1, 2, 3)
// INPUT axes_color[visible:0]; value or value list or string list; {"white"}; colors for axes
// INPUT color_background[visible:0]; value or value list or string list; {"clear"}; color of background
// INPUT color_grid[visible:0]; value or value list or string list; {"grey"}; color of grid (if drawn)
// INPUT color_labels[visible:0]; value or value list or string list; {"white"}; color of labels
// INPUT color_ticks[visible:0]; value or value list or string list; {"white"}; color of ticks
// INPUT label_scale[visible:0]; scalar; 1; scale factor for labels
// INPUT font[visible:0]; string; (no default); font for labels
// OUTPUT plot; field; the bar chart
// End MDF
//
// comment: This sample macro takes a list of values and a list of strings and uses the Plot module to make a bar chart.
// page assignment: annotation	order=2, windowed=0, showing=0
// page assignment: dep_conn	order=3, windowed=0, showing=1
// page assignment: make bar	order=4, windowed=0, showing=0
// workspace: width = 560, height = 580
// layout: snap = 0, width = 50, height = 50, align = NN
//
macro BarChart(
 data
,barlabels
,labels
,corners
,aspect = 1
,adjust
,frame = 0
,grid = 0
,axes_color = {"white"}
,color_background = {"clear"}
,color_grid = {"grey"}
,color_labels = {"white"}
,color_ticks = {"white"}
,label_scale = 1
,font
) -> (
 plot
) {
    // 
    // node Input[1]: x = 20, y = 20, inputs = 0, label = Input
    // page group: dep_conn
    // parameter: position = 1, name = 'data', value = '(none)', descriptive = 1, description = 'bar chart data', required = 1, visible = 1
    //
BarChart_Input_1_out_1 = data;
    // 
    // node Inquire[1]: x = 38, y = 111, inputs = 3, label = Inquire
    // input[2]: defaulting = 0, visible = 1, type = 32, value = "items"
    // page group: dep_conn
    //
BarChart_Inquire_1_out_1 = 
    Inquire(
    BarChart_Input_1_out_1,
    "items",
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node Compute[1]: x = 61, y = 190, inputs = 2, label = Compute
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "$0 + 1"
    // page group: dep_conn
    // expression: value = items + 1
    // name[2]: value = items
    //
BarChart_Compute_1_out_1 = 
    Compute(
    "$0 + 1",
    BarChart_Inquire_1_out_1
    ) [instance: 1, cache: 1];
    // 
    // node Enumerate[1]: x = 70, y = 286, inputs = 5, label = Enumerate
    // input[1]: defaulting = 0, visible = 1, type = 29, value = [0]
    // input[4]: defaulting = 0, visible = 1, type = 29, value = [1]
    // page group: dep_conn
    //
BarChart_Enumerate_1_out_1 = 
    Enumerate(
    [0],
    NULL,
    BarChart_Compute_1_out_1,
    [1],
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node Construct[1]: x = 120, y = 376, inputs = 4, label = Construct
    // page group: dep_conn
    //
BarChart_Construct_1_out_1 = 
    Construct(
    BarChart_Enumerate_1_out_1,
    NULL,
    NULL,
    BarChart_Input_1_out_1
    ) [instance: 1, cache: 1];
    // 
    // node Mark[1]: x = 346, y = 384, inputs = 2, label = Mark
    // input[2]: defaulting = 0, visible = 1, type = 32, value = "connections"
    // page group: dep_conn
    //
BarChart_Mark_1_out_1 = 
    Mark(
    BarChart_Construct_1_out_1,
    "connections"
    ) [instance: 1, cache: 1];
    // 
    // node AutoColor[1]: x = 244, y = 398, inputs = 10, label = AutoColor
    // page group: dep_conn
    //
BarChart_AutoColor_1_out_1,
BarChart_AutoColor_1_out_2 = 
    AutoColor(
    BarChart_Mark_1_out_1,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node Transmitter[3]: x = 270, y = 194, inputs = 1, label = counts
    // page group: dep_conn
    //
counts = BarChart_Inquire_1_out_1;
    // 
    // node Receiver[3]: x = 631, y = 195, inputs = 1, label = counts
    // page group: make bar
    //
BarChart_Receiver_3_out_1[cache: 0] = counts;
    // 
    // node Enumerate[2]: x = 570, y = 276, inputs = 5, label = Enumerate
    // input[1]: defaulting = 0, visible = 1, type = 29, value = [.5]
    // input[4]: defaulting = 0, visible = 1, type = 29, value = [1]
    // page group: make bar
    //
BarChart_Enumerate_2_out_1 = 
    Enumerate(
    [.5],
    NULL,
    BarChart_Receiver_3_out_1,
    [1],
    NULL
    ) [instance: 2, cache: 1];
    // 
    // node Input[2]: x = 96, y = 14, inputs = 0, label = Input
    // page group: make bar
    // parameter: position = 2, name = 'barlabels', value = '(no default)', descriptive = 1, description = 'label list for bar chart', required = 0, visible = 1
    //
BarChart_Input_2_out_1 = barlabels;
    // 
    // node Input[3]: x = 258, y = 100, inputs = 0, label = Input
    // page group: make bar
    // parameter: position = 3, name = 'labels', value = '(no default)', descriptive = 1, description = 'horizontal and vertical labels for chart', required = 0, visible = 1
    //
BarChart_Input_3_out_1 = labels;
    // 
    // node Input[4]: x = 319, y = 102, inputs = 0, label = Input
    // page group: make bar
    // parameter: position = 4, name = 'corners', value = '(automatic)', descriptive = 1, description = '[xmin, ymin], [xmax, ymax] limits', required = 0, visible = 1
    //
BarChart_Input_4_out_1 = corners;
    // 
    // node Input[5]: x = 374, y = 107, inputs = 0, label = Input
    // page group: make bar
    // parameter: position = 5, name = 'aspect', value = '1', descriptive = 0, description = 'aspect ratio', required = 0, visible = 0
    //
BarChart_Input_5_out_1 = aspect;
    // 
    // node Input[6]: x = 428, y = 121, inputs = 0, label = Input
    // page group: make bar
    // parameter: position = 6, name = 'adjust', value = '(no default)', descriptive = 1, description = 'adjust endpoints to tic locations', required = 0, visible = 0
    //
BarChart_Input_6_out_1 = adjust;
    // 
    // node Input[7]: x = 485, y = 114, inputs = 0, label = Input
    // page group: make bar
    // parameter: position = 7, name = 'frame', value = '0', descriptive = 0, description = 'framing for plot', required = 0, visible = 0
    //
BarChart_Input_7_out_1 = frame;
    // 
    // node Input[8]: x = 536, y = 115, inputs = 0, label = Input
    // page group: make bar
    // parameter: position = 8, name = 'grid', value = '0', descriptive = 0, description = 'place grid on plot (0, 1, 2, 3)', required = 0, visible = 0
    //
BarChart_Input_8_out_1 = grid;
    // 
    // node Input[9]: x = 42, y = 47, inputs = 0, label = Input
    // page group: annotation
    // parameter: position = 9, name = 'axes_color', value = '{"white"}', descriptive = 0, description = 'colors for axes', required = 0, visible = 0
    //
BarChart_Input_9_out_1 = axes_color;
    // 
    // node Input[11]: x = 94, y = 52, inputs = 0, label = Input
    // page group: annotation
    // parameter: position = 10, name = 'color_background', value = '{"clear"}', descriptive = 0, description = 'color of background', required = 0, visible = 0
    //
BarChart_Input_11_out_1 = color_background;
    // 
    // node Input[12]: x = 149, y = 57, inputs = 0, label = Input
    // page group: annotation
    // parameter: position = 11, name = 'color_grid', value = '{"grey"}', descriptive = 0, description = 'color of grid (if drawn)', required = 0, visible = 0
    //
BarChart_Input_12_out_1 = color_grid;
    // 
    // node Input[13]: x = 202, y = 60, inputs = 0, label = Input
    // page group: annotation
    // parameter: position = 12, name = 'color_labels', value = '{"white"}', descriptive = 0, description = 'color of labels', required = 0, visible = 0
    //
BarChart_Input_13_out_1 = color_labels;
    // 
    // node Input[14]: x = 264, y = 59, inputs = 0, label = Input
    // page group: annotation
    // parameter: position = 13, name = 'color_ticks', value = '{"white"}', descriptive = 0, description = 'color of ticks', required = 0, visible = 0
    //
BarChart_Input_14_out_1 = color_ticks;
    // 
    // node Input[15]: x = 592, y = 125, inputs = 0, label = Input
    // page group: make bar
    // parameter: position = 14, name = 'label_scale', value = '1', descriptive = 0, description = 'scale factor for labels', required = 0, visible = 0
    //
BarChart_Input_15_out_1 = label_scale;
    // 
    // node Input[16]: x = 543, y = 365, inputs = 0, label = Input
    // page group: make bar
    // parameter: position = 15, name = 'font', value = '(no default)', descriptive = 1, description = 'font for labels', required = 0, visible = 0
    //
BarChart_Input_16_out_1 = font;
    // 
    // node List[1]: x = 109, y = 191, inputs = 5, label = List
    // page group: annotation
    //
BarChart_List_1_out_1 = 
    List(
    BarChart_Input_9_out_1,
    BarChart_Input_11_out_1,
    BarChart_Input_12_out_1,
    BarChart_Input_13_out_1,
    BarChart_Input_14_out_1
    ) [instance: 1, cache: 1];
    // 
    // node Unmark[1]: x = 369, y = 480, inputs = 2, label = Unmark
    // page group: dep_conn
    //
BarChart_Unmark_1_out_1 = 
    Unmark(
    BarChart_AutoColor_1_out_1,
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node Transmitter[2]: x = 165, y = 518, inputs = 1, label = data_dep_conn
    // page group: dep_conn
    //
data_dep_conn = BarChart_Unmark_1_out_1;
    // 
    // node Receiver[2]: x = 18, y = 359, inputs = 1, label = data_dep_conn
    // page group: make bar
    //
BarChart_Receiver_2_out_1[cache: 0] = data_dep_conn;
    // 
    // node Transmitter[1]: x = 154, y = 261, inputs = 1, label = annotation_colors
    // page group: annotation
    //
annotation_colors = BarChart_List_1_out_1;
    // 
    // node Receiver[1]: x = 394, y = 360, inputs = 1, label = annotation_colors
    // page group: make bar
    //
BarChart_Receiver_1_out_1[cache: 0] = annotation_colors;
    // 
    // node Plot[1]: x = 192, y = 461, inputs = 24, label = Plot
    // input[5]: visible = 1
    // input[6]: visible = 1
    // input[8]: visible = 1
    // input[10]: visible = 1
    // input[11]: defaulting = 0, visible = 1, type = 16777248, value = {"axes" "background" "grid" "labels" "ticks"}
    // input[12]: visible = 1
    // input[13]: visible = 1
    // input[19]: visible = 1
    // input[22]: visible = 1
    // page group: make bar
    //
BarChart_Plot_1_out_1 = 
    Plot(
    BarChart_Receiver_2_out_1,
    BarChart_Input_3_out_1,
    NULL,
    BarChart_Input_4_out_1,
    BarChart_Input_6_out_1,
    BarChart_Input_7_out_1,
    NULL,
    BarChart_Input_8_out_1,
    BarChart_Input_5_out_1,
    BarChart_Receiver_1_out_1,
    {"axes" "background" "grid" "labels" "ticks"},
    BarChart_Input_15_out_1,
    BarChart_Input_16_out_1,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    BarChart_Enumerate_2_out_1,
    NULL,
    NULL,
    BarChart_Input_2_out_1,
    NULL,
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node Output[1]: x = 309, y = 541, inputs = 1, label = Output
    // page group: make bar
    // parameter: position = 1, name = 'plot', value = ' ', descriptive = 0, description = 'the bar chart', required = 0, visible = 1
    //
plot = BarChart_Plot_1_out_1;
    //
    // decorator Annotate	pos=(212,284) size=348x44 style(Label), value = <NULL>
    // annotation user_begin: 68
    // annotation user: This section makes a field with the bar chart data
    // annotation user: dep "connections"
    // annotation user_end: <NULL>
    // page group: dep_conn
// network: end of macro body
}
BarChart_Input_1_out_1 = NULL;
BarChart_Inquire_1_out_1 = NULL;
BarChart_Compute_1_out_1 = NULL;
BarChart_Enumerate_1_out_1 = NULL;
BarChart_Construct_1_out_1 = NULL;
BarChart_Mark_1_out_1 = NULL;
BarChart_AutoColor_1_out_1 = NULL;
BarChart_Transmitter_3_out_1 = NULL;
BarChart_Receiver_3_out_1 = NULL;
BarChart_Enumerate_2_out_1 = NULL;
BarChart_Input_2_out_1 = NULL;
BarChart_Input_3_out_1 = NULL;
BarChart_Input_4_out_1 = NULL;
BarChart_Input_5_out_1 = NULL;
BarChart_Input_6_out_1 = NULL;
BarChart_Input_7_out_1 = NULL;
BarChart_Input_8_out_1 = NULL;
BarChart_Input_9_out_1 = NULL;
BarChart_Input_11_out_1 = NULL;
BarChart_Input_12_out_1 = NULL;
BarChart_Input_13_out_1 = NULL;
BarChart_Input_14_out_1 = NULL;
BarChart_Input_15_out_1 = NULL;
BarChart_Input_16_out_1 = NULL;
BarChart_List_1_out_1 = NULL;
BarChart_Unmark_1_out_1 = NULL;
BarChart_Transmitter_2_out_1 = NULL;
BarChart_Receiver_2_out_1 = NULL;
BarChart_Transmitter_1_out_1 = NULL;
BarChart_Receiver_1_out_1 = NULL;
BarChart_Plot_1_out_1 = NULL;