mdt-charts 1.29.0 → 1.30.0
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/lib/config/config.d.ts +170 -178
- package/lib/designer/designerConfig.d.ts +59 -62
- package/lib/engine/block/block.d.ts +16 -22
- package/lib/engine/block/block.js +51 -51
- package/lib/engine/block/blockHelper.d.ts +6 -6
- package/lib/engine/block/blockHelper.js +16 -16
- package/lib/engine/block/blockHtml.d.ts +8 -8
- package/lib/engine/block/blockHtml.js +15 -15
- package/lib/engine/block/blockSvg.d.ts +20 -20
- package/lib/engine/block/blockSvg.js +66 -65
- package/lib/engine/block/defs/LinearGradientDef.d.ts +2 -2
- package/lib/engine/block/defs/LinearGradientDef.js +27 -27
- package/lib/engine/block/defs/hatchPattern.d.ts +4 -4
- package/lib/engine/block/defs/hatchPattern.js +9 -9
- package/lib/engine/colorReader/colorReader.d.ts +5 -5
- package/lib/engine/colorReader/colorReader.js +18 -18
- package/lib/engine/contentManager/contentManager.d.ts +7 -6
- package/lib/engine/contentManager/contentManager.js +15 -15
- package/lib/engine/contentManager/contentManagerFactory.d.ts +7 -7
- package/lib/engine/contentManager/contentManagerFactory.js +12 -12
- package/lib/engine/elementHighlighter/elementHighlighter.d.ts +22 -70
- package/lib/engine/elementHighlighter/elementHighlighter.js +181 -230
- package/lib/engine/elementHighlighter/selectHighlighter.d.ts +4 -29
- package/lib/engine/elementHighlighter/selectHighlighter.js +87 -189
- package/lib/engine/engine.d.ts +17 -17
- package/lib/engine/engine.js +62 -87
- package/lib/engine/features/aggregator/aggregator.d.ts +17 -24
- package/lib/engine/features/aggregator/aggregator.js +102 -113
- package/lib/engine/features/axis/axis.d.ts +9 -22
- package/lib/engine/features/axis/axis.js +150 -159
- package/lib/engine/features/axis/axisDomHelper.d.ts +2 -7
- package/lib/engine/features/axis/axisDomHelper.js +20 -19
- package/lib/engine/features/axis/axisHelper.d.ts +5 -9
- package/lib/engine/features/axis/axisHelper.js +33 -28
- package/lib/engine/features/axis/axisLabelDomHelper.d.ts +11 -26
- package/lib/engine/features/axis/axisLabelDomHelper.js +152 -156
- package/lib/engine/features/axis/axisLabelsEventManager.d.ts +2 -2
- package/lib/engine/features/axis/axisLabelsEventManager.js +32 -32
- package/lib/engine/features/embeddedLabels/embeddedLabels.d.ts +16 -51
- package/lib/engine/features/embeddedLabels/embeddedLabels.js +134 -234
- package/lib/engine/features/embeddedLabels/embeddedLabelsDomHelper.d.ts +2 -13
- package/lib/engine/features/embeddedLabels/embeddedLabelsDomHelper.js +23 -20
- package/lib/engine/features/embeddedLabels/embeddedLabelsHelper.d.ts +15 -32
- package/lib/engine/features/embeddedLabels/embeddedLabelsHelper.js +63 -56
- package/lib/engine/features/gridLine/gidLineHelper.d.ts +7 -13
- package/lib/engine/features/gridLine/gidLineHelper.js +49 -42
- package/lib/engine/features/gridLine/gridLine.d.ts +5 -19
- package/lib/engine/features/gridLine/gridLine.js +36 -35
- package/lib/engine/features/legend/legend.d.ts +28 -38
- package/lib/engine/features/legend/legend.js +92 -118
- package/lib/engine/features/legend/legendDomHelper.d.ts +6 -13
- package/lib/engine/features/legend/legendDomHelper.js +62 -63
- package/lib/engine/features/legend/legendEventsManager.d.ts +8 -13
- package/lib/engine/features/legend/legendEventsManager.js +47 -48
- package/lib/engine/features/legend/legendHelper.d.ts +14 -39
- package/lib/engine/features/legend/legendHelper.js +92 -98
- package/lib/engine/features/legend/legendHelperService.d.ts +6 -13
- package/lib/engine/features/legend/legendHelperService.js +25 -24
- package/lib/engine/features/legend/legendMarkerCreator.d.ts +9 -18
- package/lib/engine/features/legend/legendMarkerCreator.js +76 -79
- package/lib/engine/features/legend/legendWidthCalculator.d.ts +7 -7
- package/lib/engine/features/legend/legendWidthCalculator.js +122 -126
- package/lib/engine/features/markDots/markDot.d.ts +15 -42
- package/lib/engine/features/markDots/markDot.js +70 -101
- package/lib/engine/features/markDots/markDotsHelper.d.ts +1 -8
- package/lib/engine/features/markDots/markDotsHelper.js +12 -13
- package/lib/engine/features/recordOverflowAlert/recordOverflowAlertCore.d.ts +5 -23
- package/lib/engine/features/recordOverflowAlert/recordOverflowAlertCore.js +34 -42
- package/lib/engine/features/scale/scale.d.ts +12 -17
- package/lib/engine/features/scale/scale.js +69 -76
- package/lib/engine/features/tipBox/tipBox.d.ts +5 -9
- package/lib/engine/features/tipBox/tipBox.js +24 -24
- package/lib/engine/features/tipBox/tipBoxHelper.d.ts +9 -16
- package/lib/engine/features/tipBox/tipBoxHelper.js +45 -60
- package/lib/engine/features/title/title.d.ts +6 -6
- package/lib/engine/features/title/title.js +35 -34
- package/lib/engine/features/tolltip/newTooltip/newTooltip.d.ts +11 -15
- package/lib/engine/features/tolltip/newTooltip/newTooltip.js +21 -21
- package/lib/engine/features/tolltip/newTooltip/newTooltipService.d.ts +8 -13
- package/lib/engine/features/tolltip/newTooltip/newTooltipService.js +23 -26
- package/lib/engine/features/tolltip/tooltip.d.ts +11 -17
- package/lib/engine/features/tolltip/tooltip.js +142 -296
- package/lib/engine/features/tolltip/tooltipComponentsManager.d.ts +10 -21
- package/lib/engine/features/tolltip/tooltipComponentsManager.js +114 -113
- package/lib/engine/features/tolltip/tooltipDomHelper.d.ts +21 -43
- package/lib/engine/features/tolltip/tooltipDomHelper.js +120 -144
- package/lib/engine/features/tolltip/tooltipHelper.d.ts +9 -39
- package/lib/engine/features/tolltip/tooltipHelper.js +91 -114
- package/lib/engine/features/valueLabels/valueLabels.d.ts +38 -58
- package/lib/engine/features/valueLabels/valueLabels.js +170 -205
- package/lib/engine/features/valueLabels/valueLabelsHelper.d.ts +1 -7
- package/lib/engine/features/valueLabels/valueLabelsHelper.js +18 -23
- package/lib/engine/features/valueLabelsCollision/valueLabelsCollision.d.ts +15 -18
- package/lib/engine/features/valueLabelsCollision/valueLabelsCollision.js +47 -46
- package/lib/engine/features/valueLabelsCollision/valueLabelsCollisionHelper.d.ts +3 -6
- package/lib/engine/features/valueLabelsCollision/valueLabelsCollisionHelper.js +45 -49
- package/lib/engine/filterManager/filterEventManager.d.ts +30 -37
- package/lib/engine/filterManager/filterEventManager.js +131 -174
- package/lib/engine/helpers/domHelper.d.ts +20 -45
- package/lib/engine/helpers/domHelper.js +61 -62
- package/lib/engine/helpers/fontResizer/fontResizer.d.ts +10 -10
- package/lib/engine/helpers/fontResizer/fontResizer.js +16 -21
- package/lib/engine/helpers/fontResizer/fontResizerService.d.ts +1 -1
- package/lib/engine/helpers/fontResizer/fontResizerService.js +10 -9
- package/lib/engine/helpers/helper.d.ts +27 -27
- package/lib/engine/helpers/helper.js +92 -91
- package/lib/engine/helpers/namesHelper.d.ts +3 -3
- package/lib/engine/helpers/namesHelper.js +6 -6
- package/lib/engine/helpers/pipeline/Pipeline.d.ts +5 -5
- package/lib/engine/helpers/pipeline/Pipeline.js +33 -33
- package/lib/engine/polarNotation/donut/DonutHelper.d.ts +11 -25
- package/lib/engine/polarNotation/donut/DonutHelper.js +70 -71
- package/lib/engine/polarNotation/donut/donut.d.ts +23 -38
- package/lib/engine/polarNotation/donut/donut.js +99 -109
- package/lib/engine/polarNotation/polarManager.d.ts +6 -6
- package/lib/engine/polarNotation/polarManager.js +47 -67
- package/lib/engine/transitionManager.d.ts +14 -13
- package/lib/engine/transitionManager.js +49 -48
- package/lib/engine/twoDimensionalNotation/area/area.d.ts +28 -44
- package/lib/engine/twoDimensionalNotation/area/area.js +238 -272
- package/lib/engine/twoDimensionalNotation/area/areaGenerator.d.ts +5 -13
- package/lib/engine/twoDimensionalNotation/area/areaGenerator.js +13 -13
- package/lib/engine/twoDimensionalNotation/area/areaHelper.d.ts +4 -4
- package/lib/engine/twoDimensionalNotation/area/areaHelper.js +41 -57
- package/lib/engine/twoDimensionalNotation/bar/bar.d.ts +29 -54
- package/lib/engine/twoDimensionalNotation/bar/bar.js +224 -362
- package/lib/engine/twoDimensionalNotation/bar/barHelper.d.ts +32 -71
- package/lib/engine/twoDimensionalNotation/bar/barHelper.js +126 -162
- package/lib/engine/twoDimensionalNotation/bar/stackedData/dataStacker.d.ts +6 -6
- package/lib/engine/twoDimensionalNotation/bar/stackedData/dataStacker.js +24 -24
- package/lib/engine/twoDimensionalNotation/bar/stackedData/dataStackerService.d.ts +2 -2
- package/lib/engine/twoDimensionalNotation/bar/stackedData/dataStackerService.js +17 -16
- package/lib/engine/twoDimensionalNotation/dot/dotChart.d.ts +23 -23
- package/lib/engine/twoDimensionalNotation/dot/dotChart.js +114 -135
- package/lib/engine/twoDimensionalNotation/line/line.d.ts +16 -37
- package/lib/engine/twoDimensionalNotation/line/line.js +132 -162
- package/lib/engine/twoDimensionalNotation/line/lineBuilder.d.ts +11 -14
- package/lib/engine/twoDimensionalNotation/line/lineBuilder.js +48 -47
- package/lib/engine/twoDimensionalNotation/line/lineGenerator.d.ts +4 -4
- package/lib/engine/twoDimensionalNotation/line/lineGenerator.js +8 -8
- package/lib/engine/twoDimensionalNotation/line/lineHelper.d.ts +6 -12
- package/lib/engine/twoDimensionalNotation/line/lineHelper.js +60 -76
- package/lib/engine/twoDimensionalNotation/lineLike/generatorFactory/lineLikeGeneratorFactory.d.ts +6 -6
- package/lib/engine/twoDimensionalNotation/lineLike/generatorMiddleware/lineLikeGeneratorCurveMiddleware.d.ts +5 -5
- package/lib/engine/twoDimensionalNotation/lineLike/generatorMiddleware/lineLikeGeneratorCurveMiddleware.js +17 -16
- package/lib/engine/twoDimensionalNotation/lineLike/generatorMiddleware/lineLikeGeneratorDefineMiddleware.d.ts +10 -11
- package/lib/engine/twoDimensionalNotation/lineLike/generatorMiddleware/lineLikeGeneratorDefineMiddleware.js +7 -9
- package/lib/engine/twoDimensionalNotation/lineLike/generatorMiddleware/lineLikeGeneratorMiddleware.d.ts +1 -3
- package/lib/engine/twoDimensionalNotation/twoDimensionalManager.d.ts +10 -10
- package/lib/engine/twoDimensionalNotation/twoDimensionalManager.js +138 -253
- package/lib/engine/valueFormatter.d.ts +3 -3
- package/lib/engine/valueFormatter.js +6 -6
- package/lib/main.d.ts +79 -82
- package/lib/main.js +84 -79
- package/lib/model/EventEmitter.d.ts +8 -8
- package/lib/model/EventEmitter.js +24 -24
- package/lib/model/chartStyleModel/chartStyleModel.d.ts +5 -5
- package/lib/model/chartStyleModel/chartStyleModel.js +25 -27
- package/lib/model/chartStyleModel/colorRange.d.ts +3 -3
- package/lib/model/chartStyleModel/colorRange.js +24 -19
- package/lib/model/chartStyleModel/twoDimensionalChartStyleModel.d.ts +12 -22
- package/lib/model/chartStyleModel/twoDimensionalChartStyleModel.js +60 -69
- package/lib/model/configsValidator/configValidator.d.ts +1 -1
- package/lib/model/configsValidator/configValidator.js +4 -4
- package/lib/model/dataManagerModel/dataManagerModel.d.ts +26 -36
- package/lib/model/dataManagerModel/dataManagerModel.js +128 -179
- package/lib/model/dataManagerModel/dataManagerModelService.d.ts +2 -2
- package/lib/model/dataManagerModel/dataManagerModelService.js +26 -25
- package/lib/model/featuresModel/axisModel.d.ts +18 -69
- package/lib/model/featuresModel/axisModel.js +169 -224
- package/lib/model/featuresModel/axisModelService.d.ts +6 -10
- package/lib/model/featuresModel/axisModelService.js +27 -27
- package/lib/model/featuresModel/legendModel/legendCanvasModel.d.ts +11 -16
- package/lib/model/featuresModel/legendModel/legendCanvasModel.js +59 -55
- package/lib/model/featuresModel/legendModel/legendModel.d.ts +3 -7
- package/lib/model/featuresModel/legendModel/legendModel.js +41 -59
- package/lib/model/featuresModel/legendModel/polarMarginCalculator.d.ts +3 -8
- package/lib/model/featuresModel/legendModel/polarMarginCalculator.js +20 -18
- package/lib/model/featuresModel/legendModel/twoDimLegendModel.d.ts +4 -8
- package/lib/model/featuresModel/legendModel/twoDimLegendModel.js +27 -40
- package/lib/model/featuresModel/otherComponents.d.ts +4 -7
- package/lib/model/featuresModel/otherComponents.js +9 -9
- package/lib/model/featuresModel/recordOverflowModel/recordOverflowModel.d.ts +4 -0
- package/lib/model/featuresModel/recordOverflowModel/recordOverflowModel.js +33 -0
- package/lib/model/featuresModel/scaleModel/scaleAxisRecalcer.d.ts +6 -6
- package/lib/model/featuresModel/scaleModel/scaleAxisRecalcer.js +23 -27
- package/lib/model/featuresModel/scaleModel/scaleDomainService.d.ts +5 -19
- package/lib/model/featuresModel/scaleModel/scaleDomainService.js +55 -44
- package/lib/model/featuresModel/scaleModel/scaleModel.d.ts +10 -10
- package/lib/model/featuresModel/scaleModel/scaleModel.js +50 -61
- package/lib/model/featuresModel/scaleModel/scaleModelServices.js +22 -15
- package/lib/model/featuresModel/titleModel.d.ts +1 -1
- package/lib/model/featuresModel/titleModel.js +14 -14
- package/lib/model/featuresModel/tooltipModel.d.ts +1 -1
- package/lib/model/featuresModel/tooltipModel.js +5 -5
- package/lib/model/featuresModel/valueLabelsModel/valueLabelsModel.d.ts +11 -23
- package/lib/model/featuresModel/valueLabelsModel/valueLabelsModel.js +51 -53
- package/lib/model/helpers/modelHelper.d.ts +7 -7
- package/lib/model/helpers/modelHelper.js +42 -38
- package/lib/model/helpers/twoDimensionalModelHelper.d.ts +9 -37
- package/lib/model/helpers/twoDimensionalModelHelper.js +125 -147
- package/lib/model/helpers/unitsFromConfigReader.js +4 -4
- package/lib/model/helpers/unitsReader.d.ts +2 -2
- package/lib/model/helpers/unitsReader.js +13 -11
- package/lib/model/margin/marginModel.d.ts +7 -7
- package/lib/model/margin/marginModel.js +20 -23
- package/lib/model/margin/twoDim/twoDimMarginModel.d.ts +13 -13
- package/lib/model/margin/twoDim/twoDimMarginModel.js +113 -184
- package/lib/model/model.d.ts +281 -315
- package/lib/model/model.js +4 -4
- package/lib/model/modelBuilder.d.ts +18 -27
- package/lib/model/modelBuilder.js +79 -85
- package/lib/model/modelInstance/canvasModel/canvasModel.d.ts +17 -17
- package/lib/model/modelInstance/canvasModel/canvasModel.js +43 -42
- package/lib/model/modelInstance/canvasModel/canvasSizesModel/canvasMarginModel.d.ts +7 -7
- package/lib/model/modelInstance/canvasModel/canvasSizesModel/canvasSizeModel.d.ts +2 -2
- package/lib/model/modelInstance/canvasModel/canvasSizesModel/marginModelService.d.ts +6 -6
- package/lib/model/modelInstance/canvasModel/canvasSizesModel/marginModelService.js +24 -24
- package/lib/model/modelInstance/canvasModel/legendCanvasModel.d.ts +4 -4
- package/lib/model/modelInstance/canvasModel/legendCanvasModel.js +11 -11
- package/lib/model/modelInstance/canvasModel/titleCanvas.d.ts +4 -4
- package/lib/model/modelInstance/canvasModel/titleCanvas.js +9 -9
- package/lib/model/modelInstance/chartBlockVersion/chartBlockVersion.d.ts +3 -3
- package/lib/model/modelInstance/chartBlockVersion/chartBlockVersion.js +6 -6
- package/lib/model/modelInstance/configReader.d.ts +23 -32
- package/lib/model/modelInstance/configReader.js +94 -125
- package/lib/model/modelInstance/dataModel/dataModel.d.ts +10 -10
- package/lib/model/modelInstance/dataModel/dataModel.js +25 -25
- package/lib/model/modelInstance/dataModel/dataRepository.d.ts +14 -14
- package/lib/model/modelInstance/dataModel/dataRepository.js +42 -42
- package/lib/model/modelInstance/modelInstance.d.ts +6 -11
- package/lib/model/modelInstance/modelInstance.js +16 -16
- package/lib/model/modelInstance/titleConfigReader.d.ts +8 -8
- package/lib/model/modelInstance/titleConfigReader.js +30 -37
- package/lib/model/notations/polar/donut/donutAggregatorService.d.ts +6 -9
- package/lib/model/notations/polar/donut/donutAggregatorService.js +37 -40
- package/lib/model/notations/polar/donut/donutModel.d.ts +5 -9
- package/lib/model/notations/polar/donut/donutModel.js +28 -28
- package/lib/model/notations/polar/donut/donutThicknessService.d.ts +3 -3
- package/lib/model/notations/polar/donut/donutThicknessService.js +15 -13
- package/lib/model/notations/polar/polarModel.d.ts +7 -18
- package/lib/model/notations/polar/polarModel.js +72 -79
- package/lib/model/notations/twoDimensional/styles.d.ts +7 -44
- package/lib/model/notations/twoDimensional/styles.js +125 -234
- package/lib/model/notations/twoDimensionalModel.d.ts +13 -23
- package/lib/model/notations/twoDimensionalModel.js +170 -330
- package/lib/optionsServices/publicOptionsService.d.ts +1 -1
- package/lib/optionsServices/publicOptionsService.js +4 -4
- package/lib/optionsServices/validators/sizeValidator.d.ts +2 -2
- package/lib/optionsServices/validators/sizeValidator.js +11 -10
- package/lib/style/charts-main.css +151 -150
- package/lib/style/charts-main.less +151 -150
- package/package.json +5 -5
- package/lib/engine/polarNotation/extenders/polarRecordOverflowAlert.d.ts +0 -15
- package/lib/engine/polarNotation/extenders/polarRecordOverflowAlert.js +0 -40
- package/lib/engine/twoDimensionalNotation/extenders/twoDimRecordOverflowAlert.d.ts +0 -15
- package/lib/engine/twoDimensionalNotation/extenders/twoDimRecordOverflowAlert.js +0 -32
package/lib/main.js
CHANGED
|
@@ -2,85 +2,90 @@ import { Engine } from "./engine/engine";
|
|
|
2
2
|
import { assembleModel, getPreparedData } from "./model/modelBuilder";
|
|
3
3
|
import { PublicOptionsService } from "./optionsServices/publicOptionsService";
|
|
4
4
|
export class Chart {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @param config Объект конфигуратора
|
|
7
|
+
* @param designerConfig Объект конфигуратора дизайнера
|
|
8
|
+
* @param data Данные
|
|
9
|
+
* @param isResizable Флаг подстройки размера блока графика под родительский элемент
|
|
10
|
+
* @param filterCallback Функция коллбэк, вызываемая во время клика на элемент графика. Предназначена для обеспечения кросс-фильтрации
|
|
11
|
+
* @param selectedIds Id выделенных записей
|
|
12
|
+
*/
|
|
13
|
+
constructor(config, designerConfig, data, isResizable = false, filterCallback = null, selectedIds = []) {
|
|
14
|
+
this.resizeHandler = this.resizeListener.bind(this);
|
|
15
|
+
Chart.chartCounter++;
|
|
16
|
+
this.id = Chart.chartCounter;
|
|
17
|
+
this.config = config;
|
|
18
|
+
this.designerConfig = designerConfig;
|
|
19
|
+
this.data = data;
|
|
20
|
+
this.isResizable = isResizable;
|
|
21
|
+
this.model = assembleModel(this.config, this.data, this.designerConfig, this.id);
|
|
22
|
+
this.engine = new Engine(this.id, filterCallback, selectedIds);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Рендер графика
|
|
26
|
+
* @param parentElement родительский элемент для графика
|
|
27
|
+
*/
|
|
28
|
+
render(parentElement) {
|
|
29
|
+
this.parentElement = parentElement;
|
|
30
|
+
this.engine.render(this.model, getPreparedData(this.model, this.data, this.config), this.parentElement);
|
|
31
|
+
if (this.isResizable)
|
|
32
|
+
this.registerResizeEvent();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Удаление графика со страницы
|
|
36
|
+
*/
|
|
37
|
+
destroy() {
|
|
38
|
+
this.engine.destroy();
|
|
39
|
+
if (this.isResizable)
|
|
40
|
+
this.removeResizeEvent();
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Обновление графика для новых данных
|
|
44
|
+
* @param data Новые данные
|
|
45
|
+
*/
|
|
46
|
+
updateData(data) {
|
|
47
|
+
this.model = assembleModel(this.config, data, this.designerConfig, this.id);
|
|
48
|
+
this.data = data;
|
|
49
|
+
this.engine.updateData(this.model, getPreparedData(this.model, this.data, this.config));
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Изменение размера блока с графиком
|
|
53
|
+
* @param newSize Новый размер
|
|
54
|
+
*/
|
|
55
|
+
updateSize(newSize) {
|
|
56
|
+
if (!PublicOptionsService.validateSize(newSize))
|
|
57
|
+
return;
|
|
58
|
+
if (newSize.height)
|
|
59
|
+
this.config.canvas.size.height = newSize.height;
|
|
60
|
+
if (newSize.width)
|
|
61
|
+
this.config.canvas.size.width = newSize.width;
|
|
62
|
+
this.model = assembleModel(this.config, this.data, this.designerConfig, this.id);
|
|
63
|
+
this.engine.updateFullBlock(this.model, getPreparedData(this.model, this.data, this.config));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Обновление цветов графиков на основе новых базовых цветов
|
|
67
|
+
* @param newColors Новые базовые цвета
|
|
68
|
+
*/
|
|
69
|
+
updateColors(newColors) {
|
|
70
|
+
this.designerConfig.chartStyle.baseColors = [...newColors];
|
|
71
|
+
this.model = assembleModel(this.config, this.data, this.designerConfig, this.id);
|
|
72
|
+
this.engine.updateColors(this.model);
|
|
73
|
+
}
|
|
74
|
+
clearSelection(options) {
|
|
75
|
+
this.engine.clearSelection(this.model, { firePublicEvent: options === null || options === void 0 ? void 0 : options.fireEvent });
|
|
76
|
+
}
|
|
77
|
+
registerResizeEvent() {
|
|
78
|
+
window.addEventListener("resize", this.resizeHandler);
|
|
79
|
+
}
|
|
80
|
+
removeResizeEvent() {
|
|
81
|
+
window.removeEventListener("resize", this.resizeHandler);
|
|
82
|
+
}
|
|
83
|
+
resizeListener() {
|
|
84
|
+
this.updateSize({
|
|
85
|
+
height: null,
|
|
86
|
+
width: this.parentElement.offsetWidth
|
|
87
|
+
});
|
|
88
|
+
}
|
|
84
89
|
}
|
|
85
90
|
Chart.chartCounter = 0;
|
|
86
91
|
export * from "./config/config";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare class EventEmitter<E = Record<string, Record<string, any>>> {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
private events;
|
|
3
|
+
subscribe<T extends keyof E>(code: T, listener: (args: E[T]) => void): () => void;
|
|
4
|
+
unsubscribe<T extends keyof E>(code: T, listener: (args: E[T]) => void): void;
|
|
5
|
+
emit<T extends keyof E>(code: T, args?: E[T]): void;
|
|
6
|
+
getSubscribeController(): {
|
|
7
|
+
subscribe: <T extends keyof E>(code: T, listener: (args: E[T]) => void) => () => void;
|
|
8
|
+
unsubscribe: <T_1 extends keyof E>(code: T_1, listener: (args: E[T_1]) => void) => void;
|
|
9
|
+
};
|
|
10
10
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
export class EventEmitter {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
2
|
+
constructor() {
|
|
3
|
+
this.events = {};
|
|
4
|
+
}
|
|
5
|
+
subscribe(code, listener) {
|
|
6
|
+
if (!this.events[code])
|
|
7
|
+
this.events[code] = [];
|
|
8
|
+
this.events[code].push(listener);
|
|
9
|
+
return () => this.unsubscribe(code, listener);
|
|
10
|
+
}
|
|
11
|
+
unsubscribe(code, listener) {
|
|
12
|
+
var _a;
|
|
13
|
+
this.events[code] = (_a = this.events[code]) === null || _a === void 0 ? void 0 : _a.filter((cur) => cur != listener);
|
|
14
|
+
}
|
|
15
|
+
emit(code, args) {
|
|
16
|
+
(this.events[code] || []).forEach((callback) => {
|
|
17
|
+
callback(args);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
getSubscribeController() {
|
|
21
|
+
return {
|
|
22
|
+
subscribe: (code, listener) => this.subscribe(code, listener),
|
|
23
|
+
unsubscribe: (code, listener) => this.unsubscribe(code, listener)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
26
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ChartStyleConfig } from "../../designer/designerConfig";
|
|
2
2
|
import { ChartStyle } from "../model";
|
|
3
3
|
export declare class ChartStyleModelService {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
private static standardColors;
|
|
5
|
+
static getCssClasses(chartIndex: number): string[];
|
|
6
|
+
static getChartStyle(elementsAmount: number, styleConfig: ChartStyleConfig): ChartStyle;
|
|
7
|
+
static getColorSet(baseColors: string[], elementsAmount: number): string[];
|
|
8
|
+
static checkAndGet(baseColors: string[]): string[];
|
|
9
9
|
}
|
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
import * as chroma from "chroma-js";
|
|
2
2
|
export class ChartStyleModelService {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return baseColors;
|
|
29
|
-
}
|
|
3
|
+
static getCssClasses(chartIndex) {
|
|
4
|
+
const cssClasses = [`chart-${chartIndex}`];
|
|
5
|
+
return cssClasses;
|
|
6
|
+
}
|
|
7
|
+
static getChartStyle(elementsAmount, styleConfig) {
|
|
8
|
+
const baseColors = this.checkAndGet(styleConfig.baseColors);
|
|
9
|
+
return {
|
|
10
|
+
elementColors: this.getColorSet(baseColors, elementsAmount),
|
|
11
|
+
opacity: 1
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
static getColorSet(baseColors, elementsAmount) {
|
|
15
|
+
return chroma
|
|
16
|
+
.scale(baseColors)
|
|
17
|
+
.mode("rgb")
|
|
18
|
+
.domain([0, 0.55, 0.75, 1])
|
|
19
|
+
.colors(elementsAmount <= 1 ? 2 : elementsAmount);
|
|
20
|
+
}
|
|
21
|
+
static checkAndGet(baseColors) {
|
|
22
|
+
if (baseColors.length === 0 ||
|
|
23
|
+
baseColors.filter((color) => color === "rgba(0, 0, 0, 0)" || !color).length > 0) {
|
|
24
|
+
return this.standardColors;
|
|
25
|
+
}
|
|
26
|
+
return baseColors;
|
|
27
|
+
}
|
|
30
28
|
}
|
|
31
29
|
ChartStyleModelService.standardColors = ["#209DE3", "#FF3131", "#FFBA00", "#20B078"];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MdtChartsColorRangeItem } from "../../config/config";
|
|
2
2
|
export declare class ColorRangeManager {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
private sortedRange;
|
|
4
|
+
constructor(range: MdtChartsColorRangeItem[]);
|
|
5
|
+
getColorByValue(value: number): string;
|
|
6
6
|
}
|
|
7
7
|
export declare function sortColorRange(colorRange: MdtChartsColorRangeItem[]): MdtChartsColorRangeItem[];
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
export class ColorRangeManager {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
constructor(range) {
|
|
3
|
+
this.sortedRange = sortColorRange(range);
|
|
4
|
+
}
|
|
5
|
+
getColorByValue(value) {
|
|
6
|
+
for (let i = 0; i < this.sortedRange.length; i++) {
|
|
7
|
+
const currentItem = this.sortedRange[i];
|
|
8
|
+
const nextItem = this.sortedRange[i + 1];
|
|
9
|
+
if (!nextItem)
|
|
10
|
+
return currentItem.color;
|
|
11
|
+
if (currentItem.value == null && value < nextItem.value)
|
|
12
|
+
return currentItem.color;
|
|
13
|
+
if (currentItem.value === value)
|
|
14
|
+
return currentItem.color;
|
|
15
|
+
if (value >= currentItem.value && value < nextItem.value)
|
|
16
|
+
return currentItem.color;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
export function sortColorRange(colorRange) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const range = [...colorRange];
|
|
22
|
+
range.sort((a, b) => {
|
|
23
|
+
if (a.value == null)
|
|
24
|
+
return -1;
|
|
25
|
+
return a.value < b.value ? -1 : a.value == b.value ? 0 : 1;
|
|
26
|
+
});
|
|
27
|
+
return range;
|
|
23
28
|
}
|
|
@@ -2,28 +2,18 @@ import { MdtChartsTwoDimensionalChart, TwoDimensionalChartType } from "../../con
|
|
|
2
2
|
import { ChartStyleConfig } from "../../designer/designerConfig";
|
|
3
3
|
import { ChartStyle } from "../model";
|
|
4
4
|
export declare class TwoDimensionalChartStyleModel {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
private charts;
|
|
6
|
+
private chartStyleConfig;
|
|
7
|
+
private service;
|
|
8
|
+
constructor(charts: MdtChartsTwoDimensionalChart[], chartStyleConfig: ChartStyleConfig);
|
|
9
|
+
getChartStyle(chart: MdtChartsTwoDimensionalChart, chartIndex: number): ChartStyle;
|
|
10
|
+
private getChartsValueFieldsAmounts;
|
|
11
11
|
}
|
|
12
12
|
export declare class TwoDimensionalChartStyleService {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
getChartOpacity(
|
|
20
|
-
chartsLength: number,
|
|
21
|
-
chartType: TwoDimensionalChartType,
|
|
22
|
-
chartsValueFieldAmount: number,
|
|
23
|
-
isChartSegmented: boolean
|
|
24
|
-
): number;
|
|
25
|
-
private generateNewChartColors;
|
|
26
|
-
private isMoreThanOneValueFieldOnCanvas;
|
|
27
|
-
private makeColorsBrighter;
|
|
28
|
-
private getStartIndex;
|
|
13
|
+
getChartColors(chart: MdtChartsTwoDimensionalChart, styleConfig: ChartStyleConfig, chartsFieldsAmounts: number[], chartIndex: number): string[];
|
|
14
|
+
getChartOpacity(chartsLength: number, chartType: TwoDimensionalChartType, chartsValueFieldAmount: number, isChartSegmented: boolean): number;
|
|
15
|
+
private generateNewChartColors;
|
|
16
|
+
private isMoreThanOneValueFieldOnCanvas;
|
|
17
|
+
private makeColorsBrighter;
|
|
18
|
+
private getStartIndex;
|
|
29
19
|
}
|
|
@@ -2,75 +2,66 @@ import * as chroma from "chroma-js";
|
|
|
2
2
|
import { ModelHelper } from "../helpers/modelHelper";
|
|
3
3
|
import { ChartStyleModelService } from "./chartStyleModel";
|
|
4
4
|
export class TwoDimensionalChartStyleModel {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
);
|
|
25
|
-
return {
|
|
26
|
-
elementColors: this.service.getChartColors(chart, this.chartStyleConfig, fieldsAmounts, chartIndex),
|
|
27
|
-
opacity
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
getChartsValueFieldsAmounts() {
|
|
31
|
-
return this.charts.map((chart) => chart.data.valueFields.length);
|
|
32
|
-
}
|
|
5
|
+
constructor(charts, chartStyleConfig) {
|
|
6
|
+
this.charts = charts;
|
|
7
|
+
this.chartStyleConfig = chartStyleConfig;
|
|
8
|
+
this.service = new TwoDimensionalChartStyleService();
|
|
9
|
+
}
|
|
10
|
+
getChartStyle(chart, chartIndex) {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
const fieldsAmounts = this.getChartsValueFieldsAmounts();
|
|
13
|
+
const opacity = chart.type === "area" && ((_b = (_a = chart.areaStyles) === null || _a === void 0 ? void 0 : _a.gradient) === null || _b === void 0 ? void 0 : _b.on)
|
|
14
|
+
? 1
|
|
15
|
+
: this.service.getChartOpacity(this.charts.length, chart.type, fieldsAmounts[chartIndex], chart.isSegmented);
|
|
16
|
+
return {
|
|
17
|
+
elementColors: this.service.getChartColors(chart, this.chartStyleConfig, fieldsAmounts, chartIndex),
|
|
18
|
+
opacity
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
getChartsValueFieldsAmounts() {
|
|
22
|
+
return this.charts.map((chart) => chart.data.valueFields.length);
|
|
23
|
+
}
|
|
33
24
|
}
|
|
34
25
|
export class TwoDimensionalChartStyleService {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
26
|
+
getChartColors(chart, styleConfig, chartsFieldsAmounts, chartIndex) {
|
|
27
|
+
const generatedColors = this.generateNewChartColors(chart.type, styleConfig, chartsFieldsAmounts, chartIndex);
|
|
28
|
+
chart.data.valueFields.forEach((field, fieldIndex) => {
|
|
29
|
+
if (field.color)
|
|
30
|
+
generatedColors[fieldIndex] = field.color;
|
|
31
|
+
});
|
|
32
|
+
return generatedColors;
|
|
33
|
+
}
|
|
34
|
+
getChartOpacity(chartsLength, chartType, chartsValueFieldAmount, isChartSegmented) {
|
|
35
|
+
if (chartType === "area" &&
|
|
36
|
+
this.isMoreThanOneValueFieldOnCanvas(chartsLength, chartsValueFieldAmount) &&
|
|
37
|
+
!isChartSegmented)
|
|
38
|
+
return 0.5; // combined area with other charts has 0.5 opacity
|
|
39
|
+
return 1;
|
|
40
|
+
}
|
|
41
|
+
generateNewChartColors(chartType, styleConfig, chartsFieldsAmounts, chartIndex) {
|
|
42
|
+
const startIndex = this.getStartIndex(chartIndex, chartsFieldsAmounts);
|
|
43
|
+
const baseColors = ChartStyleModelService.checkAndGet(styleConfig.baseColors);
|
|
44
|
+
const palette = ChartStyleModelService.getColorSet(baseColors, ModelHelper.getSum(chartsFieldsAmounts));
|
|
45
|
+
const elementsAmount = chartsFieldsAmounts[chartIndex];
|
|
46
|
+
const selectedColors = palette.slice(startIndex, startIndex + elementsAmount);
|
|
47
|
+
if (chartType !== "line")
|
|
48
|
+
return selectedColors;
|
|
49
|
+
this.makeColorsBrighter(selectedColors);
|
|
50
|
+
return selectedColors;
|
|
51
|
+
}
|
|
52
|
+
isMoreThanOneValueFieldOnCanvas(chartsLength, chartsValueFieldAmount) {
|
|
53
|
+
return chartsLength > 1 || chartsValueFieldAmount > 1;
|
|
54
|
+
}
|
|
55
|
+
makeColorsBrighter(initialColors) {
|
|
56
|
+
for (let i = 0; i < initialColors.length; i++) {
|
|
57
|
+
initialColors[i] = chroma.mix(initialColors[i], "white", 0.2).saturate(3).hex();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
getStartIndex(chartIndex, chartsFieldsAmounts) {
|
|
61
|
+
let startIndex = 0;
|
|
62
|
+
for (let i = 0; i < chartIndex; i++) {
|
|
63
|
+
startIndex += chartsFieldsAmounts[i];
|
|
64
|
+
}
|
|
65
|
+
return startIndex;
|
|
66
|
+
}
|
|
76
67
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export class ConfigValidatorClass {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
validateCanvasSize(size) {
|
|
3
|
+
const validateSide = (side) => typeof side === "number" && side >= 0;
|
|
4
|
+
return validateSide(size.width) && validateSide(size.height);
|
|
5
|
+
}
|
|
6
6
|
}
|
|
7
7
|
export const ConfigValidator = new ConfigValidatorClass();
|