@eclipse-scout/chart 11.0.39 → 22.0.0-beta.1

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 (30) hide show
  1. package/README.md +2 -2
  2. package/dist/eclipse-scout-chart-theme-dark.css +3806 -1606
  3. package/dist/eclipse-scout-chart-theme-dark.css.map +1 -1
  4. package/dist/eclipse-scout-chart-theme.css +3689 -1489
  5. package/dist/eclipse-scout-chart-theme.css.map +1 -1
  6. package/dist/eclipse-scout-chart.js +23316 -6685
  7. package/dist/eclipse-scout-chart.js.map +1 -1
  8. package/dist/file-list +0 -6
  9. package/package.json +21 -21
  10. package/src/chart/AbstractChartRenderer.js +7 -1
  11. package/src/chart/AbstractSvgChartRenderer.js +3 -3
  12. package/src/chart/Chart.js +40 -9
  13. package/src/chart/Chart.less +121 -78
  14. package/src/chart/ChartJsRenderer.js +1092 -580
  15. package/src/chart/FulfillmentChartRenderer.js +7 -5
  16. package/src/chart/SalesfunnelChartRenderer.js +16 -15
  17. package/src/chart/SpeedoChartRenderer.js +11 -9
  18. package/src/chart/VennAsync3Calculator.js +2 -9
  19. package/src/chart/VennChartRenderer.js +6 -17
  20. package/src/style/colors-dark.less +49 -11
  21. package/src/style/colors.less +74 -56
  22. package/src/table/controls/ChartTableControl.js +103 -156
  23. package/src/table/controls/ChartTableControl.less +177 -112
  24. package/src/table/controls/ChartTableControlLayout.js +4 -1
  25. package/dist/eclipse-scout-chart-4f219da36ee28808d3bf.min.js +0 -2
  26. package/dist/eclipse-scout-chart-4f219da36ee28808d3bf.min.js.map +0 -1
  27. package/dist/eclipse-scout-chart-theme-dark-e356c56e246c4f8f5ff3.min.css +0 -1
  28. package/dist/eclipse-scout-chart-theme-e85ee1f9c7c3e6d5af5d.min.css +0 -1
  29. package/dist/texts.json +0 -64
  30. package/src/chart/ChartJsTooltipDelay.js +0 -127
@@ -8,7 +8,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, strings, styles, TableControl, TableMatrix, tooltips} from '@eclipse-scout/core';
11
+ import {arrays, DateColumn, icons, NumberColumn, objects, scout, scrollbars, strings, styles, TableControl, TableMatrix, tooltips} from '@eclipse-scout/core';
12
12
  import {Chart, ChartTableControlLayout, ChartTableUserFilter} from '../../index';
13
13
  import $ from 'jquery';
14
14
 
@@ -77,13 +77,14 @@ export default class ChartTableControl extends TableControl {
77
77
 
78
78
  _renderChartType() {
79
79
  this._selectChartType();
80
- if (this.oldChartType) {
81
- this.$yAxisSelect.animateAVCSD('width', this.chartType === Chart.Type.BUBBLE ? 175 : 0);
82
- this.$yAxisSelect.animateAVCSD('margin-right', this.chartType === Chart.Type.BUBBLE ? 15 : 0);
83
- } else {
84
- this.$yAxisSelect.css('width', this.chartType === Chart.Type.BUBBLE ? 175 : 0);
85
- this.$yAxisSelect.css('margin-right', this.chartType === Chart.Type.BUBBLE ? 15 : 0);
86
- }
80
+ this.$yAxisSelect.toggleClass('hide', this.chartType !== Chart.Type.BUBBLE);
81
+ this.$yAxisSelect.toggleClass('animated', scout.isOneOf(Chart.Type.BUBBLE, this.chartType, this.oldChartType) && !!this.oldChartType);
82
+ this.$yAxisSelect.data('scroll-shadow').setVisible(false);
83
+ this.$yAxisSelect.oneAnimationEnd(() => {
84
+ scrollbars.update(this.$yAxisSelect);
85
+ this.$yAxisSelect.data('scroll-shadow').setVisible(true);
86
+ this.$yAxisSelect.removeClass('animated');
87
+ });
87
88
 
88
89
  if (this.contentRendered) {
89
90
  this.chart.$container.animateAVCSD('opacity', 0, () => {
@@ -117,7 +118,7 @@ export default class ChartTableControl extends TableControl {
117
118
  let chartGroup = this[groupName];
118
119
  if (chartGroup) {
119
120
  let $element = this[map][chartGroup.id];
120
- $element.siblings().animateAVCSD('height', 30);
121
+ $element.siblings('.select-axis').animateAVCSD('height', 30);
121
122
  $element.selectOne('selected');
122
123
 
123
124
  if (chartGroup.modifier > 0) {
@@ -158,19 +159,24 @@ export default class ChartTableControl extends TableControl {
158
159
  }
159
160
  }
160
161
 
161
- _renderChartSelect(cssClass, chartType, renderSvgIcon) {
162
- let $svg = this.$chartSelect
163
- .appendSVG('svg', cssClass + ' select-chart')
162
+ _renderChartSelect(cssClass, chartType, iconId) {
163
+ let icon = scout.create('Icon', {
164
+ parent: this,
165
+ iconDesc: iconId,
166
+ cssClass: cssClass
167
+ });
168
+ icon.render(this.$chartSelect);
169
+ this.$contentContainer.one('remove', () => icon.destroy());
170
+ let $iconContainer = icon.$container;
171
+ $iconContainer
164
172
  .toggleClass('disabled', !this.enabledComputed || !this._hasColumns())
165
173
  .data('chartType', chartType);
166
174
 
167
175
  if (this.enabledComputed && this._hasColumns()) {
168
- $svg.on('click', this._onClickChartType.bind(this));
176
+ $iconContainer.on('click', this._onClickChartType.bind(this));
169
177
  }
170
178
 
171
- this._chartTypeMap[chartType] = $svg;
172
-
173
- renderSvgIcon($svg);
179
+ this._chartTypeMap[chartType] = $iconContainer;
174
180
  }
175
181
 
176
182
  /**
@@ -186,88 +192,19 @@ export default class ChartTableControl extends TableControl {
186
192
  let supportedChartTypes = this._getSupportedChartTypes();
187
193
 
188
194
  if (scout.isOneOf(Chart.Type.BAR, supportedChartTypes)) {
189
- this._renderChartSelect('chart-bar', Chart.Type.BAR, renderSvgIconBar);
195
+ this._renderChartSelect('chart-bar', Chart.Type.BAR, icons.DIAGRAM_BARS_VERTICAL);
190
196
  }
191
197
  if (scout.isOneOf(Chart.Type.BAR_HORIZONTAL, supportedChartTypes)) {
192
- this._renderChartSelect('chart-stacked', Chart.Type.BAR_HORIZONTAL, renderSvgIconStacked);
198
+ this._renderChartSelect('chart-stacked', Chart.Type.BAR_HORIZONTAL, icons.DIAGRAM_BARS_HORIZONTAL);
193
199
  }
194
200
  if (scout.isOneOf(Chart.Type.LINE, supportedChartTypes)) {
195
- this._renderChartSelect('chart-line', Chart.Type.LINE, renderSvgIconLine);
201
+ this._renderChartSelect('chart-line', Chart.Type.LINE, icons.DIAGRAM_LINE);
196
202
  }
197
203
  if (scout.isOneOf(Chart.Type.PIE, supportedChartTypes)) {
198
- this._renderChartSelect('chart-pie', Chart.Type.PIE, renderSvgIconPie.bind(this));
204
+ this._renderChartSelect('chart-pie', Chart.Type.PIE, icons.DIAGRAM_PIE);
199
205
  }
200
206
  if (scout.isOneOf(Chart.Type.BUBBLE, supportedChartTypes)) {
201
- this._renderChartSelect('chart-bubble', Chart.Type.BUBBLE, renderSvgIconBubble);
202
- }
203
-
204
- function renderSvgIconBar($svg) {
205
- let show = [2, 4, 3, 3.5, 5];
206
-
207
- for (let s = 0; s < show.length; s++) {
208
- $svg.appendSVG('rect', 'select-fill')
209
- .attr('x', s * 13)
210
- .attr('y', 50 - show[s] * 9)
211
- .attr('width', 11)
212
- .attr('height', show[s] * 9);
213
- }
214
- }
215
-
216
- function renderSvgIconStacked($svg) {
217
- let show = [2, 4, 3.5, 4.5];
218
-
219
- for (let s = 0; s < show.length; s++) {
220
- $svg.appendSVG('rect', 'select-fill')
221
- .attr('x', 0)
222
- .attr('y', 16 + s * 9)
223
- .attr('width', show[s] * 14)
224
- .attr('height', 7);
225
- }
226
- }
227
-
228
- function renderSvgIconLine($svg) {
229
- let show = [0, 1.7, 1, 2, 1.5, 2.5],
230
- pathPoints = [];
231
-
232
- for (let s = 0; s < show.length; s++) {
233
- pathPoints.push(2 + (s * 12) + ',' + (45 - show[s] * 11));
234
- }
235
-
236
- $svg
237
- .appendSVG('path', 'select-fill-line')
238
- .attr('d', 'M' + pathPoints.join('L'));
239
- }
240
-
241
- function renderSvgIconPie($svg) {
242
- let show = [
243
- [0, 0.1],
244
- [0.1, 0.25],
245
- [0.25, 1]
246
- ];
247
-
248
- for (let s = 0; s < show.length; s++) {
249
- $svg
250
- .appendSVG('path', 'select-fill-pie')
251
- .attr('d', this._pathSegment(37, 30, 24, show[s][0], show[s][1]));
252
- }
253
- }
254
-
255
- function renderSvgIconBubble($svg) {
256
- $svg.appendSVG('line', 'select-fill-line')
257
- .attr('x1', 3).attr('y1', 53)
258
- .attr('x2', 63).attr('y2', 53);
259
-
260
- $svg.appendSVG('line', 'select-fill-line')
261
- .attr('x1', 8).attr('y1', 12)
262
- .attr('x2', 8).attr('y2', 58);
263
-
264
- $svg.appendSVG('circle', 'select-fill')
265
- .attr('cx', 22).attr('cy', 40)
266
- .attr('r', 5);
267
-
268
- $svg.appendSVG('circle', 'select-fill')
269
- .attr('cx', 50).attr('cy', 26)
270
- .attr('r', 11);
207
+ this._renderChartSelect('chart-bubble', Chart.Type.BUBBLE, icons.DIAGRAM_SCATTER);
271
208
  }
272
209
  }
273
210
 
@@ -437,14 +374,7 @@ export default class ChartTableControl extends TableControl {
437
374
 
438
375
  this._addListeners();
439
376
 
440
- // add addition rectangle for hover and event handling
441
- $('.select-chart', this.$contentContainer)
442
- .appendSVG('rect', 'select-events')
443
- .attr('width', 65)
444
- .attr('height', 60)
445
- .attr('fill', 'none')
446
- .attr('pointer-events', 'all');
447
-
377
+ this._renderAxisSelectorsContainer();
448
378
  let columnCount = this._renderAxisSelectors();
449
379
 
450
380
  // draw first chart
@@ -464,14 +394,30 @@ export default class ChartTableControl extends TableControl {
464
394
  this.chart.on('valueClick', this._chartValueClickedHandler);
465
395
  }
466
396
 
397
+ _renderAxisSelectorsContainer() {
398
+ this.$axisSelectContainer = this.$contentContainer
399
+ .appendDiv('axis-select-container');
400
+ }
401
+
467
402
  _renderAxisSelectors() {
468
403
  // create container for x/y-axis
469
- this.$xAxisSelect = this.$contentContainer
404
+ this.$xAxisSelect = this.$axisSelectContainer
470
405
  .appendDiv('xaxis-select')
471
406
  .data('groupId', 1);
472
- this.$yAxisSelect = this.$contentContainer
407
+ scrollbars.install(this.$xAxisSelect, {
408
+ parent: this,
409
+ session: this.session,
410
+ axis: 'y'
411
+ });
412
+
413
+ this.$yAxisSelect = this.$axisSelectContainer
473
414
  .appendDiv('yaxis-select')
474
415
  .data('groupId', 2);
416
+ scrollbars.install(this.$yAxisSelect, {
417
+ parent: this,
418
+ session: this.session,
419
+ axis: 'y'
420
+ });
475
421
 
476
422
  // map for selection (column id, $element)
477
423
  this._chartGroup1Map = {};
@@ -556,19 +502,17 @@ export default class ChartTableControl extends TableControl {
556
502
  this.$yAxisSelect.append($yDiv);
557
503
  }
558
504
 
559
- if (numberOfAxisItems < 2) {
560
- let $bubbleSelect = this.$contentContainer.find('.chart-bubble.select-chart');
561
- if ($bubbleSelect) {
562
- $bubbleSelect.remove();
563
- }
564
- }
565
-
566
505
  // map for selection (column id, $element)
567
506
  this._aggregationMap = {};
568
507
 
569
508
  if (this._hasColumns()) {
570
509
  // create container for data
571
- this.$dataSelect = this.$contentContainer.appendDiv('data-select');
510
+ this.$dataSelect = this.$axisSelectContainer.appendDiv('data-select');
511
+ scrollbars.install(this.$dataSelect, {
512
+ parent: this,
513
+ session: this.session,
514
+ axis: 'y'
515
+ });
572
516
 
573
517
  // add data-count for no column restriction (all columns)
574
518
  let countDesc = this.session.text('ui.Count');
@@ -712,8 +656,10 @@ export default class ChartTableControl extends TableControl {
712
656
  handleResize: true,
713
657
  colorScheme: this.chartColorScheme,
714
658
  maxSegments: 5,
715
- legend: {
716
- display: false
659
+ plugins: {
660
+ legend: {
661
+ display: false
662
+ }
717
663
  }
718
664
  }
719
665
  };
@@ -832,11 +778,6 @@ export default class ChartTableControl extends TableControl {
832
778
  data.labels = labels;
833
779
  }
834
780
 
835
- // duplicate the dataset for pie charts, this is necessary for datalabels on the segments and outside of the pie chart
836
- if (this.chartType === Chart.Type.PIE) {
837
- data.datasets[1] = $.extend(true, {}, dataset);
838
- }
839
-
840
781
  return data;
841
782
  }
842
783
 
@@ -909,22 +850,30 @@ export default class ChartTableControl extends TableControl {
909
850
  if (this.chartType !== Chart.Type.PIE) {
910
851
  config.options = $.extend(true, {}, config.options, {
911
852
  scales: {
912
- xAxes: [{
853
+ x: {
913
854
  ticks: {
914
- fontFamily: fontFamily
855
+ font: {
856
+ family: fontFamily
857
+ }
915
858
  }
916
- }],
917
- yAxes: [{
859
+ },
860
+ y: {
918
861
  ticks: {
919
- fontFamily: fontFamily
862
+ font: {
863
+ family: fontFamily
864
+ }
920
865
  }
921
- }]
866
+ }
922
867
  }
923
868
  });
924
869
  }
925
870
  config.options = $.extend(true, {}, config.options, {
926
- tooltips: {
927
- titleFontFamily: fontFamily
871
+ plugins: {
872
+ tooltip: {
873
+ titleFont: {
874
+ family: fontFamily
875
+ }
876
+ }
928
877
  }
929
878
  });
930
879
  config.options = $.extend(true, {}, config.options, {
@@ -950,22 +899,22 @@ export default class ChartTableControl extends TableControl {
950
899
  if (!(xAxis.column instanceof NumberColumn)) {
951
900
  config.options = $.extend(true, {}, config.options, {
952
901
  scales: {
953
- xAxes: [{
902
+ x: {
954
903
  ticks: {
955
904
  callback: label => this._formatLabel(label, xAxis)
956
905
  }
957
- }]
906
+ }
958
907
  }
959
908
  });
960
909
  }
961
910
  if (!(yAxis.column instanceof NumberColumn)) {
962
911
  config.options = $.extend(true, {}, config.options, {
963
912
  scales: {
964
- yAxes: [{
913
+ y: {
965
914
  ticks: {
966
915
  callback: label => this._formatLabel(label, yAxis)
967
916
  }
968
- }]
917
+ }
969
918
  }
970
919
  });
971
920
  }
@@ -1044,7 +993,7 @@ export default class ChartTableControl extends TableControl {
1044
993
  return;
1045
994
  }
1046
995
 
1047
- config.bubble = $.extend(true, {}, config.bubble, {
996
+ config.options.bubble = $.extend(true, {}, config.options.bubble, {
1048
997
  sizeOfLargestBubble: 25,
1049
998
  minBubbleSize: 5
1050
999
  });
@@ -1055,19 +1004,22 @@ export default class ChartTableControl extends TableControl {
1055
1004
  return;
1056
1005
  }
1057
1006
 
1058
- // first dataset is hidden but datalabels are displayed outside of the chart
1059
- config.data.datasets[0].weight = 0;
1060
1007
  config.data.datasets[0].datalabels = {
1061
- display: 'auto',
1062
- color: styles.get([this.chartColorScheme, this.chartType + '-chart', 'elements', 'label'], 'fill').fill,
1063
- formatter: (value, context) => {
1064
- return context.chart.data.labels[context.dataIndex];
1065
- },
1066
- anchor: 'end',
1067
- align: 'end',
1068
- clamp: true,
1069
- offset: 10,
1070
- padding: 4
1008
+ labels: {
1009
+ index: {
1010
+ display: 'auto',
1011
+ color: styles.get([this.chartColorScheme, this.chartType + '-chart', 'elements', 'label'], 'fill').fill,
1012
+ formatter: (value, context) => {
1013
+ return context.chart.data.labels[context.dataIndex];
1014
+ },
1015
+ anchor: 'end',
1016
+ align: 'end',
1017
+ clamp: true,
1018
+ offset: 10,
1019
+ padding: 4
1020
+ },
1021
+ labels: {}
1022
+ }
1071
1023
  };
1072
1024
 
1073
1025
  config.options = $.extend(true, {}, config.options, {
@@ -1096,16 +1048,12 @@ export default class ChartTableControl extends TableControl {
1096
1048
 
1097
1049
  config.options = $.extend(true, {}, config.options, {
1098
1050
  scales: {
1099
- xAxes: [{
1100
- ticks: {
1101
- beginAtZero: true
1102
- }
1103
- }],
1104
- yAxes: [{
1105
- ticks: {
1106
- beginAtZero: true
1107
- }
1108
- }]
1051
+ x: {
1052
+ beginAtZero: true
1053
+ },
1054
+ y: {
1055
+ beginAtZero: true
1056
+ }
1109
1057
  }
1110
1058
  });
1111
1059
  }
@@ -1161,9 +1109,7 @@ export default class ChartTableControl extends TableControl {
1161
1109
  let filters = [];
1162
1110
  if (this.chart && this.chart.config.data) {
1163
1111
  let maxSegments = this.chart.config.options.maxSegments,
1164
- // first dataset is hidden on pie charts
1165
- datasetIndex = this.chartType === Chart.Type.PIE ? 1 : 0,
1166
- dataset = this.chart.config.data.datasets[datasetIndex],
1112
+ dataset = this.chart.config.data.datasets[0],
1167
1113
  getFilters = index => ({deterministicKey: dataset.deterministicKeys[index]});
1168
1114
  if (this.chartType === Chart.Type.PIE) {
1169
1115
  getFilters = index => {
@@ -1175,7 +1121,7 @@ export default class ChartTableControl extends TableControl {
1175
1121
  };
1176
1122
  }
1177
1123
 
1178
- let checkedIndices = this.chart.checkedItems.filter(item => item.datasetIndex === datasetIndex)
1124
+ let checkedIndices = this.chart.checkedItems.filter(item => item.datasetIndex === 0)
1179
1125
  .map(item => item.dataIndex);
1180
1126
  checkedIndices.forEach(index => {
1181
1127
  arrays.pushAll(filters, getFilters(index));
@@ -1197,8 +1143,6 @@ export default class ChartTableControl extends TableControl {
1197
1143
  } else {
1198
1144
  this.table.removeFilterByKey(ChartTableUserFilter.TYPE);
1199
1145
  }
1200
-
1201
- this.table.filter();
1202
1146
  }
1203
1147
 
1204
1148
  _axisContentForColumn(column) {
@@ -1246,9 +1190,12 @@ export default class ChartTableControl extends TableControl {
1246
1190
  this.$xAxisSelect.each((index, element) => {
1247
1191
  tooltips.uninstall($(element));
1248
1192
  });
1193
+ scrollbars.uninstall(this.$xAxisSelect, this.session);
1249
1194
  this.$yAxisSelect.each((index, element) => {
1250
1195
  tooltips.uninstall($(element));
1251
1196
  });
1197
+ scrollbars.uninstall(this.$yAxisSelect, this.session);
1198
+ scrollbars.uninstall(this.$dataSelect, this.session);
1252
1199
  this._uninstallScrollbars();
1253
1200
  }
1254
1201