@trebco/treb 28.10.5 → 28.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,553 @@
1
+ /*
2
+ * This file is part of TREB.
3
+ *
4
+ * TREB is free software: you can redistribute it and/or modify it under the
5
+ * terms of the GNU General Public License as published by the Free Software
6
+ * Foundation, either version 3 of the License, or (at your option) any
7
+ * later version.
8
+ *
9
+ * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
+ * details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License along
15
+ * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
+ *
17
+ * Copyright 2022-2024 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+
22
+ export const bubble_json =
23
+ {
24
+ 'c:title': {},
25
+ 'c:autoTitleDeleted': {
26
+ a$: {
27
+ 'val': '0'
28
+ }
29
+ },
30
+ 'c:plotArea': {
31
+ 'c:layout': {},
32
+ 'c:bubbleChart': {
33
+ 'c:varyColors': {
34
+ a$: {
35
+ 'val': '0'
36
+ }
37
+ },
38
+ 'c:ser': [],
39
+ 'c:dLbls': {
40
+ 'c:showLegendKey': {
41
+ a$: {
42
+ 'val': '0'
43
+ }
44
+ },
45
+ 'c:showVal': {
46
+ a$: {
47
+ 'val': '0'
48
+ }
49
+ },
50
+ 'c:showCatName': {
51
+ a$: {
52
+ 'val': '0'
53
+ }
54
+ },
55
+ 'c:showSerName': {
56
+ a$: {
57
+ 'val': '0'
58
+ }
59
+ },
60
+ 'c:showPercent': {
61
+ a$: {
62
+ 'val': '0'
63
+ }
64
+ },
65
+ 'c:showBubbleSize': {
66
+ a$: {
67
+ 'val': '0'
68
+ }
69
+ }
70
+ },
71
+ 'c:axId': [
72
+ {
73
+ a$: {
74
+ 'val': '2028657983'
75
+ }
76
+ },
77
+ {
78
+ a$: {
79
+ 'val': '2023395087'
80
+ }
81
+ }
82
+ ]
83
+ },
84
+ 'c:valAx': [
85
+ {
86
+ 'c:axId': {
87
+ a$: {
88
+ 'val': '2028657983'
89
+ }
90
+ },
91
+ 'c:scaling': {
92
+ 'c:orientation': {
93
+ a$: {
94
+ 'val': 'minMax'
95
+ }
96
+ }
97
+ },
98
+ 'c:delete': {
99
+ a$: {
100
+ 'val': '0'
101
+ }
102
+ },
103
+ 'c:axPos': {
104
+ a$: {
105
+ 'val': 'b'
106
+ }
107
+ },
108
+ 'c:majorGridlines': {
109
+ 'c:spPr': {
110
+ 'a:ln': {
111
+ a$: {
112
+ 'w': '9525',
113
+ 'cap': 'flat',
114
+ 'cmpd': 'sng',
115
+ 'algn': 'ctr'
116
+ },
117
+ 'a:solidFill': {
118
+ 'a:schemeClr': {
119
+ a$: {
120
+ 'val': 'tx1'
121
+ },
122
+ 'a:lumMod': {
123
+ a$: {
124
+ 'val': '15000'
125
+ }
126
+ },
127
+ 'a:lumOff': {
128
+ a$: {
129
+ 'val': '85000'
130
+ }
131
+ }
132
+ }
133
+ },
134
+ 'a:round': {}
135
+ },
136
+ 'a:effectLst': {}
137
+ }
138
+ },
139
+ 'c:majorTickMark': {
140
+ a$: {
141
+ 'val': 'none'
142
+ }
143
+ },
144
+ 'c:minorTickMark': {
145
+ a$: {
146
+ 'val': 'none'
147
+ }
148
+ },
149
+ 'c:tickLblPos': {
150
+ a$: {
151
+ 'val': 'nextTo'
152
+ }
153
+ },
154
+ 'c:spPr': {
155
+ 'a:noFill': {},
156
+ 'a:ln': {
157
+ a$: {
158
+ 'w': '9525',
159
+ 'cap': 'flat',
160
+ 'cmpd': 'sng',
161
+ 'algn': 'ctr'
162
+ },
163
+ 'a:solidFill': {
164
+ 'a:schemeClr': {
165
+ a$: {
166
+ 'val': 'tx1'
167
+ },
168
+ 'a:lumMod': {
169
+ a$: {
170
+ 'val': '25000'
171
+ }
172
+ },
173
+ 'a:lumOff': {
174
+ a$: {
175
+ 'val': '75000'
176
+ }
177
+ }
178
+ }
179
+ },
180
+ 'a:round': {}
181
+ },
182
+ 'a:effectLst': {}
183
+ },
184
+ 'c:txPr': {
185
+ 'a:bodyPr': {
186
+ a$: {
187
+ 'rot': '-60000000',
188
+ 'spcFirstLastPara': '1',
189
+ 'vertOverflow': 'ellipsis',
190
+ 'vert': 'horz',
191
+ 'wrap': 'square',
192
+ 'anchor': 'ctr',
193
+ 'anchorCtr': '1'
194
+ }
195
+ },
196
+ 'a:lstStyle': {},
197
+ 'a:p': {
198
+ 'a:pPr': {
199
+ 'a:defRPr': {
200
+ a$: {
201
+ 'sz': '900',
202
+ 'b': '0',
203
+ 'i': '0',
204
+ 'u': 'none',
205
+ 'strike': 'noStrike',
206
+ 'kern': '1200',
207
+ 'baseline': '0'
208
+ },
209
+ 'a:solidFill': {
210
+ 'a:schemeClr': {
211
+ a$: {
212
+ 'val': 'tx1'
213
+ },
214
+ 'a:lumMod': {
215
+ a$: {
216
+ 'val': '65000'
217
+ }
218
+ },
219
+ 'a:lumOff': {
220
+ a$: {
221
+ 'val': '35000'
222
+ }
223
+ }
224
+ }
225
+ },
226
+ 'a:latin': {
227
+ a$: {
228
+ 'typeface': '+mn-lt'
229
+ }
230
+ },
231
+ 'a:ea': {
232
+ a$: {
233
+ 'typeface': '+mn-ea'
234
+ }
235
+ },
236
+ 'a:cs': {
237
+ a$: {
238
+ 'typeface': '+mn-cs'
239
+ }
240
+ }
241
+ }
242
+ },
243
+ 'a:endParaRPr': {
244
+ a$: {
245
+ 'lang': 'en-US'
246
+ }
247
+ }
248
+ }
249
+ },
250
+ 'c:crossAx': {
251
+ a$: {
252
+ 'val': '2023395087'
253
+ }
254
+ },
255
+ 'c:crosses': {
256
+ a$: {
257
+ 'val': 'autoZero'
258
+ }
259
+ },
260
+ 'c:crossBetween': {
261
+ a$: {
262
+ 'val': 'midCat'
263
+ }
264
+ }
265
+ },
266
+ {
267
+ 'c:axId': {
268
+ a$: {
269
+ 'val': '2023395087'
270
+ }
271
+ },
272
+ 'c:scaling': {
273
+ 'c:orientation': {
274
+ a$: {
275
+ 'val': 'minMax'
276
+ }
277
+ }
278
+ },
279
+ 'c:delete': {
280
+ a$: {
281
+ 'val': '0'
282
+ }
283
+ },
284
+ 'c:axPos': {
285
+ a$: {
286
+ 'val': 'l'
287
+ }
288
+ },
289
+ 'c:majorGridlines': {
290
+ 'c:spPr': {
291
+ 'a:ln': {
292
+ a$: {
293
+ 'w': '9525',
294
+ 'cap': 'flat',
295
+ 'cmpd': 'sng',
296
+ 'algn': 'ctr'
297
+ },
298
+ 'a:solidFill': {
299
+ 'a:schemeClr': {
300
+ a$: {
301
+ 'val': 'tx1'
302
+ },
303
+ 'a:lumMod': {
304
+ a$: {
305
+ 'val': '15000'
306
+ }
307
+ },
308
+ 'a:lumOff': {
309
+ a$: {
310
+ 'val': '85000'
311
+ }
312
+ }
313
+ }
314
+ },
315
+ 'a:round': {}
316
+ },
317
+ 'a:effectLst': {}
318
+ }
319
+ },
320
+ 'c:numFmt': {
321
+ a$: {
322
+ 'formatCode': '0.00',
323
+ 'sourceLinked': '1'
324
+ }
325
+ },
326
+ 'c:majorTickMark': {
327
+ a$: {
328
+ 'val': 'none'
329
+ }
330
+ },
331
+ 'c:minorTickMark': {
332
+ a$: {
333
+ 'val': 'none'
334
+ }
335
+ },
336
+ 'c:tickLblPos': {
337
+ a$: {
338
+ 'val': 'nextTo'
339
+ }
340
+ },
341
+ 'c:spPr': {
342
+ 'a:noFill': {},
343
+ 'a:ln': {
344
+ a$: {
345
+ 'w': '9525',
346
+ 'cap': 'flat',
347
+ 'cmpd': 'sng',
348
+ 'algn': 'ctr'
349
+ },
350
+ 'a:solidFill': {
351
+ 'a:schemeClr': {
352
+ a$: {
353
+ 'val': 'tx1'
354
+ },
355
+ 'a:lumMod': {
356
+ a$: {
357
+ 'val': '25000'
358
+ }
359
+ },
360
+ 'a:lumOff': {
361
+ a$: {
362
+ 'val': '75000'
363
+ }
364
+ }
365
+ }
366
+ },
367
+ 'a:round': {}
368
+ },
369
+ 'a:effectLst': {}
370
+ },
371
+ 'c:txPr': {
372
+ 'a:bodyPr': {
373
+ a$: {
374
+ 'rot': '-60000000',
375
+ 'spcFirstLastPara': '1',
376
+ 'vertOverflow': 'ellipsis',
377
+ 'vert': 'horz',
378
+ 'wrap': 'square',
379
+ 'anchor': 'ctr',
380
+ 'anchorCtr': '1'
381
+ }
382
+ },
383
+ 'a:lstStyle': {},
384
+ 'a:p': {
385
+ 'a:pPr': {
386
+ 'a:defRPr': {
387
+ a$: {
388
+ 'sz': '900',
389
+ 'b': '0',
390
+ 'i': '0',
391
+ 'u': 'none',
392
+ 'strike': 'noStrike',
393
+ 'kern': '1200',
394
+ 'baseline': '0'
395
+ },
396
+ 'a:solidFill': {
397
+ 'a:schemeClr': {
398
+ a$: {
399
+ 'val': 'tx1'
400
+ },
401
+ 'a:lumMod': {
402
+ a$: {
403
+ 'val': '65000'
404
+ }
405
+ },
406
+ 'a:lumOff': {
407
+ a$: {
408
+ 'val': '35000'
409
+ }
410
+ }
411
+ }
412
+ },
413
+ 'a:latin': {
414
+ a$: {
415
+ 'typeface': '+mn-lt'
416
+ }
417
+ },
418
+ 'a:ea': {
419
+ a$: {
420
+ 'typeface': '+mn-ea'
421
+ }
422
+ },
423
+ 'a:cs': {
424
+ a$: {
425
+ 'typeface': '+mn-cs'
426
+ }
427
+ }
428
+ }
429
+ },
430
+ 'a:endParaRPr': {
431
+ a$: {
432
+ 'lang': 'en-US'
433
+ }
434
+ }
435
+ }
436
+ },
437
+ 'c:crossAx': {
438
+ a$: {
439
+ 'val': '2028657983'
440
+ }
441
+ },
442
+ 'c:crosses': {
443
+ a$: {
444
+ 'val': 'autoZero'
445
+ }
446
+ },
447
+ 'c:crossBetween': {
448
+ a$: {
449
+ 'val': 'midCat'
450
+ }
451
+ }
452
+ }
453
+ ],
454
+ 'c:spPr': {
455
+ 'a:noFill': {},
456
+ 'a:ln': {
457
+ 'a:noFill': {}
458
+ },
459
+ 'a:effectLst': {}
460
+ }
461
+ },
462
+ 'c:plotVisOnly': {
463
+ a$: {
464
+ 'val': '1'
465
+ }
466
+ },
467
+ 'c:dispBlanksAs': {
468
+ a$: {
469
+ 'val': 'gap'
470
+ }
471
+ },
472
+ 'c:extLst': {
473
+ 'c:ext': {
474
+ a$: {
475
+ 'uri': '{56B9EC1D-385E-4148-901F-78D8002777C0}',
476
+ 'xmlns:c16r3': 'http://schemas.microsoft.com/office/drawing/2017/03/chart'
477
+ },
478
+ 'c16r3:dataDisplayOptions16': {
479
+ 'c16r3:dispNaAsBlank': {
480
+ a$: {
481
+ 'val': '1'
482
+ }
483
+ }
484
+ }
485
+ }
486
+ },
487
+ 'c:showDLblsOverMax': {
488
+ a$: {
489
+ 'val': '0'
490
+ }
491
+ }
492
+ };
493
+
494
+ export const bubble_series = {
495
+
496
+ 'c:spPr': {
497
+ 'a:solidFill': {
498
+ 'a:schemeClr': {
499
+ a$: {
500
+ val: 'accent1',
501
+ },
502
+ 'a:alpha': {
503
+ a$: {
504
+ val: '75000',
505
+ },
506
+ },
507
+ },
508
+ },
509
+ 'a:ln': {
510
+ 'a:noFill': {},
511
+ },
512
+ 'a:effectLst': {},
513
+ },
514
+
515
+ 'c:xVal': {
516
+ 'c:numRef': {
517
+ 'c:f': '',
518
+ }
519
+ },
520
+
521
+ 'c:yVal': {
522
+ 'c:numRef': {
523
+ 'c:f': '',
524
+ }
525
+ },
526
+
527
+ 'c:bubbleSize': {
528
+ 'c:numRef': {
529
+ 'c:f': '',
530
+ }
531
+ },
532
+
533
+ 'c:bubble3D': {
534
+ a$: {
535
+ val: '0',
536
+ }
537
+ },
538
+
539
+ 'c:extLst': {
540
+ 'c:ext': {
541
+ a$: {
542
+ 'uri': '{C3380CC4-5D6E-409C-BE32-E72D297353CC}',
543
+ 'xmlns:c16': 'http://schemas.microsoft.com/office/drawing/2014/chart'
544
+ },
545
+ 'c16:uniqueId': {
546
+ a$: {
547
+ 'val': '{00000000-03D7-43A5-9DAB-5775FFEF9C03}'
548
+ }
549
+ }
550
+ }
551
+ }
552
+
553
+ }
@@ -27,6 +27,7 @@ import { static_title, ref_title, chart_template } from './chart-template-compon
27
27
  import { column_json, column_series } from './column-chart-template2';
28
28
  import { donut_json } from './donut-chart-template2';
29
29
  import { scatter_json, scatter_series } from './scatter-chart-template2';
30
+ import { bubble_json, bubble_series } from './bubble-chart-template';
30
31
 
31
32
  import { XMLUtils } from '../xml-utils';
32
33
 
@@ -44,11 +45,12 @@ import { Localization } from 'treb-base-types';
44
45
  import type { RelationshipMap } from '../relationship';
45
46
 
46
47
  export interface ChartOptions {
47
- type: 'donut'|'column'|'bar'|'scatter'|'scatter2';
48
+ type: 'donut'|'column'|'bar'|'scatter'|'scatter2' | 'bubble';
48
49
  title?: UnitLiteral | UnitAddress;
49
50
  data: UnitRange[];
50
51
  labels?: UnitRange;
51
52
  labels2?: UnitRange[];
53
+ labels3?: UnitRange[];
52
54
  names?: ExpressionUnit[];
53
55
  smooth?: boolean;
54
56
  }
@@ -110,6 +112,9 @@ export class Chart {
110
112
  case 'scatter2':
111
113
  return this.CreateScatterChart();
112
114
 
115
+ case 'bubble':
116
+ return this.CreateBubbleChart();
117
+
113
118
  case 'donut':
114
119
  return this.CreateDonutChart();
115
120
 
@@ -121,6 +126,84 @@ export class Chart {
121
126
 
122
127
  }
123
128
 
129
+ public CreateBubbleChart() {
130
+
131
+ const template = JSON.parse(JSON.stringify(chart_template));
132
+ const chartspace = template['c:chartSpace'];
133
+ const bubble = JSON.parse(JSON.stringify(bubble_json));
134
+
135
+ chartspace['c:chart'] = bubble;
136
+
137
+ this.UpdateChartTitle(chartspace['c:chart']);
138
+
139
+ const cser = chartspace['c:chart']['c:plotArea']['c:bubbleChart']['c:ser']; // this.FindNode('c:ser', template);
140
+
141
+ let legend = false;
142
+
143
+ for (let i = 0; i < this.options.data.length; i++) {
144
+
145
+ const series = JSON.parse(JSON.stringify(bubble_series));
146
+
147
+ series['c:idx'] = { a$: { val: i.toString() }};
148
+ series['c:order'] = { a$: { val: i.toString() }};
149
+
150
+ if (this.options.names && this.options.names[i]) {
151
+
152
+ const name = this.options.names[i];
153
+ switch (name.type) {
154
+ case 'literal':
155
+ series['c:tx'] = {
156
+ 'c:v': name.value.toString(),
157
+ };
158
+ legend = true;
159
+ break;
160
+
161
+ case 'range':
162
+ case 'address':
163
+ series['c:tx'] = {
164
+ 'c:strRef': {
165
+ 'c:f': name.label,
166
+ }
167
+ };
168
+ legend = true;
169
+ break;
170
+ }
171
+ }
172
+
173
+ // "accent7" will break
174
+
175
+ if (i < 6) {
176
+ series['c:spPr']['a:solidFill']['a:schemeClr'].a$['val'] = `accent${i+1}`;
177
+ }
178
+
179
+ series['c:yVal']['c:numRef']['c:f'] = this.options.data[i]?.label;
180
+
181
+ if (this.options.labels2 && this.options.labels2[i]) {
182
+ series['c:xVal']['c:numRef']['c:f'] = this.options.labels2[i]?.label;
183
+ }
184
+
185
+ if (this.options.labels3 && this.options.labels3[i]) {
186
+ series['c:bubbleSize']['c:numRef']['c:f'] = this.options.labels3[i]?.label;
187
+ }
188
+
189
+ // console.info("SER", JSON.stringify(series, undefined, 2));
190
+
191
+ cser.push(series);
192
+
193
+ }
194
+
195
+ if (legend) {
196
+ chartspace['c:chart']['c:legend'] = {
197
+ 'c:legendPos': { a$: {val: 'b'}, },
198
+ 'c:overlay': { a$: {val: '0'}, },
199
+ };
200
+ }
201
+
202
+ return template;
203
+
204
+ }
205
+
206
+
124
207
  public CreateScatterChart() {
125
208
 
126
209
  const template = JSON.parse(JSON.stringify(chart_template));
@@ -57,6 +57,7 @@ const ImportSheet = (data: any) => {
57
57
  results.sheets.push(result);
58
58
  }
59
59
  }
60
+
60
61
  ctx.postMessage({ status: 'complete', results });
61
62
 
62
63
  }