@eclipse-scout/chart 24.2.17 → 25.1.0-beta.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.
- package/README.md +5 -5
- package/dist/d.ts/src/chart/ChartJsRenderer.d.ts +23 -9
- package/dist/d.ts/src/chart/ChartJsRenderer.d.ts.map +1 -1
- package/dist/d.ts/src/index.d.ts +1 -1
- package/dist/d.ts/src/index.d.ts.map +1 -1
- package/dist/eclipse-scout-chart-f2ef4dc34a38fde9cfea.min.js +3 -0
- package/dist/eclipse-scout-chart-f2ef4dc34a38fde9cfea.min.js.map +1 -0
- package/dist/{eclipse-scout-chart-theme-0ccdbef637d0a76afc97.min.css → eclipse-scout-chart-theme-03e8dfdce2c2cd602f40.min.css} +1 -1
- package/dist/{eclipse-scout-chart-theme-dark-7f7bf1d1273a6775ec74.min.css → eclipse-scout-chart-theme-dark-378a537154001198a741.min.css} +1 -1
- package/dist/eclipse-scout-chart-theme-dark.css +53 -5
- package/dist/eclipse-scout-chart-theme-dark.css.map +1 -1
- package/dist/eclipse-scout-chart-theme.css +53 -5
- package/dist/eclipse-scout-chart-theme.css.map +1 -1
- package/dist/eclipse-scout-chart.esm-68ec6b6400b08664057c.min.js +3 -0
- package/dist/eclipse-scout-chart.esm-68ec6b6400b08664057c.min.js.map +1 -0
- package/dist/eclipse-scout-chart.esm.js +181 -96
- package/dist/eclipse-scout-chart.esm.js.map +1 -1
- package/dist/eclipse-scout-chart.js +181 -88
- package/dist/eclipse-scout-chart.js.map +1 -1
- package/dist/file-list +6 -6
- package/package.json +13 -13
- package/src/chart/Chart.less +59 -1
- package/src/chart/ChartJsRenderer.ts +98 -36
- package/src/index.ts +1 -2
- package/src/style/colors.less +13 -1
- package/dist/eclipse-scout-chart-eb8127f41211b904a4d2.min.js +0 -3
- package/dist/eclipse-scout-chart-eb8127f41211b904a4d2.min.js.map +0 -1
- package/dist/eclipse-scout-chart.esm-6dfc38f90757c5fbaa5c.min.js +0 -3
- package/dist/eclipse-scout-chart.esm-6dfc38f90757c5fbaa5c.min.js.map +0 -1
package/dist/file-list
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
eclipse-scout-chart-
|
|
2
|
-
eclipse-scout-chart-
|
|
3
|
-
eclipse-scout-chart-theme-
|
|
4
|
-
eclipse-scout-chart-theme-dark-
|
|
1
|
+
eclipse-scout-chart-f2ef4dc34a38fde9cfea.min.js
|
|
2
|
+
eclipse-scout-chart-f2ef4dc34a38fde9cfea.min.js.map
|
|
3
|
+
eclipse-scout-chart-theme-03e8dfdce2c2cd602f40.min.css
|
|
4
|
+
eclipse-scout-chart-theme-dark-378a537154001198a741.min.css
|
|
5
5
|
eclipse-scout-chart-theme-dark.css
|
|
6
6
|
eclipse-scout-chart-theme-dark.css.map
|
|
7
7
|
eclipse-scout-chart-theme.css
|
|
8
8
|
eclipse-scout-chart-theme.css.map
|
|
9
|
-
eclipse-scout-chart.esm-
|
|
10
|
-
eclipse-scout-chart.esm-
|
|
9
|
+
eclipse-scout-chart.esm-68ec6b6400b08664057c.min.js
|
|
10
|
+
eclipse-scout-chart.esm-68ec6b6400b08664057c.min.js.map
|
|
11
11
|
eclipse-scout-chart.esm.js
|
|
12
12
|
eclipse-scout-chart.esm.js.map
|
|
13
13
|
eclipse-scout-chart.js
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-scout/chart",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.1.0-beta.2",
|
|
4
4
|
"description": "Eclipse Scout chart",
|
|
5
5
|
"author": "BSI Business Systems Integration AG",
|
|
6
|
-
"homepage": "https://
|
|
6
|
+
"homepage": "https://eclipse.dev/scout/",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/eclipse-scout/scout.rt.git"
|
|
10
10
|
},
|
|
11
11
|
"license": "EPL-2.0",
|
|
12
12
|
"engines": {
|
|
13
|
-
"node": ">=
|
|
14
|
-
"npm": ">=10.
|
|
15
|
-
"pnpm": ">=
|
|
13
|
+
"node": ">=22.12.0",
|
|
14
|
+
"npm": ">=10.9.0",
|
|
15
|
+
"pnpm": ">=9.15.0"
|
|
16
16
|
},
|
|
17
17
|
"keywords": [
|
|
18
18
|
"scout",
|
|
@@ -34,19 +34,19 @@
|
|
|
34
34
|
"src"
|
|
35
35
|
],
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@eclipse-scout/cli": "
|
|
38
|
-
"@eclipse-scout/releng": "^
|
|
39
|
-
"jasmine-core": "5.
|
|
37
|
+
"@eclipse-scout/cli": "25.1.0-beta.2",
|
|
38
|
+
"@eclipse-scout/releng": "^25.1.0",
|
|
39
|
+
"jasmine-core": "5.5.0",
|
|
40
40
|
"jasmine-jquery": "2.1.1",
|
|
41
|
-
"karma": "6.4.
|
|
42
|
-
"@types/jquery": "3.5.
|
|
43
|
-
"@types/jasmine": "5.1.
|
|
41
|
+
"karma": "6.4.4",
|
|
42
|
+
"@types/jquery": "3.5.32",
|
|
43
|
+
"@types/jasmine": "5.1.5",
|
|
44
44
|
"@types/jasmine-jquery": "1.5.37"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@eclipse-scout/core": "
|
|
47
|
+
"@eclipse-scout/core": "25.1.0-beta.2",
|
|
48
48
|
"jquery": "3.7.1",
|
|
49
|
-
"chart.js": "4.4.
|
|
49
|
+
"chart.js": "4.4.6",
|
|
50
50
|
"chartjs-plugin-datalabels": "2.2.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
package/src/chart/Chart.less
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c) 2010,
|
|
2
|
+
* Copyright (c) 2010, 2025 BSI Business Systems Integration AG
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made
|
|
5
5
|
* available under the terms of the Eclipse Public License 2.0
|
|
@@ -394,6 +394,7 @@
|
|
|
394
394
|
overflow: hidden;
|
|
395
395
|
|
|
396
396
|
/* use padding area for label, legend */
|
|
397
|
+
|
|
397
398
|
& > .field.chart {
|
|
398
399
|
overflow: visible;
|
|
399
400
|
|
|
@@ -690,6 +691,63 @@ path.speedo-chart-arc, path.pointer {
|
|
|
690
691
|
&.red {
|
|
691
692
|
stroke: @speedo-chart-red;
|
|
692
693
|
}
|
|
694
|
+
|
|
695
|
+
.color-alternative & {
|
|
696
|
+
|
|
697
|
+
&.dark-green {
|
|
698
|
+
stroke: @speedo-chart-dark-green-alternative;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
&.light-green {
|
|
702
|
+
stroke: @speedo-chart-green-alternative;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
&.yellow {
|
|
706
|
+
stroke: @speedo-chart-yellow-alternative;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
&.red {
|
|
710
|
+
stroke: @speedo-chart-red-alternative;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
.inverted & {
|
|
715
|
+
|
|
716
|
+
&.dark-green {
|
|
717
|
+
stroke: @speedo-chart-dark-green-inverted;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
&.light-green {
|
|
721
|
+
stroke: @speedo-chart-green-inverted;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
&.yellow {
|
|
725
|
+
stroke: @speedo-chart-yellow-inverted;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
&.red {
|
|
729
|
+
stroke: @speedo-chart-red-inverted;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
.color-alternative& {
|
|
733
|
+
|
|
734
|
+
&.dark-green {
|
|
735
|
+
stroke: @speedo-chart-dark-green-alternative-inverted;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
&.light-green {
|
|
739
|
+
stroke: @speedo-chart-green-alternative-inverted;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
&.yellow {
|
|
743
|
+
stroke: @speedo-chart-yellow-alternative-inverted;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
&.red {
|
|
747
|
+
stroke: @speedo-chart-red-alternative-inverted;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
}
|
|
693
751
|
}
|
|
694
752
|
|
|
695
753
|
/* --- Salesfunnel --- */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c) 2010,
|
|
2
|
+
* Copyright (c) 2010, 2025 BSI Business Systems Integration AG
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made
|
|
5
5
|
* available under the terms of the Eclipse Public License 2.0
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
import {AbstractChartRenderer, CartesianChartScale, Chart, ChartAxis, ChartColorMode, ChartConfig, ChartData, chartJsDateAdapter, ChartType, ClickObject, NumberFormatter, RadialChartScale} from '../index';
|
|
11
11
|
import {
|
|
12
12
|
_adapters as chartJsAdapters, ActiveElement, ArcElement, BarElement, BubbleDataPoint, CartesianScaleOptions, CategoryScale, Chart as ChartJs, ChartArea, ChartConfiguration, ChartDataset, ChartEvent, ChartType as ChartJsType, Color,
|
|
13
|
-
DefaultDataPoint, FontSpec, LegendElement, LegendItem, LegendOptions, LinearScaleOptions, PointElement, PointHoverOptions, RadialLinearScaleOptions, Scale, ScatterDataPoint, Scriptable, ScriptableContext,
|
|
14
|
-
TooltipLabelStyle, TooltipModel, TooltipOptions
|
|
13
|
+
DefaultDataPoint, FontSpec, LegendElement, LegendItem, LegendOptions, LinearScaleOptions, Point as ChartJsPoint, PointElement, PointHoverOptions, RadialLinearScaleOptions, Scale, ScatterDataPoint, Scriptable, ScriptableContext,
|
|
14
|
+
TooltipCallbacks, TooltipItem, TooltipLabelStyle, TooltipModel, TooltipOptions
|
|
15
15
|
} from 'chart.js';
|
|
16
16
|
import 'chart.js/auto'; // Import from auto to register charts
|
|
17
|
-
import {aria, arrays, colorSchemes, graphics, numbers, objects, Point, scout, strings, styles, Tooltip, tooltips} from '@eclipse-scout/core';
|
|
17
|
+
import {aria, arrays, colorSchemes, graphics, numbers, objects, Point, scout, SomeRequired, strings, styles, Tooltip, tooltips} from '@eclipse-scout/core';
|
|
18
18
|
import ChartDataLabels, {Context} from 'chartjs-plugin-datalabels';
|
|
19
19
|
import $ from 'jquery';
|
|
20
20
|
|
|
@@ -63,6 +63,14 @@ $.extend(true, ChartJs.overrides, {
|
|
|
63
63
|
radius: 3
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
+
},
|
|
67
|
+
bubble: {
|
|
68
|
+
layout: {
|
|
69
|
+
// Enabled auto padding would cause Chart.js to automatically add padding, in the size of the largest bubble
|
|
70
|
+
// (defined by 'sizeOfLargestBubble'), around the chart. This wastes spaces and is not necessary, as we adjust
|
|
71
|
+
// the axes already with the bubble size in mind.
|
|
72
|
+
autoPadding: false
|
|
73
|
+
}
|
|
66
74
|
}
|
|
67
75
|
});
|
|
68
76
|
|
|
@@ -256,7 +264,7 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
256
264
|
config.options.animation.duration = this.animationDuration;
|
|
257
265
|
|
|
258
266
|
this.chartJs = new ChartJs(this.$canvas[0].getContext('2d'), config as ChartConfiguration) as ChartJsChart;
|
|
259
|
-
this._adjustSize(this.chartJs.config, this.chartJs.chartArea);
|
|
267
|
+
this._adjustSize(this.chartJs.config, this.chartJs.chartArea, {isDatasetVisible: i => this.chartJs.getDatasetMeta(i).visible});
|
|
260
268
|
this.refresh();
|
|
261
269
|
}
|
|
262
270
|
|
|
@@ -437,7 +445,7 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
437
445
|
|
|
438
446
|
this.refresh();
|
|
439
447
|
|
|
440
|
-
this._adjustSize(this.chartJs.config, this.chartJs.chartArea);
|
|
448
|
+
this._adjustSize(this.chartJs.config, this.chartJs.chartArea, {isDatasetVisible: i => this.chartJs.getDatasetMeta(i).visible});
|
|
441
449
|
this.refresh();
|
|
442
450
|
}
|
|
443
451
|
|
|
@@ -907,11 +915,11 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
907
915
|
}
|
|
908
916
|
if (objects.isFunction(tooltipLabelValue)) {
|
|
909
917
|
labelValue = tooltipLabelValue(tooltipItem);
|
|
910
|
-
labelValue = objects.isString(labelValue) || objects.
|
|
918
|
+
labelValue = objects.isString(labelValue) || objects.isObject(labelValue) ? labelValue : '';
|
|
911
919
|
}
|
|
912
920
|
if (objects.isFunction(tooltipColor)) {
|
|
913
921
|
labelColor = tooltipColor(tooltipItem);
|
|
914
|
-
labelColor = objects.
|
|
922
|
+
labelColor = objects.isObject(labelColor) ? (labelColor.backgroundColor || '') : '';
|
|
915
923
|
}
|
|
916
924
|
return {label, labelValue, labelColor};
|
|
917
925
|
}
|
|
@@ -1110,7 +1118,7 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
1110
1118
|
value = dataset.data[dataIndex];
|
|
1111
1119
|
|
|
1112
1120
|
if (this._isHorizontalBar(config)) {
|
|
1113
|
-
if (objects.
|
|
1121
|
+
if (objects.isObject(value) && objects.isArray(value.x) && value.x.length === 2) {
|
|
1114
1122
|
let avg = (value.x[0] + value.x[1]) / 2;
|
|
1115
1123
|
tooltipDirection = avg < 0 ? 'left' : 'right';
|
|
1116
1124
|
} else {
|
|
@@ -2348,6 +2356,9 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
2348
2356
|
defaultLegendClick.call(this.chartJs, e, legendItem, legend);
|
|
2349
2357
|
this._onLegendLeave(e, legendItem, legend);
|
|
2350
2358
|
this._onLegendHoverPointer(e, legendItem, legend);
|
|
2359
|
+
|
|
2360
|
+
this._adjustSize(this.chartJs.config, this.chartJs.chartArea, {isDatasetVisible: i => this.chartJs.getDatasetMeta(i).visible});
|
|
2361
|
+
this.refresh();
|
|
2351
2362
|
}
|
|
2352
2363
|
|
|
2353
2364
|
protected _onLegendHover(e: ChartEvent, legendItem: LegendItem, legend: LegendElement<any>) {
|
|
@@ -2486,15 +2497,15 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
2486
2497
|
|
|
2487
2498
|
protected _onResize(chart: ChartJsChart, size: { width: number; height: number }) {
|
|
2488
2499
|
chart.update();
|
|
2489
|
-
this._adjustSize(chart.config, chart.chartArea);
|
|
2500
|
+
this._adjustSize(chart.config, chart.chartArea, {isDatasetVisible: i => chart.getDatasetMeta(i).visible});
|
|
2490
2501
|
}
|
|
2491
2502
|
|
|
2492
|
-
protected _adjustSize(config: ChartConfig, chartArea: ChartArea) {
|
|
2493
|
-
this._adjustBubbleSizes(config, chartArea);
|
|
2494
|
-
this._adjustGridMaxMin(config, chartArea);
|
|
2503
|
+
protected _adjustSize(config: ChartConfig, chartArea: ChartArea, options?: ChartJsRendererAdjustSizeOptions) {
|
|
2504
|
+
this._adjustBubbleSizes(config, chartArea, options);
|
|
2505
|
+
this._adjustGridMaxMin(config, chartArea, options);
|
|
2495
2506
|
}
|
|
2496
2507
|
|
|
2497
|
-
protected _adjustBubbleSizes(config: ChartConfig, chartArea: ChartArea) {
|
|
2508
|
+
protected _adjustBubbleSizes(config: ChartConfig, chartArea: ChartArea, options?: ChartJsRendererAdjustSizeOptions) {
|
|
2498
2509
|
if (config.type !== Chart.Type.BUBBLE) {
|
|
2499
2510
|
return;
|
|
2500
2511
|
}
|
|
@@ -2507,7 +2518,7 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
2507
2518
|
data.r = Math.sqrt(data.z);
|
|
2508
2519
|
}
|
|
2509
2520
|
}));
|
|
2510
|
-
let maxMinR = this._computeMaxMinValue(config, datasets, 'r', true),
|
|
2521
|
+
let maxMinR = this._computeMaxMinValue(config, datasets, {...options, identifier: 'r', exact: true}),
|
|
2511
2522
|
maxR = maxMinR.maxValue,
|
|
2512
2523
|
minR = maxMinR.minValue,
|
|
2513
2524
|
// Compute a scalingFactor and an offset to get the new radius newR = r * scalingFactor + offset.
|
|
@@ -2561,25 +2572,55 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
2561
2572
|
}));
|
|
2562
2573
|
}
|
|
2563
2574
|
|
|
2564
|
-
protected _computeMaxMinValue(config: ChartConfig, datasets: ChartDataset[],
|
|
2575
|
+
protected _computeMaxMinValue(config: ChartConfig, datasets: ChartDataset[], options?: ChartJsRendererComputeMaxMinValueOptions): Boundary {
|
|
2565
2576
|
if (!datasets) {
|
|
2566
2577
|
return;
|
|
2567
2578
|
}
|
|
2568
2579
|
|
|
2580
|
+
const {identifier, exact, boundRange, padding, space} = options || {};
|
|
2581
|
+
const isDatasetVisible = options?.isDatasetVisible || (i => true);
|
|
2582
|
+
|
|
2583
|
+
// do not use 0 as default as the max-min-range might not include 0, e.g. all values are greater than 10.000
|
|
2569
2584
|
let maxValue, minValue;
|
|
2570
2585
|
if (config.type === Chart.Type.SCATTER && identifier === 'r') {
|
|
2571
2586
|
// do not move the grid boundaries because of the radii of the points (would look weird)
|
|
2572
2587
|
maxValue = 0;
|
|
2573
2588
|
minValue = 0;
|
|
2574
2589
|
} else {
|
|
2590
|
+
// check if chart is stacked
|
|
2591
|
+
const sums = [];
|
|
2592
|
+
let calculateSum = false;
|
|
2593
|
+
if (scout.isOneOf(config.type, Chart.Type.LINE, Chart.Type.BAR)) {
|
|
2594
|
+
calculateSum = !!config.options.scales.y.stacked;
|
|
2595
|
+
} else if (config.type === Chart.Type.BAR_HORIZONTAL) {
|
|
2596
|
+
calculateSum = !!config.options.scales.x.stacked;
|
|
2597
|
+
}
|
|
2598
|
+
|
|
2599
|
+
const extractValue = (data: (number | [number, number] | ChartJsPoint | BubbleDataPoint)) => {
|
|
2600
|
+
if (identifier) {
|
|
2601
|
+
return data[identifier];
|
|
2602
|
+
}
|
|
2603
|
+
return data;
|
|
2604
|
+
};
|
|
2605
|
+
|
|
2575
2606
|
for (let i = 0; i < datasets.length; i++) {
|
|
2607
|
+
// do not consider hidden datasets
|
|
2608
|
+
if (!scout.isOneOf(config.type, Chart.Type.PIE, Chart.Type.DOUGHNUT, Chart.Type.POLAR_AREA) && !isDatasetVisible(i)) {
|
|
2609
|
+
continue;
|
|
2610
|
+
}
|
|
2611
|
+
|
|
2576
2612
|
for (let j = 0; j < datasets[i].data.length; j++) {
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2613
|
+
const value = extractValue(datasets[i].data[j]);
|
|
2614
|
+
|
|
2615
|
+
if (calculateSum) {
|
|
2616
|
+
if (!sums[j]) {
|
|
2617
|
+
sums[j] = 0;
|
|
2618
|
+
}
|
|
2619
|
+
sums[j] += value;
|
|
2620
|
+
|
|
2621
|
+
continue;
|
|
2582
2622
|
}
|
|
2623
|
+
|
|
2583
2624
|
if (isNaN(maxValue)) {
|
|
2584
2625
|
maxValue = value;
|
|
2585
2626
|
} else {
|
|
@@ -2592,6 +2633,12 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
2592
2633
|
}
|
|
2593
2634
|
}
|
|
2594
2635
|
}
|
|
2636
|
+
|
|
2637
|
+
// update maxValue/minValue with max/min sum
|
|
2638
|
+
if (calculateSum) {
|
|
2639
|
+
maxValue = Math.max(arrays.max(sums), 0);
|
|
2640
|
+
minValue = Math.min(arrays.min(sums), 0);
|
|
2641
|
+
}
|
|
2595
2642
|
}
|
|
2596
2643
|
|
|
2597
2644
|
if (isNaN(maxValue)) {
|
|
@@ -2668,7 +2715,7 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
2668
2715
|
return value;
|
|
2669
2716
|
}
|
|
2670
2717
|
|
|
2671
|
-
protected _adjustGridMaxMin(config: ChartConfig, chartArea: ChartArea) {
|
|
2718
|
+
protected _adjustGridMaxMin(config: ChartConfig, chartArea: ChartArea, options?: ChartJsRendererAdjustSizeOptions) {
|
|
2672
2719
|
if (!config || !config.type || !config.options || !config.options.adjustGridMaxMin || !config.options.scales || !chartArea) {
|
|
2673
2720
|
return;
|
|
2674
2721
|
}
|
|
@@ -2695,7 +2742,7 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
2695
2742
|
maxXTicks = Math.max(Math.floor(width / minSpaceBetweenXTicks) + 1, 3),
|
|
2696
2743
|
maxYTicks = Math.max(Math.floor(height / minSpaceBetweenYTicks) + 1, 3);
|
|
2697
2744
|
|
|
2698
|
-
let yBoundaries = this._computeYBoundaries(config, height),
|
|
2745
|
+
let yBoundaries = this._computeYBoundaries(config, {...options, space: height}),
|
|
2699
2746
|
yBoundary = yBoundaries.yBoundary,
|
|
2700
2747
|
yBoundaryDiffType = yBoundaries.yBoundaryDiffType;
|
|
2701
2748
|
|
|
@@ -2717,11 +2764,12 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
2717
2764
|
return;
|
|
2718
2765
|
}
|
|
2719
2766
|
|
|
2720
|
-
let xBoundary = this._computeXBoundaryPointElement(config, width);
|
|
2767
|
+
let xBoundary = this._computeXBoundaryPointElement(config, {...options, space: width});
|
|
2721
2768
|
this._adjustAxisMaxMin(xAxis, maxXTicks, xBoundary);
|
|
2722
2769
|
}
|
|
2723
2770
|
|
|
2724
|
-
protected _computeBoundaryPointElement(config: ChartConfig,
|
|
2771
|
+
protected _computeBoundaryPointElement(config: ChartConfig, options: SomeRequired<ChartJsRendererComputeBoundaryWithIdentifierOptions, 'identifier' | 'space'>): Boundary {
|
|
2772
|
+
const {identifier, space} = options;
|
|
2725
2773
|
if (!config || !config.type || !scout.isOneOf(config.type, Chart.Type.BUBBLE, Chart.Type.SCATTER) || !config.data || !config.options || !config.options.scales || !(identifier === 'x' || identifier === 'y') || !space) {
|
|
2726
2774
|
return;
|
|
2727
2775
|
}
|
|
@@ -2732,16 +2780,16 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
2732
2780
|
labelMap = config.options[identifier + 'LabelMap'],
|
|
2733
2781
|
boundary;
|
|
2734
2782
|
|
|
2735
|
-
let maxR = this._computeMaxMinValue(config, datasets, 'r', true).maxValue,
|
|
2783
|
+
let maxR = this._computeMaxMinValue(config, datasets, {...options, identifier: 'r', exact: true, space: null}).maxValue,
|
|
2736
2784
|
padding = maxR;
|
|
2737
2785
|
if (config.options.elements && config.options.elements.point && config.options.elements.point.hoverRadius) {
|
|
2738
2786
|
padding = padding + (config.options.elements.point.hoverRadius as number);
|
|
2739
2787
|
}
|
|
2740
2788
|
|
|
2741
2789
|
if (offset) {
|
|
2742
|
-
boundary = this._computeMaxMinValue(config, datasets,
|
|
2790
|
+
boundary = this._computeMaxMinValue(config, datasets, {...options, exact: !!labelMap, boundRange: true, space: null});
|
|
2743
2791
|
} else {
|
|
2744
|
-
boundary = this._computeMaxMinValue(config, datasets,
|
|
2792
|
+
boundary = this._computeMaxMinValue(config, datasets, {...options, exact: !!labelMap, boundRange: true, padding});
|
|
2745
2793
|
}
|
|
2746
2794
|
if (labelMap) {
|
|
2747
2795
|
boundary.maxValue = Math.ceil(boundary.maxValue);
|
|
@@ -2750,15 +2798,15 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
2750
2798
|
return boundary;
|
|
2751
2799
|
}
|
|
2752
2800
|
|
|
2753
|
-
protected _computeXBoundaryPointElement(config: ChartConfig,
|
|
2754
|
-
return this._computeBoundaryPointElement(config, 'x'
|
|
2801
|
+
protected _computeXBoundaryPointElement(config: ChartConfig, options: SomeRequired<ChartJsRendererComputeBoundaryOptions, 'space'>): Boundary {
|
|
2802
|
+
return this._computeBoundaryPointElement(config, {...options, identifier: 'x'});
|
|
2755
2803
|
}
|
|
2756
2804
|
|
|
2757
|
-
protected _computeYBoundaryPointElement(config: ChartConfig,
|
|
2758
|
-
return this._computeBoundaryPointElement(config, 'y'
|
|
2805
|
+
protected _computeYBoundaryPointElement(config: ChartConfig, options: SomeRequired<ChartJsRendererComputeBoundaryOptions, 'space'>): Boundary {
|
|
2806
|
+
return this._computeBoundaryPointElement(config, {...options, identifier: 'y'});
|
|
2759
2807
|
}
|
|
2760
2808
|
|
|
2761
|
-
protected _computeYBoundaries(config: ChartConfig,
|
|
2809
|
+
protected _computeYBoundaries(config: ChartConfig, options: SomeRequired<ChartJsRendererComputeBoundaryOptions, 'space'>): { yBoundary?: Boundary; yBoundaryDiffType?: Boundary } {
|
|
2762
2810
|
if (!config || !config.type) {
|
|
2763
2811
|
return {};
|
|
2764
2812
|
}
|
|
@@ -2768,7 +2816,7 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
2768
2816
|
yBoundaryDiffType;
|
|
2769
2817
|
|
|
2770
2818
|
if (scout.isOneOf(type, Chart.Type.BUBBLE, Chart.Type.SCATTER)) {
|
|
2771
|
-
yBoundary = this._computeYBoundaryPointElement(config,
|
|
2819
|
+
yBoundary = this._computeYBoundaryPointElement(config, options);
|
|
2772
2820
|
} else {
|
|
2773
2821
|
let datasets = [],
|
|
2774
2822
|
datasetsDiffType = [];
|
|
@@ -2782,10 +2830,10 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
2782
2830
|
});
|
|
2783
2831
|
}
|
|
2784
2832
|
|
|
2785
|
-
yBoundary = this._computeMaxMinValue(config, datasets);
|
|
2833
|
+
yBoundary = this._computeMaxMinValue(config, datasets, {...options, space: null});
|
|
2786
2834
|
|
|
2787
2835
|
if (datasets.length && datasetsDiffType.length) {
|
|
2788
|
-
yBoundaryDiffType = this._computeMaxMinValue(config, datasetsDiffType);
|
|
2836
|
+
yBoundaryDiffType = this._computeMaxMinValue(config, datasetsDiffType, {...options, space: null});
|
|
2789
2837
|
let yBoundaryRange = yBoundary.maxValue - yBoundary.minValue,
|
|
2790
2838
|
yBoundaryRangeDiffType = yBoundaryDiffType.maxValue - yBoundaryDiffType.minValue;
|
|
2791
2839
|
if (yBoundaryRange && yBoundaryRangeDiffType && (yBoundaryRange / yBoundaryRangeDiffType > 10 || yBoundaryRangeDiffType / yBoundaryRange > 10)) {
|
|
@@ -2899,6 +2947,20 @@ export type TooltipLabelGenerator = (tooltipItem: TooltipItem<any>) => string |
|
|
|
2899
2947
|
export type TooltipLabelValueGenerator = (tooltipItem: TooltipItem<any>) => string | { x: string; y: string };
|
|
2900
2948
|
export type TooltipLabelColorGenerator = (tooltipItem: TooltipItem<any>) => TooltipLabelStyle | void;
|
|
2901
2949
|
export type TooltipRenderer = (context: { chart: ChartJs; tooltip: TooltipModel<any> }) => void;
|
|
2950
|
+
export type ChartJsRendererAdjustSizeOptions = {
|
|
2951
|
+
isDatasetVisible?: (number) => boolean;
|
|
2952
|
+
};
|
|
2953
|
+
export type ChartJsRendererComputeBoundaryOptions = ChartJsRendererAdjustSizeOptions & {
|
|
2954
|
+
space?: number;
|
|
2955
|
+
};
|
|
2956
|
+
export type ChartJsRendererComputeBoundaryWithIdentifierOptions = ChartJsRendererComputeBoundaryOptions & {
|
|
2957
|
+
identifier?: string;
|
|
2958
|
+
};
|
|
2959
|
+
export type ChartJsRendererComputeMaxMinValueOptions = ChartJsRendererComputeBoundaryWithIdentifierOptions & {
|
|
2960
|
+
exact?: boolean;
|
|
2961
|
+
boundRange?: boolean;
|
|
2962
|
+
padding?: number;
|
|
2963
|
+
};
|
|
2902
2964
|
|
|
2903
2965
|
export type DatasetColors = {
|
|
2904
2966
|
backgroundColors?: (string | string[])[];
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* SPDX-License-Identifier: EPL-2.0
|
|
9
9
|
*/
|
|
10
10
|
import {ObjectFactory} from '@eclipse-scout/core';
|
|
11
|
+
import * as self from './index';
|
|
11
12
|
|
|
12
13
|
export * from './chart/Chart';
|
|
13
14
|
export * from './chart/ChartAdapter';
|
|
@@ -39,8 +40,6 @@ export * from './table/controls/ChartTableUserFilterModel';
|
|
|
39
40
|
export * from './table/controls/ChartTableControlAdapter';
|
|
40
41
|
export * from './table/controls/ChartTableControlLayout';
|
|
41
42
|
|
|
42
|
-
import * as self from './index';
|
|
43
|
-
|
|
44
43
|
export default self;
|
|
45
44
|
|
|
46
45
|
ObjectFactory.get().registerNamespace('scout', self);
|
package/src/style/colors.less
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c) 2010,
|
|
2
|
+
* Copyright (c) 2010, 2025 BSI Business Systems Integration AG
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made
|
|
5
5
|
* available under the terms of the Eclipse Public License 2.0
|
|
@@ -86,6 +86,18 @@
|
|
|
86
86
|
@speedo-chart-green: @palette-green-3;
|
|
87
87
|
@speedo-chart-yellow: @palette-orange-3;
|
|
88
88
|
@speedo-chart-red: @palette-red-3;
|
|
89
|
+
@speedo-chart-dark-green-alternative: @speedo-chart-dark-green;
|
|
90
|
+
@speedo-chart-green-alternative: @speedo-chart-green;
|
|
91
|
+
@speedo-chart-yellow-alternative: @speedo-chart-yellow;
|
|
92
|
+
@speedo-chart-red-alternative: @speedo-chart-red;
|
|
93
|
+
@speedo-chart-dark-green-inverted: @speedo-chart-dark-green;
|
|
94
|
+
@speedo-chart-green-inverted: @speedo-chart-green;
|
|
95
|
+
@speedo-chart-yellow-inverted: @speedo-chart-yellow;
|
|
96
|
+
@speedo-chart-red-inverted: @speedo-chart-red;
|
|
97
|
+
@speedo-chart-dark-green-alternative-inverted: @speedo-chart-dark-green;
|
|
98
|
+
@speedo-chart-green-alternative-inverted: @speedo-chart-green;
|
|
99
|
+
@speedo-chart-yellow-alternative-inverted: @speedo-chart-yellow;
|
|
100
|
+
@speedo-chart-red-alternative-inverted: @speedo-chart-red;
|
|
89
101
|
@salesfunnel-bar-label-color: @palette-white;
|
|
90
102
|
@salesfunnel-alternative-bar-label-color: @salesfunnel-bar-label-color;
|
|
91
103
|
@salesfunnel-inverted-bar-label-color: @tile-default-inverted-background-color;
|