@eclipse-scout/chart 24.1.6 → 24.1.12
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/dist/d.ts/chart/Chart.d.ts +62 -51
- package/dist/d.ts/chart/Chart.d.ts.map +1 -1
- package/dist/d.ts/chart/ChartJsRenderer.d.ts +12 -7
- package/dist/d.ts/chart/ChartJsRenderer.d.ts.map +1 -1
- package/dist/eclipse-scout-chart-3ba6b8f30d5806cac8ae.min.js.map +1 -1
- package/dist/eclipse-scout-chart-theme-dark.css.map +1 -1
- package/dist/eclipse-scout-chart.esm-8d9db200429e545abcae.min.js.map +1 -1
- package/dist/eclipse-scout-chart.esm.js.map +1 -1
- package/dist/eclipse-scout-chart.js.map +1 -1
- package/package.json +3 -3
- package/src/chart/Chart.ts +67 -51
- package/src/chart/ChartJsRenderer.ts +14 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-scout/chart",
|
|
3
|
-
"version": "24.1.
|
|
3
|
+
"version": "24.1.12",
|
|
4
4
|
"description": "Eclipse Scout chart",
|
|
5
5
|
"author": "BSI Business Systems Integration AG",
|
|
6
6
|
"homepage": "https://www.eclipse.org/scout",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"src"
|
|
27
27
|
],
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@eclipse-scout/cli": "24.1.
|
|
29
|
+
"@eclipse-scout/cli": "24.1.12",
|
|
30
30
|
"@eclipse-scout/releng": "^24.1.0",
|
|
31
31
|
"jasmine-core": "5.1.1",
|
|
32
32
|
"jasmine-jquery": "2.1.1",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@types/jasmine-jquery": "1.5.37"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@eclipse-scout/core": "24.1.
|
|
39
|
+
"@eclipse-scout/core": "24.1.12",
|
|
40
40
|
"jquery": "3.7.1",
|
|
41
41
|
"chart.js": "4.4.0",
|
|
42
42
|
"chartjs-plugin-datalabels": "2.2.0"
|
package/src/chart/Chart.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import {AbstractChartRenderer, ChartEventMap, ChartJsRenderer, ChartLayout, ChartModel, FulfillmentChartRenderer, SalesfunnelChartRenderer, SpeedoChartRenderer, VennChartRenderer} from '../index';
|
|
11
11
|
import {aria, arrays, ColorScheme, colorSchemes, EnumObject, HtmlComponent, InitModelOf, objects, Widget} from '@eclipse-scout/core';
|
|
12
12
|
import {GreenAreaPosition} from './SpeedoChartRenderer';
|
|
13
|
-
import {ChartConfiguration, LinearScaleOptions, RadialLinearScaleOptions} from 'chart.js';
|
|
13
|
+
import {CategoryScaleOptions, ChartConfiguration, ChartOptions, LinearScaleOptions, LogarithmicScaleOptions, RadialLinearScaleOptions, ScaleType, TimeScaleOptions as ChartJsTimeScaleOptions} from 'chart.js';
|
|
14
14
|
import $ from 'jquery';
|
|
15
15
|
|
|
16
16
|
export class Chart extends Widget implements ChartModel {
|
|
@@ -414,60 +414,72 @@ export type ChartValueGroup = {
|
|
|
414
414
|
cssClass?: string;
|
|
415
415
|
};
|
|
416
416
|
|
|
417
|
-
export type ChartConfig = Partial<Omit<ChartConfiguration, 'type'>> & {
|
|
417
|
+
export type ChartConfig = Partial<Omit<ChartConfiguration, 'type' | 'options'>> & {
|
|
418
418
|
type: ChartType;
|
|
419
|
-
options?:
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
plugins?: {
|
|
465
|
-
legend?: {
|
|
466
|
-
clickable?: boolean;
|
|
467
|
-
};
|
|
419
|
+
options?: ChartConfigOptions;
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
export type ChartConfigOptions = Omit<ChartOptions, 'scales'> & {
|
|
423
|
+
autoColor?: boolean;
|
|
424
|
+
colorScheme?: ColorScheme | string;
|
|
425
|
+
transparent?: boolean;
|
|
426
|
+
maxSegments?: number;
|
|
427
|
+
otherSegmentClickable?: boolean;
|
|
428
|
+
adjustGridMaxMin?: boolean;
|
|
429
|
+
clickable?: boolean;
|
|
430
|
+
checkable?: boolean;
|
|
431
|
+
scaleLabelByTypeMap?: Record<ChartType, Record<string, string>>;
|
|
432
|
+
numberFormatter?: NumberFormatter;
|
|
433
|
+
reformatLabels?: boolean;
|
|
434
|
+
handleResize?: boolean;
|
|
435
|
+
animation?: {
|
|
436
|
+
duration?: number;
|
|
437
|
+
};
|
|
438
|
+
scales?: {
|
|
439
|
+
x?: CartesianChartScale;
|
|
440
|
+
y?: CartesianChartScale;
|
|
441
|
+
yDiffType?: CartesianChartScale;
|
|
442
|
+
r?: RadialChartScale;
|
|
443
|
+
};
|
|
444
|
+
bubble?: {
|
|
445
|
+
sizeOfLargestBubble?: number;
|
|
446
|
+
minBubbleSize?: number;
|
|
447
|
+
};
|
|
448
|
+
fulfillment?: {
|
|
449
|
+
startValue?: number;
|
|
450
|
+
};
|
|
451
|
+
salesfunnel?: {
|
|
452
|
+
normalized?: boolean;
|
|
453
|
+
calcConversionRate?: boolean;
|
|
454
|
+
};
|
|
455
|
+
speedo?: {
|
|
456
|
+
greenAreaPosition?: GreenAreaPosition;
|
|
457
|
+
};
|
|
458
|
+
venn?: {
|
|
459
|
+
numberOfCircles?: 1 | 2 | 3;
|
|
460
|
+
};
|
|
461
|
+
plugins?: {
|
|
462
|
+
legend?: {
|
|
463
|
+
clickable?: boolean;
|
|
468
464
|
};
|
|
469
465
|
};
|
|
470
466
|
};
|
|
467
|
+
|
|
468
|
+
export type RadialChartScale = DeepPartial<RadialLinearScaleOptions> & {
|
|
469
|
+
type?: ScaleType;
|
|
470
|
+
minSpaceBetweenTicks?: number;
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
export type CartesianChartScale = DeepPartial<LinearScaleOptions | CategoryScaleOptions | TimeScaleOptions | LogarithmicScaleOptions> & {
|
|
474
|
+
type?: ScaleType;
|
|
475
|
+
minSpaceBetweenTicks?: number;
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
export type TimeScaleOptions = Omit<ChartJsTimeScaleOptions, 'min' | 'max'> & {
|
|
479
|
+
min?: string | number | Date | (() => string | number | Date);
|
|
480
|
+
max?: string | number | Date | (() => string | number | Date);
|
|
481
|
+
};
|
|
482
|
+
|
|
471
483
|
export type ChartType = EnumObject<typeof Chart.Type>;
|
|
472
484
|
export type ChartPosition = EnumObject<typeof Chart.Position>;
|
|
473
485
|
export type NumberFormatter = (label: number | string, defaultFormatter: (label: number | string) => string) => string;
|
|
@@ -498,3 +510,7 @@ export type UpdateChartOptions = {
|
|
|
498
510
|
onlyRefresh?: boolean;
|
|
499
511
|
enforceRerender?: boolean;
|
|
500
512
|
};
|
|
513
|
+
|
|
514
|
+
type DeepPartial<T> = T extends object ? {
|
|
515
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
516
|
+
} : T;
|
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
*
|
|
8
8
|
* SPDX-License-Identifier: EPL-2.0
|
|
9
9
|
*/
|
|
10
|
-
import {AbstractChartRenderer, Chart, chartJsDateAdapter} from '../index';
|
|
10
|
+
import {AbstractChartRenderer, CartesianChartScale, Chart, chartJsDateAdapter, RadialChartScale} from '../index';
|
|
11
11
|
import {
|
|
12
12
|
_adapters as chartJsAdapters, ActiveElement, ArcElement, BarElement, BubbleDataPoint, CartesianScaleOptions, Chart as ChartJs, ChartArea, ChartConfiguration, ChartDataset, ChartEvent, ChartType as ChartJsType, Color, DefaultDataPoint,
|
|
13
|
-
FontSpec, LegendElement, LegendItem, LegendOptions, LinearScaleOptions, PointElement, PointHoverOptions, RadialLinearScaleOptions, Scale, ScatterDataPoint, TooltipCallbacks, TooltipItem, TooltipLabelStyle,
|
|
13
|
+
FontSpec, LegendElement, LegendItem, LegendOptions, LinearScaleOptions, PointElement, PointHoverOptions, RadialLinearScaleOptions, Scale, ScatterDataPoint, Scriptable, ScriptableContext, TooltipCallbacks, TooltipItem, TooltipLabelStyle,
|
|
14
|
+
TooltipModel, TooltipOptions
|
|
14
15
|
} from 'chart.js';
|
|
15
16
|
import 'chart.js/auto'; // Import from auto to register charts
|
|
16
17
|
import {aria, arrays, colorSchemes, graphics, numbers, objects, Point, scout, strings, styles, Tooltip, tooltips} from '@eclipse-scout/core';
|
|
@@ -2802,7 +2803,7 @@ export class ChartJsRenderer extends AbstractChartRenderer {
|
|
|
2802
2803
|
});
|
|
2803
2804
|
}
|
|
2804
2805
|
|
|
2805
|
-
protected _adjustAxisMaxMin(axis:
|
|
2806
|
+
protected _adjustAxisMaxMin(axis: AxisWithMaxMin, maxTicks: number, maxMinValue: Boundary) {
|
|
2806
2807
|
if (!axis) {
|
|
2807
2808
|
return;
|
|
2808
2809
|
}
|
|
@@ -2865,6 +2866,12 @@ export type DatasetColors = {
|
|
|
2865
2866
|
|
|
2866
2867
|
export type Boundary = { maxValue: number; minValue: number };
|
|
2867
2868
|
|
|
2869
|
+
export type AxisWithMaxMin = (CartesianChartScale | RadialChartScale) & {
|
|
2870
|
+
ticks?: (CartesianChartScale | RadialChartScale)['ticks'] & {
|
|
2871
|
+
stepSize?: number;
|
|
2872
|
+
};
|
|
2873
|
+
};
|
|
2874
|
+
|
|
2868
2875
|
// extend chart.js
|
|
2869
2876
|
|
|
2870
2877
|
export type ChartJsChart = Omit<ChartJs, 'config'> & {
|
|
@@ -2881,10 +2888,10 @@ declare module 'chart.js' {
|
|
|
2881
2888
|
datasetId?: string;
|
|
2882
2889
|
yAxisID?: 'y' | 'yDiffType';
|
|
2883
2890
|
|
|
2884
|
-
pointBackgroundColor?: Color
|
|
2885
|
-
pointHoverBackgroundColor?: Color
|
|
2886
|
-
pointRadius?: number
|
|
2887
|
-
legendColor?: Color
|
|
2891
|
+
pointBackgroundColor?: Scriptable<Color, ScriptableContext<TType>>;
|
|
2892
|
+
pointHoverBackgroundColor?: Scriptable<Color, ScriptableContext<TType>>;
|
|
2893
|
+
pointRadius?: Scriptable<number, ScriptableContext<TType>>;
|
|
2894
|
+
legendColor?: Scriptable<Color, number>;
|
|
2888
2895
|
|
|
2889
2896
|
checkedBackgroundColor?: Color;
|
|
2890
2897
|
checkedHoverBackgroundColor?: Color;
|