@eclipse-scout/chart 22.0.39 → 23.1.0-beta.4

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.
Files changed (112) hide show
  1. package/LICENSE +210 -0
  2. package/dist/d.ts/chart/AbstractChartRenderer.d.ts +48 -0
  3. package/dist/d.ts/chart/AbstractChartRenderer.d.ts.map +1 -0
  4. package/dist/d.ts/chart/AbstractSvgChartRenderer.d.ts +65 -0
  5. package/dist/d.ts/chart/AbstractSvgChartRenderer.d.ts.map +1 -0
  6. package/dist/d.ts/chart/Chart.d.ts +162 -0
  7. package/dist/d.ts/chart/Chart.d.ts.map +1 -0
  8. package/dist/d.ts/chart/ChartAdapter.d.ts +8 -0
  9. package/dist/d.ts/chart/ChartAdapter.d.ts.map +1 -0
  10. package/dist/d.ts/chart/ChartEventMap.d.ts +16 -0
  11. package/dist/d.ts/chart/ChartEventMap.d.ts.map +1 -0
  12. package/dist/d.ts/chart/ChartJsRenderer.d.ts +300 -0
  13. package/dist/d.ts/chart/ChartJsRenderer.d.ts.map +1 -0
  14. package/dist/d.ts/chart/ChartLayout.d.ts +8 -0
  15. package/dist/d.ts/chart/ChartLayout.d.ts.map +1 -0
  16. package/dist/d.ts/chart/ChartModel.d.ts +11 -0
  17. package/dist/d.ts/chart/ChartModel.d.ts.map +1 -0
  18. package/dist/d.ts/chart/FulfillmentChartRenderer.d.ts +22 -0
  19. package/dist/d.ts/chart/FulfillmentChartRenderer.d.ts.map +1 -0
  20. package/dist/d.ts/chart/SalesfunnelChartRenderer.d.ts +61 -0
  21. package/dist/d.ts/chart/SalesfunnelChartRenderer.d.ts.map +1 -0
  22. package/dist/d.ts/chart/SpeedoChartRenderer.d.ts +90 -0
  23. package/dist/d.ts/chart/SpeedoChartRenderer.d.ts.map +1 -0
  24. package/dist/d.ts/chart/VennAsync3Calculator.d.ts +32 -0
  25. package/dist/d.ts/chart/VennAsync3Calculator.d.ts.map +1 -0
  26. package/dist/d.ts/chart/VennChartRenderer.d.ts +36 -0
  27. package/dist/d.ts/chart/VennChartRenderer.d.ts.map +1 -0
  28. package/dist/d.ts/chart/VennCircle.d.ts +20 -0
  29. package/dist/d.ts/chart/VennCircle.d.ts.map +1 -0
  30. package/dist/d.ts/chart/VennCircleHelper.d.ts +13 -0
  31. package/dist/d.ts/chart/VennCircleHelper.d.ts.map +1 -0
  32. package/dist/d.ts/form/fields/chartfield/ChartField.d.ts +11 -0
  33. package/dist/d.ts/form/fields/chartfield/ChartField.d.ts.map +1 -0
  34. package/dist/d.ts/form/fields/chartfield/ChartFieldAdapter.d.ts +4 -0
  35. package/dist/d.ts/form/fields/chartfield/ChartFieldAdapter.d.ts.map +1 -0
  36. package/dist/d.ts/form/fields/chartfield/ChartFieldModel.d.ts +6 -0
  37. package/dist/d.ts/form/fields/chartfield/ChartFieldModel.d.ts.map +1 -0
  38. package/dist/d.ts/index.d.ts +31 -0
  39. package/dist/d.ts/index.d.ts.map +1 -0
  40. package/dist/d.ts/table/controls/ChartTableControl.d.ts +136 -0
  41. package/dist/d.ts/table/controls/ChartTableControl.d.ts.map +1 -0
  42. package/dist/d.ts/table/controls/ChartTableControlAdapter.d.ts +5 -0
  43. package/dist/d.ts/table/controls/ChartTableControlAdapter.d.ts.map +1 -0
  44. package/dist/d.ts/table/controls/ChartTableControlEventMap.d.ts +9 -0
  45. package/dist/d.ts/table/controls/ChartTableControlEventMap.d.ts.map +1 -0
  46. package/dist/d.ts/table/controls/ChartTableControlLayout.d.ts +8 -0
  47. package/dist/d.ts/table/controls/ChartTableControlLayout.d.ts.map +1 -0
  48. package/dist/d.ts/table/controls/ChartTableControlModel.d.ts +9 -0
  49. package/dist/d.ts/table/controls/ChartTableControlModel.d.ts.map +1 -0
  50. package/dist/d.ts/table/controls/ChartTableUserFilter.d.ts +29 -0
  51. package/dist/d.ts/table/controls/ChartTableUserFilter.d.ts.map +1 -0
  52. package/dist/d.ts/table/controls/ChartTableUserFilterModel.d.ts +11 -0
  53. package/dist/d.ts/table/controls/ChartTableUserFilterModel.d.ts.map +1 -0
  54. package/dist/d.ts/tile/ChartFieldTile.d.ts +14 -0
  55. package/dist/d.ts/tile/ChartFieldTile.d.ts.map +1 -0
  56. package/dist/d.ts/tile/ChartFieldTileAdapter.d.ts +4 -0
  57. package/dist/d.ts/tile/ChartFieldTileAdapter.d.ts.map +1 -0
  58. package/dist/d.ts/tile/ChartFieldTileModel.d.ts +6 -0
  59. package/dist/d.ts/tile/ChartFieldTileModel.d.ts.map +1 -0
  60. package/dist/eclipse-scout-chart-fae6f958a044232e659c.min.js +3 -0
  61. package/dist/eclipse-scout-chart-fae6f958a044232e659c.min.js.map +1 -0
  62. package/dist/eclipse-scout-chart-theme-dark-89bcf2022056cbf8e371.min.css +1 -0
  63. package/dist/eclipse-scout-chart-theme-dark.css +1 -1
  64. package/dist/eclipse-scout-chart-theme-dark.css.map +1 -1
  65. package/dist/eclipse-scout-chart-theme-e25b5923d4dba5f5ca7e.min.css +1 -0
  66. package/dist/eclipse-scout-chart-theme.css +1 -1
  67. package/dist/eclipse-scout-chart-theme.css.map +1 -1
  68. package/dist/eclipse-scout-chart.esm-2119cfea86a9d6f34a35.min.js +3 -0
  69. package/dist/eclipse-scout-chart.esm-2119cfea86a9d6f34a35.min.js.map +1 -0
  70. package/dist/eclipse-scout-chart.esm.js +6919 -0
  71. package/dist/eclipse-scout-chart.esm.js.map +1 -0
  72. package/dist/eclipse-scout-chart.js +683 -15122
  73. package/dist/eclipse-scout-chart.js.map +1 -1
  74. package/dist/file-list +8 -5
  75. package/dist/texts.json +17 -17
  76. package/package.json +21 -15
  77. package/src/chart/{AbstractChartRenderer.js → AbstractChartRenderer.ts} +31 -25
  78. package/src/chart/{AbstractSvgChartRenderer.js → AbstractSvgChartRenderer.ts} +78 -43
  79. package/src/chart/{Chart.js → Chart.ts} +153 -62
  80. package/src/chart/ChartAdapter.ts +27 -0
  81. package/src/chart/ChartEventMap.ts +27 -0
  82. package/src/chart/{ChartJsRenderer.js → ChartJsRenderer.ts} +367 -351
  83. package/src/chart/{ChartLayout.js → ChartLayout.ts} +9 -8
  84. package/src/chart/ChartModel.ts +21 -0
  85. package/src/chart/{FulfillmentChartRenderer.js → FulfillmentChartRenderer.ts} +21 -18
  86. package/src/chart/{SalesfunnelChartRenderer.js → SalesfunnelChartRenderer.ts} +96 -59
  87. package/src/chart/{SpeedoChartRenderer.js → SpeedoChartRenderer.ts} +61 -39
  88. package/src/chart/{VennAsync3Calculator.js → VennAsync3Calculator.ts} +37 -13
  89. package/src/chart/{VennChartRenderer.js → VennChartRenderer.ts} +58 -34
  90. package/src/chart/{VennCircle.js → VennCircle.ts} +22 -15
  91. package/src/chart/{VennCircleHelper.js → VennCircleHelper.ts} +15 -9
  92. package/src/form/fields/chartfield/{ChartField.js → ChartField.ts} +11 -5
  93. package/src/form/fields/chartfield/{ChartFieldAdapter.js → ChartFieldAdapter.ts} +3 -8
  94. package/src/form/fields/chartfield/ChartFieldModel.ts +16 -0
  95. package/src/index.ts +46 -0
  96. package/src/table/controls/{ChartTableControl.js → ChartTableControl.ts} +160 -120
  97. package/src/table/controls/{ChartTableControlAdapter.js → ChartTableControlAdapter.ts} +3 -4
  98. package/src/table/controls/ChartTableControlEventMap.ts +19 -0
  99. package/src/table/controls/{ChartTableControlLayout.js → ChartTableControlLayout.ts} +7 -5
  100. package/src/table/controls/ChartTableControlModel.ts +19 -0
  101. package/src/table/controls/{ChartTableUserFilter.js → ChartTableUserFilter.ts} +25 -12
  102. package/src/table/controls/ChartTableUserFilterModel.ts +19 -0
  103. package/src/tile/{ChartFieldTile.js → ChartFieldTile.ts} +14 -8
  104. package/src/tile/{ChartFieldTileAdapter.js → ChartFieldTileAdapter.ts} +3 -7
  105. package/src/tile/ChartFieldTileModel.ts +16 -0
  106. package/dist/eclipse-scout-chart-bc08151d11e1909eff6c.min.js +0 -3
  107. package/dist/eclipse-scout-chart-bc08151d11e1909eff6c.min.js.LICENSE.txt +0 -6
  108. package/dist/eclipse-scout-chart-bc08151d11e1909eff6c.min.js.map +0 -1
  109. package/dist/eclipse-scout-chart-theme-79622289bda68b525e3e.min.css +0 -1
  110. package/dist/eclipse-scout-chart-theme-dark-1de09c03e3dc40a9529a.min.css +0 -1
  111. package/src/chart/ChartAdapter.js +0 -30
  112. package/src/index.js +0 -36
@@ -1,18 +1,52 @@
1
1
  /*
2
- * Copyright (c) 2010-2021 BSI Business Systems Integration AG.
2
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
3
3
  * All rights reserved. This program and the accompanying materials
4
4
  * are made available under the terms of the Eclipse Public License v1.0
5
5
  * which accompanies this distribution, and is available at
6
- * http://www.eclipse.org/legal/epl-v10.html
6
+ * https://www.eclipse.org/legal/epl-v10.html
7
7
  *
8
8
  * Contributors:
9
9
  * BSI Business Systems Integration AG - initial API and implementation
10
10
  */
11
- import {arrays, DateColumn, icons, NumberColumn, objects, scout, scrollbars, strings, styles, TableControl, TableMatrix, tooltips} from '@eclipse-scout/core';
12
- import {Chart, ChartTableControlLayout, ChartTableUserFilter} from '../../index';
11
+ import {
12
+ arrays, Column, DateColumn, Event, EventListener, Icon, IconDesc, icons, InitModelOf, NumberColumn, objects, scout, scrollbars, strings, styles, Table, TableControl, TableMatrix, TableMatrixDateGroup, TableMatrixKeyAxis,
13
+ TableMatrixNumberGroup, TableMatrixResult, tooltips
14
+ } from '@eclipse-scout/core';
15
+ import {Chart, ChartTableControlEventMap, ChartTableControlLayout, ChartTableControlModel, ChartTableUserFilter} from '../../index';
13
16
  import $ from 'jquery';
14
-
15
- export default class ChartTableControl extends TableControl {
17
+ import {BubbleDataPoint, ChartData, ChartType as ChartJsType} from 'chart.js';
18
+ import {ChartConfig, ClickObject} from '../../chart/Chart';
19
+
20
+ export class ChartTableControl extends TableControl implements ChartTableControlModel {
21
+ declare model: ChartTableControlModel;
22
+ declare eventMap: ChartTableControlEventMap;
23
+ declare self: ChartTableControl;
24
+
25
+ chartAggregation: TableControlChartAggregation;
26
+ chartGroup1: TableControlChartGroup;
27
+ chartGroup2: TableControlChartGroup;
28
+ chartType: TableControlChartType;
29
+ oldChartType: TableControlChartType;
30
+ chart: Chart;
31
+ chartColorScheme: string;
32
+ xAxis: TableMatrixKeyAxis;
33
+ yAxis: TableMatrixKeyAxis;
34
+ dateGroup: (TableMatrixDateGroup | string)[][];
35
+
36
+ $chartSelect: JQuery;
37
+ $axisSelectContainer: JQuery;
38
+ $xAxisSelect: JQuery;
39
+ $yAxisSelect: JQuery;
40
+ $dataSelect: JQuery;
41
+ protected _chartTypeMap: Record<TableControlChartType, JQuery>;
42
+ protected _aggregationMap: Record<string, JQuery>;
43
+ protected _chartGroup1Map: Record<string, JQuery>;
44
+ protected _chartGroup2Map: Record<string, JQuery>;
45
+ protected _tableUpdatedHandler: (e: Event<Table>) => void;
46
+ protected _tableColumnStructureChangedHandler: () => void;
47
+ protected _chartValueClickedHandler: () => void;
48
+ protected _filterResetListener: EventListener;
49
+ protected _tableUpdatedTimeOutId: number;
16
50
 
17
51
  constructor() {
18
52
  super();
@@ -22,9 +56,10 @@ export default class ChartTableControl extends TableControl {
22
56
  };
23
57
  this.chartType = Chart.Type.BAR;
24
58
  this.oldChartType = null;
59
+ this.chart = null;
25
60
  this.chartColorScheme = 'chart-table-control';
26
61
 
27
- // chart config selection
62
+ /** chart config selection */
28
63
  this.$chartSelect = null;
29
64
  this.$xAxisSelect = null;
30
65
  this.$yAxisSelect = null;
@@ -43,39 +78,39 @@ export default class ChartTableControl extends TableControl {
43
78
  static DATE_GROUP_FLAG = 0x100;
44
79
  static MAX_AXIS_COUNT = 100;
45
80
 
46
- _init(model) {
81
+ protected override _init(model: InitModelOf<this>) {
47
82
  super._init(model);
48
83
  this.table.on('columnStructureChanged', this._tableColumnStructureChangedHandler);
49
84
 
50
- this.chart = scout.create('Chart', {
85
+ this.chart = scout.create(Chart, {
51
86
  parent: this
52
87
  });
53
88
  }
54
89
 
55
- _destroy() {
90
+ protected override _destroy() {
56
91
  this.table.off('columnStructureChanged', this._tableColumnStructureChangedHandler);
57
92
  super._destroy();
58
93
  }
59
94
 
60
- _computeEnabled(inheritAccessibility, parentEnabled) {
95
+ protected override _computeEnabled(inheritAccessibility: boolean, parentEnabled: boolean): boolean {
61
96
  if (!this._hasColumns() && !this.selected) {
62
97
  return false;
63
98
  }
64
99
  return super._computeEnabled(inheritAccessibility, parentEnabled);
65
100
  }
66
101
 
67
- _renderChart() {
102
+ protected _renderChart() {
68
103
  if (this.chart) {
69
104
  this.chart.render(this.$contentContainer);
70
105
  this.chart.$container.addClass(this.denseClass);
71
106
  }
72
107
  }
73
108
 
74
- _createLayout() {
109
+ protected override _createLayout(): ChartTableControlLayout {
75
110
  return new ChartTableControlLayout(this);
76
111
  }
77
112
 
78
- _renderChartType() {
113
+ protected _renderChartType() {
79
114
  this._selectChartType();
80
115
  this.$yAxisSelect.toggleClass('hide', this.chartType !== Chart.Type.BUBBLE);
81
116
  this.$yAxisSelect.toggleClass('animated', scout.isOneOf(Chart.Type.BUBBLE, this.chartType, this.oldChartType) && !!this.oldChartType);
@@ -94,22 +129,22 @@ export default class ChartTableControl extends TableControl {
94
129
  }
95
130
  }
96
131
 
97
- _selectChartType() {
132
+ protected _selectChartType() {
98
133
  objects.values(this._chartTypeMap).forEach($element => {
99
134
  $element.removeClass('selected');
100
135
  });
101
136
  this._chartTypeMap[this.chartType].addClass('selected');
102
137
  }
103
138
 
104
- _renderChartGroup1() {
139
+ protected _renderChartGroup1() {
105
140
  this._renderChartGroup(1);
106
141
  }
107
142
 
108
- _renderChartGroup2() {
143
+ protected _renderChartGroup2() {
109
144
  this._renderChartGroup(2);
110
145
  }
111
146
 
112
- _renderChartGroup(groupId) {
147
+ protected _renderChartGroup(groupId: 1 | 2) {
113
148
  if (!this._hasColumns()) {
114
149
  return;
115
150
  }
@@ -132,10 +167,10 @@ export default class ChartTableControl extends TableControl {
132
167
  }
133
168
  }
134
169
 
135
- _renderChartAggregation() {
170
+ protected _renderChartAggregation() {
136
171
  let $element = this._aggregationMap[this.chartAggregation.id || 'all'];
137
172
  if ($element) {
138
- $element.selectOne('selected');
173
+ $element.selectOne();
139
174
  $element
140
175
  .removeClass('data-sum')
141
176
  .removeClass('data-avg');
@@ -146,7 +181,7 @@ export default class ChartTableControl extends TableControl {
146
181
  }
147
182
  }
148
183
 
149
- _getAggregationCssClass() {
184
+ protected _getAggregationCssClass(): string {
150
185
  switch (this.chartAggregation.modifier) {
151
186
  case TableMatrix.NumberGroup.COUNT:
152
187
  return 'data-count';
@@ -159,8 +194,8 @@ export default class ChartTableControl extends TableControl {
159
194
  }
160
195
  }
161
196
 
162
- _renderChartSelect(cssClass, chartType, iconId) {
163
- let icon = scout.create('Icon', {
197
+ protected _renderChartSelect(cssClass: string, chartType: TableControlChartType, iconId: string) {
198
+ let icon = scout.create(Icon, {
164
199
  parent: this,
165
200
  iconDesc: iconId,
166
201
  cssClass: cssClass
@@ -181,13 +216,13 @@ export default class ChartTableControl extends TableControl {
181
216
 
182
217
  /**
183
218
  * Appends a chart selection divs to this.$contentContainer and sets the this.$chartSelect property.
184
- * */
185
- _renderChartSelectContainer() {
219
+ **/
220
+ protected _renderChartSelectContainer() {
186
221
  // create container
187
222
  this.$chartSelect = this.$contentContainer.appendDiv('chart-select');
188
223
 
189
224
  // create chart types for selection
190
- this._chartTypeMap = {};
225
+ this._chartTypeMap = {} as Record<TableControlChartType, JQuery>;
191
226
 
192
227
  let supportedChartTypes = this._getSupportedChartTypes();
193
228
 
@@ -208,7 +243,7 @@ export default class ChartTableControl extends TableControl {
208
243
  }
209
244
  }
210
245
 
211
- _getSupportedChartTypes() {
246
+ protected _getSupportedChartTypes(): TableControlChartType[] {
212
247
  return [
213
248
  Chart.Type.BAR,
214
249
  Chart.Type.BAR_HORIZONTAL,
@@ -218,13 +253,13 @@ export default class ChartTableControl extends TableControl {
218
253
  ];
219
254
  }
220
255
 
221
- _onClickChartType(event) {
256
+ protected _onClickChartType(event: JQuery.ClickEvent) {
222
257
  let $target = $(event.currentTarget),
223
258
  chartType = $target.data('chartType');
224
259
  this.setChartType(chartType);
225
260
  }
226
261
 
227
- _onClickChartGroup(event) {
262
+ protected _onClickChartGroup(event: JQuery.ClickEvent) {
228
263
  let $target = $(event.currentTarget),
229
264
  groupId = $target.parent().data('groupId'),
230
265
  column = $target.data('column'),
@@ -246,7 +281,7 @@ export default class ChartTableControl extends TableControl {
246
281
  this._setChartGroup(groupId, config);
247
282
  }
248
283
 
249
- _onClickAggregation(event) {
284
+ protected _onClickAggregation(event: JQuery.ClickEvent) {
250
285
  let $target = $(event.currentTarget);
251
286
  // update modifier
252
287
  let origModifier = $target.data('modifier');
@@ -262,7 +297,7 @@ export default class ChartTableControl extends TableControl {
262
297
  this._setChartAggregation(aggregation);
263
298
  }
264
299
 
265
- _nextDateModifier(modifier) {
300
+ protected _nextDateModifier(modifier: TableMatrixDateGroup): TableMatrixDateGroup {
266
301
  switch (modifier) {
267
302
  case TableMatrix.DateGroup.DATE:
268
303
  return TableMatrix.DateGroup.MONTH;
@@ -277,7 +312,7 @@ export default class ChartTableControl extends TableControl {
277
312
  }
278
313
  }
279
314
 
280
- _nextModifier(modifier) {
315
+ protected _nextModifier(modifier: TableMatrixNumberGroup): TableMatrixNumberGroup {
281
316
  switch (modifier) {
282
317
  case TableMatrix.NumberGroup.SUM:
283
318
  return TableMatrix.NumberGroup.AVG;
@@ -288,7 +323,7 @@ export default class ChartTableControl extends TableControl {
288
323
  }
289
324
  }
290
325
 
291
- _setChartAggregation(chartAggregation) {
326
+ protected _setChartAggregation(chartAggregation: TableControlChartAggregation) {
292
327
  if (chartAggregation === this.chartAggregation) {
293
328
  return;
294
329
  }
@@ -298,20 +333,20 @@ export default class ChartTableControl extends TableControl {
298
333
  }
299
334
  }
300
335
 
301
- _setChartGroup1(chartGroup) {
336
+ protected _setChartGroup1(chartGroup: TableControlChartGroup) {
302
337
  this._setChartGroup(1, chartGroup);
303
338
  }
304
339
 
305
- _setChartGroup2(chartGroup) {
340
+ protected _setChartGroup2(chartGroup: TableControlChartGroup) {
306
341
  this._setChartGroup(2, chartGroup);
307
342
  }
308
343
 
309
- _setChartGroup(groupId, chartGroup) {
344
+ protected _setChartGroup(groupId: 1 | 2, chartGroup: TableControlChartGroup) {
310
345
  let propertyName = 'chartGroup' + groupId;
311
346
  this._changeProperty(propertyName, chartGroup);
312
347
  }
313
348
 
314
- _changeProperty(prop, value) {
349
+ protected _changeProperty(prop: string, value: any) {
315
350
  if (value === this[prop]) {
316
351
  return;
317
352
  }
@@ -321,27 +356,27 @@ export default class ChartTableControl extends TableControl {
321
356
  }
322
357
  }
323
358
 
324
- setChartType(chartType) {
359
+ setChartType(chartType: TableControlChartType) {
325
360
  this.oldChartType = this.chartType;
326
361
  this.setProperty('chartType', chartType);
327
362
  }
328
363
 
329
- _hasColumns() {
364
+ protected _hasColumns(): boolean {
330
365
  return this.table.columns.length !== 0;
331
366
  }
332
367
 
333
- _axisCount(columnCount, column) {
334
- let i, tmpColumn;
335
- for (i = 0; i < columnCount.length; i++) {
368
+ protected _axisCount(columnCount: (number | Column<any>)[][], column: Column<any>): number {
369
+ let tmpColumn;
370
+ for (let i = 0; i < columnCount.length; i++) {
336
371
  tmpColumn = columnCount[i][0];
337
372
  if (tmpColumn === column) {
338
- return columnCount[i][1];
373
+ return columnCount[i][1] as number;
339
374
  }
340
375
  }
341
376
  return 0;
342
377
  }
343
378
 
344
- _plainAxisText(column, text) {
379
+ protected _plainAxisText(column: Column<any>, text: string): string {
345
380
  if (column.headerHtmlEnabled) {
346
381
  let plainText = strings.plainText(text);
347
382
  return plainText.replace(/\n/g, ' ');
@@ -349,7 +384,7 @@ export default class ChartTableControl extends TableControl {
349
384
  return text;
350
385
  }
351
386
 
352
- _renderContent($parent) {
387
+ protected override _renderContent($parent: JQuery) {
353
388
  this.$contentContainer = $parent.appendDiv('chart-container');
354
389
 
355
390
  // scrollbars
@@ -387,19 +422,19 @@ export default class ChartTableControl extends TableControl {
387
422
  this._drawChart();
388
423
  }
389
424
 
390
- _addListeners() {
425
+ protected _addListeners() {
391
426
  this.table.on('rowsInserted', this._tableUpdatedHandler);
392
427
  this.table.on('rowsDeleted', this._tableUpdatedHandler);
393
428
  this.table.on('allRowsDeleted', this._tableUpdatedHandler);
394
429
  this.chart.on('valueClick', this._chartValueClickedHandler);
395
430
  }
396
431
 
397
- _renderAxisSelectorsContainer() {
432
+ protected _renderAxisSelectorsContainer() {
398
433
  this.$axisSelectContainer = this.$contentContainer
399
434
  .appendDiv('axis-select-container');
400
435
  }
401
436
 
402
- _renderAxisSelectors() {
437
+ protected _renderAxisSelectors(): (number | Column<any>)[][] {
403
438
  // create container for x/y-axis
404
439
  this.$xAxisSelect = this.$axisSelectContainer
405
440
  .appendDiv('xaxis-select')
@@ -423,11 +458,11 @@ export default class ChartTableControl extends TableControl {
423
458
  this._chartGroup1Map = {};
424
459
  this._chartGroup2Map = {};
425
460
 
426
- // find best x and y axis: best is 9 different entries
461
+ // find best x- and y-axis: best is 9 different entries
427
462
  let matrix = new TableMatrix(this.table, this.session),
428
463
  columnCount = matrix.columnCount(false); // filterNumberColumns false: number columns will be filtered below
429
464
  columnCount.sort((a, b) => {
430
- return Math.abs(a[1] - 8) - Math.abs(b[1] - 8);
465
+ return Math.abs(a[1] as number - 8) - Math.abs(b[1] as number - 8);
431
466
  });
432
467
 
433
468
  let axisCount, enabled,
@@ -447,7 +482,7 @@ export default class ChartTableControl extends TableControl {
447
482
  // probably not a good idea, because with a lot of data, the chart fails to provide an oversight over the data
448
483
  // when the user must scroll and only sees a small part of the chart.
449
484
  if (column1 instanceof DateColumn) {
450
- // dates are always aggregated and thus we must not check if the chart has "too much data".
485
+ // dates are always aggregated, and thus we must not check if the chart has "too much data".
451
486
  enabled = true;
452
487
  } else {
453
488
  axisCount = this._axisCount(columnCount, column1);
@@ -551,7 +586,7 @@ export default class ChartTableControl extends TableControl {
551
586
  return columnCount;
552
587
  }
553
588
 
554
- _initializeSelection(columnCount) {
589
+ protected _initializeSelection(columnCount: (number | Column<any>)[][]) {
555
590
  let $axisColumns;
556
591
 
557
592
  if (!this.chartType) {
@@ -573,7 +608,7 @@ export default class ChartTableControl extends TableControl {
573
608
  }
574
609
  if (!this.chartGroup2 || !this.chartGroup2.id || !this._chartGroup2Map[this.chartGroup2.id]) {
575
610
  $axisColumns = this.$yAxisSelect.children(':not(.disabled)');
576
- this._setDefaultSelectionForGroup(2, columnCount, $axisColumns, 1 /* try to use the second column for the second group (if available). Otherwise the first column is used. */);
611
+ this._setDefaultSelectionForGroup(2, columnCount, $axisColumns, 1 /* try to use the second column for the second group (if available). Otherwise, the first column is used. */);
577
612
  }
578
613
  }
579
614
 
@@ -582,19 +617,19 @@ export default class ChartTableControl extends TableControl {
582
617
  * The implementation only considers columns that are part of the specified columnCount matrix and $candidates array.
583
618
  * From all these columns the last match that is lower or equal to the specified maxIndex is set as default chart group.
584
619
  *
585
- * @param {number} chartGroup The number of the chart group (1 or 2) for which the default column should be set.
586
- * @param {matrix} columnCount Column-count matrix as returned by TableMatrix#columnCount(). Holds possible grouping columns.
587
- * @param {array} $candidates jQuery array holding all axis columns that could be used as default.
588
- * @param {number} maxIndex The maximum column index to use as default column for the specified chartGroup.
620
+ * @param chartGroup The number of the chart group (1 or 2) for which the default column should be set.
621
+ * @param columnCount Column-count matrix as returned by TableMatrix#columnCount(). Holds possible grouping columns.
622
+ * @param $candidates jQuery array holding all axis columns that could be used as default.
623
+ * @param maxIndex The maximum column index to use as default column for the specified chartGroup.
589
624
  */
590
- _setDefaultSelectionForGroup(chartGroup, columnCount, $candidates, maxIndex) {
625
+ protected _setDefaultSelectionForGroup(chartGroup: 1 | 2, columnCount: (number | Column<any>)[][], $candidates: JQuery, maxIndex: number) {
591
626
  let col = this._getDefaultSelectedColumn(columnCount, $candidates, maxIndex);
592
627
  if (col) {
593
628
  this._setChartGroup(chartGroup, this._getDefaultChartGroup(col));
594
629
  }
595
630
  }
596
631
 
597
- _getDefaultSelectedColumn(columnCount, $candidates, maxIndex) {
632
+ protected _getDefaultSelectedColumn(columnCount: (number | Column<any>)[][], $candidates: JQuery, maxIndex: number): Column<any> {
598
633
  let matchCounter = 0,
599
634
  curColumn,
600
635
  result;
@@ -608,7 +643,7 @@ export default class ChartTableControl extends TableControl {
608
643
  return result;
609
644
  }
610
645
 
611
- _existsInAxisColumns($candidates, columnToSearch) {
646
+ protected _existsInAxisColumns($candidates: JQuery, columnToSearch: Column<any>): boolean {
612
647
  for (let i = 0; i < $candidates.length; i++) {
613
648
  if ($candidates.eq(i).data('column') === columnToSearch) {
614
649
  return true;
@@ -617,7 +652,7 @@ export default class ChartTableControl extends TableControl {
617
652
  return false;
618
653
  }
619
654
 
620
- _getDefaultChartGroup(column) {
655
+ protected _getDefaultChartGroup(column: Column<any>): TableControlChartGroup {
621
656
  let modifier;
622
657
  if (column instanceof DateColumn) {
623
658
  modifier = 256;
@@ -628,14 +663,14 @@ export default class ChartTableControl extends TableControl {
628
663
  };
629
664
  }
630
665
 
631
- _renderChartParts() {
666
+ protected _renderChartParts() {
632
667
  this._renderChartType();
633
668
  this._renderChartAggregation();
634
669
  this._renderChartGroup1();
635
670
  this._renderChartGroup2();
636
671
  }
637
672
 
638
- _drawChart() {
673
+ protected _drawChart() {
639
674
  if (!this._hasColumns()) {
640
675
  this._hideChart();
641
676
  return;
@@ -643,14 +678,14 @@ export default class ChartTableControl extends TableControl {
643
678
 
644
679
  let cube = this._calculateValues();
645
680
 
646
- if (cube.length) {
681
+ if (cube && cube.length) {
647
682
  this.chart.setVisible(true);
648
683
  } else {
649
684
  this._hideChart();
650
685
  return;
651
686
  }
652
687
 
653
- let config = {
688
+ let config: ChartConfig = {
654
689
  type: this.chartType,
655
690
  options: {
656
691
  handleResize: true,
@@ -676,19 +711,19 @@ export default class ChartTableControl extends TableControl {
676
711
  this.chart.setCheckedItems(checkedItems);
677
712
  }
678
713
 
679
- _hideChart() {
714
+ protected _hideChart() {
680
715
  this.chart.setConfig({
681
716
  type: this.chartType
682
717
  });
683
718
  this.chart.setVisible(false);
684
719
  }
685
720
 
686
- _getDatasetLabel() {
721
+ protected _getDatasetLabel(): string {
687
722
  let elem = this._aggregationMap[this.chartAggregation.id || 'all'];
688
723
  return (elem ? elem.text() : null) || this.session.text('ui.Value');
689
724
  }
690
725
 
691
- _calculateValues() {
726
+ protected _calculateValues(): TableMatrixResult {
692
727
  // build matrix
693
728
  let matrix = new TableMatrix(this.table, this.session);
694
729
 
@@ -713,27 +748,27 @@ export default class ChartTableControl extends TableControl {
713
748
 
714
749
  // return not possible to draw chart
715
750
  if (matrix.isEmpty() || !matrix.isMatrixValid()) {
716
- return false;
751
+ return;
717
752
  }
718
753
 
719
754
  // calculate matrix
720
755
  return matrix.calculate();
721
756
  }
722
757
 
723
- _getXAxis() {
758
+ protected _getXAxis(): TableMatrixKeyAxis {
724
759
  return this.xAxis;
725
760
  }
726
761
 
727
- _getYAxis() {
762
+ protected _getYAxis(): TableMatrixKeyAxis {
728
763
  return this.yAxis;
729
764
  }
730
765
 
731
- _computeData(iconClasses, cube) {
766
+ protected _computeData(iconClasses: string[], cube: TableMatrixResult): ChartData {
732
767
  let data = {
733
768
  datasets: [{
734
769
  label: this._getDatasetLabel()
735
770
  }]
736
- };
771
+ } as ChartData;
737
772
  if (!cube) {
738
773
  return data;
739
774
  }
@@ -781,7 +816,7 @@ export default class ChartTableControl extends TableControl {
781
816
  return data;
782
817
  }
783
818
 
784
- _computeBubbleData(iconClasses, cube) {
819
+ protected _computeBubbleData(iconClasses: string[], cube: TableMatrixResult): { value: BubbleDataPoint; deterministicKey: TableControlDeterministicKey }[] {
785
820
  if (!cube) {
786
821
  return [];
787
822
  }
@@ -826,7 +861,7 @@ export default class ChartTableControl extends TableControl {
826
861
  return segments;
827
862
  }
828
863
 
829
- _handleIconLabel(label, axis, iconClasses) {
864
+ protected _handleIconLabel(label: string, axis: TableMatrixKeyAxis, iconClasses: string[]): string {
830
865
  if (axis && axis.textIsIcon) {
831
866
  let icon = icons.parseIconId(label);
832
867
  if (icon && icon.isFontIcon()) {
@@ -837,7 +872,7 @@ export default class ChartTableControl extends TableControl {
837
872
  return label;
838
873
  }
839
874
 
840
- _adjustFont(config, iconClasses) {
875
+ protected _adjustFont(config: ChartConfig, iconClasses: string[]) {
841
876
  if (!config || !iconClasses) {
842
877
  return;
843
878
  }
@@ -888,7 +923,7 @@ export default class ChartTableControl extends TableControl {
888
923
  }
889
924
  }
890
925
 
891
- _adjustLabels(config) {
926
+ protected _adjustLabels(config: ChartConfig) {
892
927
  if (!config) {
893
928
  return;
894
929
  }
@@ -927,11 +962,11 @@ export default class ChartTableControl extends TableControl {
927
962
  }
928
963
  }
929
964
 
930
- _formatLabel(label, axis) {
965
+ protected _formatLabel(label: number | string, axis: TableMatrixKeyAxis): string {
931
966
  if (axis) {
932
967
  if (axis.column instanceof DateColumn) {
933
- label = label + axis.min;
934
- if (label !== parseInt(label) || (axis.length < 2 && (label < axis.min || label > axis.max))) {
968
+ label = label as number + axis.min;
969
+ if (label !== parseInt('' + label) || (axis.length < 2 && (label < axis.min || label > axis.max))) {
935
970
  return null;
936
971
  }
937
972
  }
@@ -942,7 +977,7 @@ export default class ChartTableControl extends TableControl {
942
977
  return null;
943
978
  }
944
979
  }
945
- label = axis.format(label);
980
+ label = axis.format(label as number);
946
981
  if (axis.textIsIcon) {
947
982
  let icon = icons.parseIconId(label);
948
983
  if (icon && icon.isFontIcon()) {
@@ -950,10 +985,10 @@ export default class ChartTableControl extends TableControl {
950
985
  }
951
986
  }
952
987
  }
953
- return label;
988
+ return '' + label;
954
989
  }
955
990
 
956
- _adjustConfig(config) {
991
+ protected _adjustConfig(config: ChartConfig) {
957
992
  if (!config) {
958
993
  return;
959
994
  }
@@ -970,7 +1005,7 @@ export default class ChartTableControl extends TableControl {
970
1005
  }
971
1006
  }
972
1007
 
973
- _adjustClickable(config) {
1008
+ protected _adjustClickable(config: ChartConfig) {
974
1009
  if (!config) {
975
1010
  return;
976
1011
  }
@@ -984,11 +1019,11 @@ export default class ChartTableControl extends TableControl {
984
1019
  }
985
1020
  }
986
1021
 
987
- _isChartClickable() {
1022
+ protected _isChartClickable(): boolean {
988
1023
  return true;
989
1024
  }
990
1025
 
991
- _adjustBubble(config) {
1026
+ protected _adjustBubble(config: ChartConfig) {
992
1027
  if (!config || this.chartType !== Chart.Type.BUBBLE) {
993
1028
  return;
994
1029
  }
@@ -999,7 +1034,7 @@ export default class ChartTableControl extends TableControl {
999
1034
  });
1000
1035
  }
1001
1036
 
1002
- _adjustPie(config) {
1037
+ protected _adjustPie(config: ChartConfig) {
1003
1038
  if (!config || this.chartType !== Chart.Type.PIE) {
1004
1039
  return;
1005
1040
  }
@@ -1041,7 +1076,7 @@ export default class ChartTableControl extends TableControl {
1041
1076
  });
1042
1077
  }
1043
1078
 
1044
- _adjustScales(config) {
1079
+ protected _adjustScales(config: ChartConfig) {
1045
1080
  if (!config) {
1046
1081
  return;
1047
1082
  }
@@ -1058,14 +1093,14 @@ export default class ChartTableControl extends TableControl {
1058
1093
  });
1059
1094
  }
1060
1095
 
1061
- _computeCheckedItems(deterministicKeys) {
1096
+ protected _computeCheckedItems(deterministicKeys: TableControlDeterministicKey[]): ClickObject[] {
1062
1097
  if (!deterministicKeys) {
1063
1098
  return [];
1064
1099
  }
1065
1100
 
1066
1101
  let xAxis = this._getXAxis(),
1067
1102
  yAxis = this._getYAxis(),
1068
- tableFilter = this.table.getFilter(ChartTableUserFilter.TYPE),
1103
+ tableFilter = this.table.getFilter(ChartTableUserFilter.TYPE) as ChartTableUserFilter,
1069
1104
  filters = [],
1070
1105
  checkedIndices = [];
1071
1106
 
@@ -1081,7 +1116,7 @@ export default class ChartTableControl extends TableControl {
1081
1116
  let datasetIndex = 0;
1082
1117
  if (this.chartType === Chart.Type.PIE) {
1083
1118
  let maxSegments = this.chart.config.options.maxSegments,
1084
- collapsedIndices = arrays.init(deterministicKeys.length - maxSegments).map((elem, idx) => idx + maxSegments);
1119
+ collapsedIndices = arrays.init(deterministicKeys.length - maxSegments, null).map((elem, idx) => idx + maxSegments);
1085
1120
  if (!arrays.containsAll(checkedIndices, collapsedIndices)) {
1086
1121
  arrays.remove(checkedIndices, maxSegments - 1);
1087
1122
  }
@@ -1104,18 +1139,18 @@ export default class ChartTableControl extends TableControl {
1104
1139
  return checkedItems;
1105
1140
  }
1106
1141
 
1107
- _onChartValueClick() {
1142
+ protected _onChartValueClick() {
1108
1143
  // prepare filter
1109
1144
  let filters = [];
1110
1145
  if (this.chart && this.chart.config.data) {
1111
1146
  let maxSegments = this.chart.config.options.maxSegments,
1112
1147
  dataset = this.chart.config.data.datasets[0],
1113
- getFilters = index => ({deterministicKey: dataset.deterministicKeys[index]});
1148
+ getFilters: (index: number) => { deterministicKey: TableControlDeterministicKey } | { deterministicKey: TableControlDeterministicKey }[] = index => ({deterministicKey: dataset.deterministicKeys[index]});
1114
1149
  if (this.chartType === Chart.Type.PIE) {
1115
1150
  getFilters = index => {
1116
- index = parseInt(index);
1151
+ index = parseInt('' + index);
1117
1152
  if (maxSegments && maxSegments === index + 1) {
1118
- return arrays.init(dataset.deterministicKeys.length - index).map((elem, idx) => ({deterministicKey: dataset.deterministicKeys[idx + index]}));
1153
+ return arrays.init(dataset.deterministicKeys.length - index, null).map((elem, idx) => ({deterministicKey: dataset.deterministicKeys[idx + index]}));
1119
1154
  }
1120
1155
  return {deterministicKey: dataset.deterministicKeys[index]};
1121
1156
  };
@@ -1130,7 +1165,7 @@ export default class ChartTableControl extends TableControl {
1130
1165
 
1131
1166
  // filter function
1132
1167
  if (filters.length) {
1133
- let filter = scout.create('ChartTableUserFilter', {
1168
+ let filter = scout.create(ChartTableUserFilter, {
1134
1169
  session: this.session,
1135
1170
  table: this.table,
1136
1171
  text: this.tooltipText,
@@ -1145,10 +1180,8 @@ export default class ChartTableControl extends TableControl {
1145
1180
  }
1146
1181
  }
1147
1182
 
1148
- _axisContentForColumn(column) {
1149
- let icon,
1150
- text = column.text;
1151
-
1183
+ protected _axisContentForColumn(column: Column<any>): { text: string; icon?: IconDesc } {
1184
+ let text = column.text;
1152
1185
  if (strings.hasText(text)) {
1153
1186
  return {
1154
1187
  text: text
@@ -1156,7 +1189,7 @@ export default class ChartTableControl extends TableControl {
1156
1189
  }
1157
1190
 
1158
1191
  if (column.headerIconId) {
1159
- icon = icons.parseIconId(column.headerIconId);
1192
+ let icon = icons.parseIconId(column.headerIconId);
1160
1193
  if (icon.isFontIcon()) {
1161
1194
  return {
1162
1195
  text: icon.iconCharacter,
@@ -1176,7 +1209,7 @@ export default class ChartTableControl extends TableControl {
1176
1209
  };
1177
1210
  }
1178
1211
 
1179
- _removeContent() {
1212
+ protected override _removeContent() {
1180
1213
  this._removeScrollbars();
1181
1214
  this.$contentContainer.remove();
1182
1215
  this.chart.remove();
@@ -1186,7 +1219,7 @@ export default class ChartTableControl extends TableControl {
1186
1219
  this.recomputeEnabled();
1187
1220
  }
1188
1221
 
1189
- _removeScrollbars() {
1222
+ protected _removeScrollbars() {
1190
1223
  this.$xAxisSelect.each((index, element) => {
1191
1224
  tooltips.uninstall($(element));
1192
1225
  });
@@ -1199,28 +1232,14 @@ export default class ChartTableControl extends TableControl {
1199
1232
  this._uninstallScrollbars();
1200
1233
  }
1201
1234
 
1202
- _removeListeners() {
1235
+ protected _removeListeners() {
1203
1236
  this.table.off('rowsInserted', this._tableUpdatedHandler);
1204
1237
  this.table.off('rowsDeleted', this._tableUpdatedHandler);
1205
1238
  this.table.off('allRowsDeleted', this._tableUpdatedHandler);
1206
1239
  this.chart.off('valueClick', this._chartValueClickedHandler);
1207
1240
  }
1208
1241
 
1209
- _pathSegment(mx, my, r, start, end) {
1210
- let s = start * 2 * Math.PI,
1211
- e = end * 2 * Math.PI,
1212
- pathString = '';
1213
-
1214
- pathString += 'M' + (mx + r * Math.sin(s)) + ',' + (my - r * Math.cos(s));
1215
- pathString += 'A' + r + ', ' + r;
1216
- pathString += (end - start < 0.5) ? ' 0 0,1 ' : ' 0 1,1 ';
1217
- pathString += (mx + r * Math.sin(e)) + ',' + (my - r * Math.cos(e));
1218
- pathString += 'L' + mx + ',' + my + 'Z';
1219
-
1220
- return pathString;
1221
- }
1222
-
1223
- _onTableUpdated(event) {
1242
+ protected _onTableUpdated(event?: Event<Table>) {
1224
1243
  if (this._tableUpdatedTimeOutId) {
1225
1244
  return;
1226
1245
  }
@@ -1239,10 +1258,31 @@ export default class ChartTableControl extends TableControl {
1239
1258
  });
1240
1259
  }
1241
1260
 
1242
- _onTableColumnStructureChanged() {
1261
+ protected _onTableColumnStructureChanged() {
1243
1262
  this.recomputeEnabled();
1244
1263
  if (this.contentRendered && this.selected) {
1245
1264
  this._onTableUpdated();
1246
1265
  }
1247
1266
  }
1248
1267
  }
1268
+
1269
+ export type TableControlChartType = typeof Chart.Type['BAR' | 'BAR_HORIZONTAL' | 'LINE' | 'PIE' | 'BUBBLE'];
1270
+
1271
+ export type TableControlChartAggregation = {
1272
+ id?: string;
1273
+ modifier?: TableMatrixNumberGroup;
1274
+ };
1275
+
1276
+ export type TableControlChartGroup = {
1277
+ id?: string;
1278
+ modifier?: TableMatrixNumberGroup | TableMatrixDateGroup;
1279
+ };
1280
+
1281
+ export type TableControlDeterministicKey = (number | string) | (number | string)[];
1282
+
1283
+ // extend chart.js
1284
+ declare module 'chart.js' {
1285
+ interface ChartDatasetProperties<TType extends ChartJsType, TData> {
1286
+ deterministicKeys?: TableControlDeterministicKey[];
1287
+ }
1288
+ }