mdt-charts 1.28.2 → 1.29.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 +164 -165
- package/lib/designer/designerConfig.d.ts +62 -59
- package/lib/engine/block/block.d.ts +22 -16
- 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 +65 -66
- 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 +6 -6
- package/lib/engine/contentManager/contentManager.js +15 -15
- package/lib/engine/contentManager/contentManagerFactory.d.ts +6 -6
- package/lib/engine/contentManager/contentManagerFactory.js +12 -12
- package/lib/engine/elementHighlighter/elementHighlighter.d.ts +70 -22
- package/lib/engine/elementHighlighter/elementHighlighter.js +230 -181
- package/lib/engine/elementHighlighter/selectHighlighter.d.ts +29 -4
- package/lib/engine/elementHighlighter/selectHighlighter.js +189 -87
- package/lib/engine/engine.d.ts +16 -16
- package/lib/engine/engine.js +87 -62
- package/lib/engine/features/aggregator/aggregator.d.ts +24 -17
- package/lib/engine/features/aggregator/aggregator.js +113 -102
- package/lib/engine/features/axis/axis.d.ts +22 -9
- package/lib/engine/features/axis/axis.js +159 -150
- package/lib/engine/features/axis/axisDomHelper.d.ts +7 -2
- package/lib/engine/features/axis/axisDomHelper.js +19 -20
- package/lib/engine/features/axis/axisHelper.d.ts +9 -5
- package/lib/engine/features/axis/axisHelper.js +28 -33
- package/lib/engine/features/axis/axisLabelDomHelper.d.ts +26 -11
- package/lib/engine/features/axis/axisLabelDomHelper.js +156 -152
- 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 +51 -16
- package/lib/engine/features/embeddedLabels/embeddedLabels.js +234 -134
- package/lib/engine/features/embeddedLabels/embeddedLabelsDomHelper.d.ts +13 -2
- package/lib/engine/features/embeddedLabels/embeddedLabelsDomHelper.js +20 -23
- package/lib/engine/features/embeddedLabels/embeddedLabelsHelper.d.ts +32 -15
- package/lib/engine/features/embeddedLabels/embeddedLabelsHelper.js +56 -63
- package/lib/engine/features/gridLine/gidLineHelper.d.ts +13 -7
- package/lib/engine/features/gridLine/gidLineHelper.js +42 -49
- package/lib/engine/features/gridLine/gridLine.d.ts +19 -5
- package/lib/engine/features/gridLine/gridLine.js +35 -36
- package/lib/engine/features/legend/legend.d.ts +38 -29
- package/lib/engine/features/legend/legend.js +117 -92
- package/lib/engine/features/legend/legendDomHelper.d.ts +13 -6
- package/lib/engine/features/legend/legendDomHelper.js +63 -62
- package/lib/engine/features/legend/legendEventsManager.d.ts +13 -8
- package/lib/engine/features/legend/legendEventsManager.js +48 -47
- package/lib/engine/features/legend/legendHelper.d.ts +39 -14
- package/lib/engine/features/legend/legendHelper.js +98 -93
- package/lib/engine/features/legend/legendHelperService.d.ts +13 -6
- package/lib/engine/features/legend/legendHelperService.js +24 -25
- package/lib/engine/features/legend/legendMarkerCreator.d.ts +18 -9
- package/lib/engine/features/legend/legendMarkerCreator.js +79 -76
- package/lib/engine/features/legend/legendWidthCalculator.d.ts +7 -7
- package/lib/engine/features/legend/legendWidthCalculator.js +126 -122
- package/lib/engine/features/markDots/markDot.d.ts +42 -15
- package/lib/engine/features/markDots/markDot.js +101 -70
- package/lib/engine/features/markDots/markDotsHelper.d.ts +8 -1
- package/lib/engine/features/markDots/markDotsHelper.js +13 -12
- package/lib/engine/features/recordOverflowAlert/recordOverflowAlertCore.d.ts +17 -17
- package/lib/engine/features/recordOverflowAlert/recordOverflowAlertCore.js +42 -47
- package/lib/engine/features/scale/scale.d.ts +17 -12
- package/lib/engine/features/scale/scale.js +76 -69
- package/lib/engine/features/tipBox/tipBox.d.ts +9 -5
- package/lib/engine/features/tipBox/tipBox.js +24 -24
- package/lib/engine/features/tipBox/tipBoxHelper.d.ts +16 -9
- package/lib/engine/features/tipBox/tipBoxHelper.js +60 -45
- package/lib/engine/features/title/title.d.ts +6 -6
- package/lib/engine/features/title/title.js +34 -35
- package/lib/engine/features/tolltip/newTooltip/newTooltip.d.ts +15 -11
- package/lib/engine/features/tolltip/newTooltip/newTooltip.js +21 -21
- package/lib/engine/features/tolltip/newTooltip/newTooltipService.d.ts +13 -8
- package/lib/engine/features/tolltip/newTooltip/newTooltipService.js +26 -23
- package/lib/engine/features/tolltip/tooltip.d.ts +17 -11
- package/lib/engine/features/tolltip/tooltip.js +296 -142
- package/lib/engine/features/tolltip/tooltipComponentsManager.d.ts +21 -10
- package/lib/engine/features/tolltip/tooltipComponentsManager.js +113 -114
- package/lib/engine/features/tolltip/tooltipDomHelper.d.ts +43 -21
- package/lib/engine/features/tolltip/tooltipDomHelper.js +144 -120
- package/lib/engine/features/tolltip/tooltipHelper.d.ts +39 -9
- package/lib/engine/features/tolltip/tooltipHelper.js +114 -91
- package/lib/engine/features/valueLabels/valueLabels.d.ts +58 -38
- package/lib/engine/features/valueLabels/valueLabels.js +205 -169
- package/lib/engine/features/valueLabels/valueLabelsHelper.d.ts +7 -1
- package/lib/engine/features/valueLabels/valueLabelsHelper.js +23 -18
- package/lib/engine/features/valueLabelsCollision/valueLabelsCollision.d.ts +18 -15
- package/lib/engine/features/valueLabelsCollision/valueLabelsCollision.js +46 -47
- package/lib/engine/features/valueLabelsCollision/valueLabelsCollisionHelper.d.ts +6 -3
- package/lib/engine/features/valueLabelsCollision/valueLabelsCollisionHelper.js +49 -45
- package/lib/engine/filterManager/filterEventManager.d.ts +37 -26
- package/lib/engine/filterManager/filterEventManager.js +174 -129
- package/lib/engine/helpers/domHelper.d.ts +45 -20
- package/lib/engine/helpers/domHelper.js +62 -61
- package/lib/engine/helpers/fontResizer/fontResizer.d.ts +10 -10
- package/lib/engine/helpers/fontResizer/fontResizer.js +21 -16
- package/lib/engine/helpers/fontResizer/fontResizerService.d.ts +1 -1
- package/lib/engine/helpers/fontResizer/fontResizerService.js +9 -10
- package/lib/engine/helpers/helper.d.ts +27 -27
- package/lib/engine/helpers/helper.js +91 -92
- 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 +25 -11
- package/lib/engine/polarNotation/donut/DonutHelper.js +71 -70
- package/lib/engine/polarNotation/donut/donut.d.ts +38 -23
- package/lib/engine/polarNotation/donut/donut.js +109 -99
- package/lib/engine/polarNotation/extenders/polarRecordOverflowAlert.d.ts +7 -7
- package/lib/engine/polarNotation/extenders/polarRecordOverflowAlert.js +36 -36
- package/lib/engine/polarNotation/polarManager.d.ts +5 -5
- package/lib/engine/polarNotation/polarManager.js +66 -52
- package/lib/engine/transitionManager.d.ts +13 -14
- package/lib/engine/transitionManager.js +48 -49
- package/lib/engine/twoDimensionalNotation/area/area.d.ts +44 -28
- package/lib/engine/twoDimensionalNotation/area/area.js +272 -238
- package/lib/engine/twoDimensionalNotation/area/areaGenerator.d.ts +13 -5
- 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 +57 -41
- package/lib/engine/twoDimensionalNotation/bar/bar.d.ts +54 -29
- package/lib/engine/twoDimensionalNotation/bar/bar.js +362 -224
- package/lib/engine/twoDimensionalNotation/bar/barHelper.d.ts +71 -32
- package/lib/engine/twoDimensionalNotation/bar/barHelper.js +162 -126
- 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 +16 -17
- package/lib/engine/twoDimensionalNotation/dot/dotChart.d.ts +23 -23
- package/lib/engine/twoDimensionalNotation/dot/dotChart.js +135 -114
- package/lib/engine/twoDimensionalNotation/extenders/twoDimRecordOverflowAlert.d.ts +7 -7
- package/lib/engine/twoDimensionalNotation/extenders/twoDimRecordOverflowAlert.js +28 -28
- package/lib/engine/twoDimensionalNotation/line/line.d.ts +37 -16
- package/lib/engine/twoDimensionalNotation/line/line.js +162 -132
- package/lib/engine/twoDimensionalNotation/line/lineBuilder.d.ts +14 -11
- package/lib/engine/twoDimensionalNotation/line/lineBuilder.js +47 -48
- 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 +12 -6
- package/lib/engine/twoDimensionalNotation/line/lineHelper.js +76 -60
- 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 +16 -17
- package/lib/engine/twoDimensionalNotation/lineLike/generatorMiddleware/lineLikeGeneratorDefineMiddleware.d.ts +11 -10
- package/lib/engine/twoDimensionalNotation/lineLike/generatorMiddleware/lineLikeGeneratorDefineMiddleware.js +9 -7
- package/lib/engine/twoDimensionalNotation/lineLike/generatorMiddleware/lineLikeGeneratorMiddleware.d.ts +3 -1
- package/lib/engine/twoDimensionalNotation/twoDimensionalManager.d.ts +9 -9
- package/lib/engine/twoDimensionalNotation/twoDimensionalManager.js +252 -143
- package/lib/engine/valueFormatter.d.ts +3 -3
- package/lib/engine/valueFormatter.js +6 -6
- package/lib/main.d.ts +82 -75
- package/lib/main.js +79 -84
- 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 +27 -25
- package/lib/model/chartStyleModel/colorRange.d.ts +3 -3
- package/lib/model/chartStyleModel/colorRange.js +19 -24
- package/lib/model/chartStyleModel/twoDimensionalChartStyleModel.d.ts +22 -12
- package/lib/model/chartStyleModel/twoDimensionalChartStyleModel.js +69 -60
- package/lib/model/configsValidator/configValidator.d.ts +1 -1
- package/lib/model/configsValidator/configValidator.js +4 -4
- package/lib/model/dataManagerModel/dataManagerModel.d.ts +36 -26
- package/lib/model/dataManagerModel/dataManagerModel.js +179 -128
- package/lib/model/dataManagerModel/dataManagerModelService.d.ts +2 -2
- package/lib/model/dataManagerModel/dataManagerModelService.js +25 -26
- package/lib/model/featuresModel/axisModel.d.ts +69 -18
- package/lib/model/featuresModel/axisModel.js +224 -169
- package/lib/model/featuresModel/axisModelService.d.ts +10 -6
- package/lib/model/featuresModel/axisModelService.js +27 -27
- package/lib/model/featuresModel/legendModel/legendCanvasModel.d.ts +16 -11
- package/lib/model/featuresModel/legendModel/legendCanvasModel.js +55 -59
- package/lib/model/featuresModel/legendModel/legendModel.d.ts +7 -3
- package/lib/model/featuresModel/legendModel/legendModel.js +59 -41
- package/lib/model/featuresModel/legendModel/polarMarginCalculator.d.ts +8 -3
- package/lib/model/featuresModel/legendModel/polarMarginCalculator.js +18 -20
- package/lib/model/featuresModel/legendModel/twoDimLegendModel.d.ts +8 -4
- package/lib/model/featuresModel/legendModel/twoDimLegendModel.js +40 -27
- package/lib/model/featuresModel/otherComponents.d.ts +7 -4
- package/lib/model/featuresModel/otherComponents.js +9 -9
- package/lib/model/featuresModel/scaleModel/scaleAxisRecalcer.d.ts +6 -6
- package/lib/model/featuresModel/scaleModel/scaleAxisRecalcer.js +27 -23
- package/lib/model/featuresModel/scaleModel/scaleDomainService.d.ts +19 -5
- package/lib/model/featuresModel/scaleModel/scaleDomainService.js +44 -55
- package/lib/model/featuresModel/scaleModel/scaleModel.d.ts +10 -10
- package/lib/model/featuresModel/scaleModel/scaleModel.js +61 -50
- package/lib/model/featuresModel/scaleModel/scaleModelServices.js +15 -22
- 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 +23 -11
- package/lib/model/featuresModel/valueLabelsModel/valueLabelsModel.js +53 -51
- package/lib/model/helpers/modelHelper.d.ts +7 -7
- package/lib/model/helpers/modelHelper.js +38 -42
- package/lib/model/helpers/twoDimensionalModelHelper.d.ts +37 -9
- package/lib/model/helpers/twoDimensionalModelHelper.js +147 -125
- package/lib/model/helpers/unitsFromConfigReader.js +4 -4
- package/lib/model/helpers/unitsReader.d.ts +2 -2
- package/lib/model/helpers/unitsReader.js +11 -13
- package/lib/model/margin/marginModel.d.ts +7 -7
- package/lib/model/margin/marginModel.js +23 -20
- package/lib/model/margin/twoDim/twoDimMarginModel.d.ts +13 -13
- package/lib/model/margin/twoDim/twoDimMarginModel.js +184 -113
- package/lib/model/model.d.ts +308 -280
- package/lib/model/model.js +4 -4
- package/lib/model/modelBuilder.d.ts +27 -18
- package/lib/model/modelBuilder.js +85 -79
- package/lib/model/modelInstance/canvasModel/canvasModel.d.ts +17 -17
- package/lib/model/modelInstance/canvasModel/canvasModel.js +42 -43
- 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 +32 -23
- package/lib/model/modelInstance/configReader.js +125 -94
- package/lib/model/modelInstance/dataModel/dataModel.d.ts +9 -9
- package/lib/model/modelInstance/dataModel/dataModel.js +24 -24
- 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 +11 -6
- package/lib/model/modelInstance/modelInstance.js +16 -16
- package/lib/model/modelInstance/titleConfigReader.d.ts +8 -8
- package/lib/model/modelInstance/titleConfigReader.js +37 -30
- package/lib/model/notations/polar/donut/donutAggregatorService.d.ts +9 -6
- package/lib/model/notations/polar/donut/donutAggregatorService.js +40 -37
- package/lib/model/notations/polar/donut/donutModel.d.ts +9 -5
- 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 +13 -15
- package/lib/model/notations/polar/polarModel.d.ts +18 -7
- package/lib/model/notations/polar/polarModel.js +79 -65
- package/lib/model/notations/twoDimensional/styles.d.ts +44 -7
- package/lib/model/notations/twoDimensional/styles.js +234 -125
- package/lib/model/notations/twoDimensionalModel.d.ts +23 -13
- package/lib/model/notations/twoDimensionalModel.js +330 -162
- 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 +10 -11
- package/lib/style/charts-main.css +150 -151
- package/lib/style/charts-main.less +150 -151
- package/package.json +1 -1
|
@@ -2,108 +2,119 @@ import { interpolateNumber } from "d3-interpolate";
|
|
|
2
2
|
import { Helper } from "../../helpers/helper";
|
|
3
3
|
import { ValueFormatter } from "../../valueFormatter";
|
|
4
4
|
export class Aggregator {
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
5
|
+
static render(block, valueField, innerRadius, translate, fontSize, settings) {
|
|
6
|
+
const aggregator = this.buildConfig(valueField, settings);
|
|
7
|
+
this.renderText(block, innerRadius, aggregator, fontSize, translate);
|
|
8
|
+
}
|
|
9
|
+
static update(block, valueField, settings) {
|
|
10
|
+
const aggregator = this.buildConfig(valueField, settings);
|
|
11
|
+
this.updateText(block, aggregator, typeof aggregator.value === "string");
|
|
12
|
+
}
|
|
13
|
+
static buildConfig(valueField, settings) {
|
|
14
|
+
return {
|
|
15
|
+
name: settings.content.title,
|
|
16
|
+
value: settings.content.value,
|
|
17
|
+
format: valueField.format,
|
|
18
|
+
marginInPercent: settings.margin
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
static renderText(block, innerRadius, aggregatorInfo, fontSize, translate) {
|
|
22
|
+
if (innerRadius > 30) {
|
|
23
|
+
const aggregatorObject = this.renderAggregatorObject(block, innerRadius, translate);
|
|
24
|
+
const wrapper = this.renderWrapper(aggregatorObject);
|
|
25
|
+
wrapper
|
|
26
|
+
.append("div")
|
|
27
|
+
.attr("class", this.aggregatorValueClass)
|
|
28
|
+
.attr("title", this.formatValue(aggregatorInfo.format, aggregatorInfo.value))
|
|
29
|
+
.style("text-align", "center")
|
|
30
|
+
.style("font-size", `${fontSize}px`)
|
|
31
|
+
.text(this.formatValue(aggregatorInfo.format, aggregatorInfo.value));
|
|
32
|
+
const titleBlock = wrapper
|
|
33
|
+
.append("div")
|
|
34
|
+
.attr("class", this.aggregatorTitleClass)
|
|
35
|
+
.attr("title", aggregatorInfo.name)
|
|
36
|
+
.style("text-align", "center")
|
|
37
|
+
.text(aggregatorInfo.name);
|
|
38
|
+
this.setTitleFontSize(titleBlock, innerRadius);
|
|
39
|
+
this.reCalculateAggregatorFontSize(
|
|
40
|
+
aggregatorObject.node().getBoundingClientRect().width,
|
|
41
|
+
block,
|
|
42
|
+
aggregatorInfo.marginInPercent
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
static formatValue(format, value) {
|
|
47
|
+
if (typeof value === "string") return value;
|
|
48
|
+
return ValueFormatter.formatField(format, value);
|
|
49
|
+
}
|
|
50
|
+
static updateText(block, newAggregator, withoutAnimation) {
|
|
51
|
+
const aggregatorObject = block.getSvg().select(`.${this.aggregatorObjectClass}`);
|
|
52
|
+
const thisClass = this;
|
|
53
|
+
const valueBlock = block.getSvg().select(`.${this.aggregatorValueClass}`);
|
|
54
|
+
if (withoutAnimation) {
|
|
55
|
+
valueBlock.text(this.formatValue(newAggregator.format, newAggregator.value));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
valueBlock
|
|
59
|
+
.interrupt()
|
|
60
|
+
.transition()
|
|
61
|
+
.duration(block.transitionManager.durations.chartUpdate)
|
|
62
|
+
.tween("text", function () {
|
|
63
|
+
const newValue =
|
|
64
|
+
typeof newAggregator.value === "string" ? parseFloat(newAggregator.value) : newAggregator.value;
|
|
65
|
+
const oldValue = Helper.parseFormattedToNumber(this.textContent, ",");
|
|
66
|
+
const precision = Helper.calcDigitsAfterDot(newValue);
|
|
67
|
+
const interpolateFunc = interpolateNumber(oldValue, newValue);
|
|
68
|
+
return (t) => {
|
|
69
|
+
this.textContent = thisClass.formatValue(
|
|
70
|
+
newAggregator.format,
|
|
71
|
+
parseFloat(interpolateFunc(t).toFixed(precision))
|
|
72
|
+
);
|
|
73
|
+
thisClass.reCalculateAggregatorFontSize(
|
|
74
|
+
aggregatorObject.node().getBoundingClientRect().width,
|
|
75
|
+
block,
|
|
76
|
+
newAggregator.marginInPercent
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
static reCalculateAggregatorFontSize(wrapperSize, block, pad) {
|
|
82
|
+
const aggregatorValue = block.getSvg().select(`.${this.aggregatorValueClass}`);
|
|
83
|
+
const sizeCoefficient = 0.25;
|
|
84
|
+
let fontSize = wrapperSize * sizeCoefficient;
|
|
85
|
+
aggregatorValue.style("font-size", `${fontSize}px`);
|
|
86
|
+
const margin = (pad / 100) * wrapperSize;
|
|
87
|
+
while (aggregatorValue.node().getBoundingClientRect().width > wrapperSize - margin * 2 && fontSize > 12) {
|
|
88
|
+
aggregatorValue.style("font-size", `${(fontSize -= 2)}px`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
static setTitleFontSize(aggregatorTitle, innerRadius) {
|
|
92
|
+
const sizeCoefficient = 0.15;
|
|
93
|
+
aggregatorTitle.style("font-size", `${Math.round(innerRadius * sizeCoefficient)}px`);
|
|
94
|
+
aggregatorTitle.style("max-height", `${sizeCoefficient * 100}%`);
|
|
95
|
+
}
|
|
96
|
+
static renderAggregatorObject(block, innerRadius, translate) {
|
|
97
|
+
return block
|
|
98
|
+
.getSvg()
|
|
99
|
+
.append("foreignObject")
|
|
100
|
+
.attr("class", this.aggregatorObjectClass)
|
|
101
|
+
.attr("transform-origin", "center")
|
|
102
|
+
.attr("width", innerRadius * 2)
|
|
103
|
+
.attr("height", innerRadius * 2)
|
|
104
|
+
.attr("transform", `translate(${translate.x - innerRadius}, ${translate.y - innerRadius})`)
|
|
105
|
+
.style("pointer-events", `none`);
|
|
106
|
+
}
|
|
107
|
+
static renderWrapper(aggregatorObject) {
|
|
108
|
+
return aggregatorObject
|
|
109
|
+
.append("xhtml:div")
|
|
110
|
+
.style("width", "100%")
|
|
111
|
+
.style("height", "100%")
|
|
112
|
+
.style("border-radius", "50%")
|
|
113
|
+
.style("display", "flex")
|
|
114
|
+
.style("flex-direction", "column")
|
|
115
|
+
.style("justify-content", "center")
|
|
116
|
+
.style("align-items", "center");
|
|
117
|
+
}
|
|
107
118
|
}
|
|
108
119
|
Aggregator.aggregatorValueClass = "aggregator-value";
|
|
109
120
|
Aggregator.aggregatorTitleClass = "aggregator-name";
|
|
@@ -3,13 +3,26 @@ import { Block } from "../../block/block";
|
|
|
3
3
|
import { ScalesWithSecondary } from "../scale/scale";
|
|
4
4
|
import { Size } from "../../../config/config";
|
|
5
5
|
export declare class Axis {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
static axesClass: string;
|
|
7
|
+
static render(
|
|
8
|
+
block: Block,
|
|
9
|
+
scales: ScalesWithSecondary,
|
|
10
|
+
scaleModel: IScaleModel,
|
|
11
|
+
axisModel: IAxisModel,
|
|
12
|
+
blockSize: Size
|
|
13
|
+
): void;
|
|
14
|
+
static update(
|
|
15
|
+
block: Block,
|
|
16
|
+
scales: ScalesWithSecondary,
|
|
17
|
+
scalesOptions: IScaleModel,
|
|
18
|
+
axisModel: IAxisModel,
|
|
19
|
+
blockSize: Size,
|
|
20
|
+
keyDomainsEquality: boolean
|
|
21
|
+
): void;
|
|
22
|
+
static raiseKeyAxis(block: Block, axisOptions: AxisModelOptions): void;
|
|
23
|
+
private static findAxis;
|
|
24
|
+
private static renderAxis;
|
|
25
|
+
private static updateValueAxis;
|
|
26
|
+
private static updateKeyAxis;
|
|
27
|
+
private static handleLabelsHighlight;
|
|
15
28
|
}
|
|
@@ -8,155 +8,164 @@ import { AxisLabelsEventManager } from "./axisLabelsEventManager";
|
|
|
8
8
|
import { AXIS_VERTICAL_LABEL_PADDING } from "../../../model/margin/twoDim/twoDimMarginModel";
|
|
9
9
|
const MINIMAL_STEP_SIZE_FOR_WRAPPING = 38;
|
|
10
10
|
export class Axis {
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
11
|
+
static render(block, scales, scaleModel, axisModel, blockSize) {
|
|
12
|
+
var _a;
|
|
13
|
+
if (axisModel.value.visibility)
|
|
14
|
+
this.renderAxis(block, scales.value, scaleModel.value, axisModel.value, blockSize);
|
|
15
|
+
if ((_a = axisModel.valueSecondary) === null || _a === void 0 ? void 0 : _a.visibility)
|
|
16
|
+
this.renderAxis(
|
|
17
|
+
block,
|
|
18
|
+
scales.valueSecondary,
|
|
19
|
+
scaleModel.valueSecondary,
|
|
20
|
+
axisModel.valueSecondary,
|
|
21
|
+
blockSize
|
|
22
|
+
);
|
|
23
|
+
if (axisModel.key.visibility) this.renderAxis(block, scales.key, scaleModel.key, axisModel.key, blockSize);
|
|
24
|
+
}
|
|
25
|
+
static update(block, scales, scalesOptions, axisModel, blockSize, keyDomainsEquality) {
|
|
26
|
+
var _a;
|
|
27
|
+
if (axisModel.value.visibility)
|
|
28
|
+
this.updateValueAxis(block, scales.value, scalesOptions.value, axisModel.value, blockSize);
|
|
29
|
+
if ((_a = axisModel.valueSecondary) === null || _a === void 0 ? void 0 : _a.visibility)
|
|
30
|
+
this.updateValueAxis(
|
|
31
|
+
block,
|
|
32
|
+
scales.valueSecondary,
|
|
33
|
+
scalesOptions.valueSecondary,
|
|
34
|
+
axisModel.valueSecondary,
|
|
35
|
+
blockSize
|
|
36
|
+
);
|
|
37
|
+
if (axisModel.key.visibility)
|
|
38
|
+
this.updateKeyAxis(block, scales.key, scalesOptions.key, axisModel.key, blockSize, keyDomainsEquality);
|
|
39
|
+
}
|
|
40
|
+
static raiseKeyAxis(block, axisOptions) {
|
|
41
|
+
const axisElement = this.findAxis(block, axisOptions.cssClass);
|
|
42
|
+
axisElement.raise();
|
|
43
|
+
}
|
|
44
|
+
static findAxis(block, axisCssClass) {
|
|
45
|
+
return block.getSvg().select(`g.${axisCssClass}`);
|
|
46
|
+
}
|
|
47
|
+
static renderAxis(block, scale, scaleOptions, axisOptions, blockSize) {
|
|
48
|
+
const axisGenerator = AxisHelper.getBaseAxisGenerator(axisOptions, scale);
|
|
49
|
+
if (axisOptions.type === "value" && scaleOptions.type === "linear")
|
|
50
|
+
AxisHelper.setValueAxisLabelsSettings(axisGenerator, scaleOptions, axisOptions.labels);
|
|
51
|
+
else axisGenerator.tickFormat(axisOptions.labels.showTick);
|
|
52
|
+
const axisElement = block
|
|
53
|
+
.getSvg()
|
|
54
|
+
.append("g")
|
|
55
|
+
.attr("class", `${this.axesClass} ${axisOptions.cssClass} data-label`);
|
|
56
|
+
AxisDomHelper.updateAxisElement(axisGenerator, axisElement, axisOptions.translate);
|
|
57
|
+
if (!axisOptions.line.visible) axisElement.select(".domain").style("display", "none");
|
|
58
|
+
if (!axisOptions.labels.visible) {
|
|
59
|
+
AxisLabelHelper.hideLabels(axisElement);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (axisOptions.type === "key") {
|
|
63
|
+
if (
|
|
64
|
+
axisOptions.labels.position === "rotated" &&
|
|
65
|
+
(axisOptions.orient === "top" || axisOptions.orient === "bottom")
|
|
66
|
+
)
|
|
67
|
+
AxisLabelHelper.rotateLabels(axisElement, axisOptions.orient);
|
|
68
|
+
if (
|
|
69
|
+
(axisOptions.orient === "left" || axisOptions.orient === "right") &&
|
|
70
|
+
Scale.getScaleStep(scale) >= MINIMAL_STEP_SIZE_FOR_WRAPPING
|
|
71
|
+
)
|
|
72
|
+
axisElement.selectAll(".tick text").call(AxisLabelHelper.wrapHandler, axisOptions.labels.maxSize);
|
|
73
|
+
else AxisLabelHelper.cropLabels(block, scale, scaleOptions, axisOptions, blockSize);
|
|
74
|
+
AxisLabelHelper.alignLabelsInKeyAxis(axisOptions, axisElement);
|
|
75
|
+
AxisLabelsEventManager.setHoverEvents(block, axisElement);
|
|
76
|
+
block.filterEventManager.eventEmitter.subscribe("change", (selectedKeys) => {
|
|
77
|
+
this.handleLabelsHighlight(axisElement, selectedKeys);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (axisOptions.type === "value") {
|
|
81
|
+
AxisLabelHelper.cropLabels(block, scale, scaleOptions, axisOptions, blockSize);
|
|
82
|
+
}
|
|
83
|
+
if (axisOptions.labels.defaultTooltip) AxisLabelHelper.setTitles(axisElement, axisOptions);
|
|
84
|
+
}
|
|
85
|
+
static updateValueAxis(block, scaleValue, scaleOptions, axisOptions, blockSize) {
|
|
86
|
+
const axisGenerator = AxisHelper.getBaseAxisGenerator(axisOptions, scaleValue);
|
|
87
|
+
AxisHelper.setValueAxisLabelsSettings(axisGenerator, scaleOptions, axisOptions.labels);
|
|
88
|
+
const axisElement = block.getSvg().select(`g.${axisOptions.cssClass}`);
|
|
89
|
+
AxisDomHelper.updateAxisElement(
|
|
90
|
+
axisGenerator,
|
|
91
|
+
axisElement,
|
|
92
|
+
axisOptions.translate,
|
|
93
|
+
block.transitionManager.durations.chartUpdate
|
|
94
|
+
).then(() => {
|
|
95
|
+
if (axisOptions.labels.defaultTooltip) AxisLabelHelper.setTitles(axisElement, axisOptions);
|
|
96
|
+
if (axisOptions.orient === "bottom" || axisOptions.orient === "top") {
|
|
97
|
+
AxisLabelHelper.cropLabels(block, scaleValue, scaleOptions, axisOptions, blockSize);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
static updateKeyAxis(block, scaleKey, scaleOptions, axisOptions, blockSize, domainNotUpdated) {
|
|
102
|
+
const axisGenerator = AxisHelper.getBaseAxisGenerator(axisOptions, scaleKey);
|
|
103
|
+
if (axisOptions.labels.position === "rotated") {
|
|
104
|
+
// Задание координат для перевернутых лейблов (если до этого они не были перевернуты)
|
|
105
|
+
if (axisOptions.orient === "bottom") axisGenerator.tickPadding(-4);
|
|
106
|
+
else if (axisOptions.orient === "top") axisGenerator.tickPadding(-6);
|
|
107
|
+
}
|
|
108
|
+
axisGenerator.tickFormat(axisOptions.labels.showTick);
|
|
109
|
+
const axisElement = block.getSvg().select(`g.${axisOptions.cssClass}`);
|
|
110
|
+
AxisLabelsEventManager.removeEvents(axisElement);
|
|
111
|
+
if (axisOptions.orient === "left" || axisOptions.orient === "right") {
|
|
112
|
+
axisElement.selectAll(".tick text").attr("y", null);
|
|
113
|
+
if (axisOptions.orient === "left")
|
|
114
|
+
axisGenerator.tickPadding(axisOptions.labels.maxSize + AXIS_VERTICAL_LABEL_PADDING);
|
|
115
|
+
}
|
|
116
|
+
// Если ключи оси не меняются, то обновление происходит без анимации
|
|
117
|
+
AxisDomHelper.updateAxisElement(
|
|
118
|
+
axisGenerator,
|
|
119
|
+
axisElement,
|
|
120
|
+
axisOptions.translate,
|
|
121
|
+
domainNotUpdated ? 0 : block.transitionManager.durations.chartUpdate
|
|
122
|
+
).then(() => {
|
|
123
|
+
if (axisOptions.orient === "bottom" || axisOptions.orient === "top") {
|
|
124
|
+
AxisLabelHelper.cropLabels(block, scaleKey, scaleOptions, axisOptions, blockSize);
|
|
125
|
+
}
|
|
126
|
+
AxisLabelsEventManager.setHoverEvents(block, axisElement);
|
|
127
|
+
if (axisOptions.labels.defaultTooltip) AxisLabelHelper.setTitles(axisElement, axisOptions);
|
|
128
|
+
this.handleLabelsHighlight(axisElement, block.filterEventManager.getSelectedKeys());
|
|
129
|
+
});
|
|
130
|
+
// Ведется отсчет нескольких кадров, чтобы получить уже 100%-отрендеренные лейблы оси.
|
|
131
|
+
let frame = 0;
|
|
132
|
+
const labelHandler = () => {
|
|
133
|
+
frame++;
|
|
134
|
+
if (frame < 10) requestAnimationFrame(labelHandler);
|
|
135
|
+
if (frame === 2) {
|
|
136
|
+
axisElement.selectAll(".tick").each(function (d) {
|
|
137
|
+
if (scaleKey.domain().findIndex((key) => key === d) === -1) {
|
|
138
|
+
select(this).style("opacity", 0);
|
|
139
|
+
} else {
|
|
140
|
+
select(this).style("opacity", 1);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
if (axisOptions.orient === "left" || axisOptions.orient === "right") {
|
|
145
|
+
if (Scale.getScaleStep(scaleKey) >= MINIMAL_STEP_SIZE_FOR_WRAPPING)
|
|
146
|
+
axisElement.selectAll(".tick text").call(AxisLabelHelper.wrapHandler, axisOptions.labels.maxSize);
|
|
147
|
+
else AxisLabelHelper.cropLabels(block, scaleKey, scaleOptions, axisOptions, blockSize);
|
|
148
|
+
AxisLabelHelper.alignLabelsInKeyAxis(axisOptions, axisElement);
|
|
149
|
+
}
|
|
150
|
+
if (axisOptions.orient === "bottom" || axisOptions.orient === "top") {
|
|
151
|
+
if (axisOptions.labels.position === "rotated")
|
|
152
|
+
AxisLabelHelper.rotateLabels(axisElement, axisOptions.orient);
|
|
153
|
+
if (axisOptions.labels.position === "straight")
|
|
154
|
+
// Обратное выравнивание лейблов, если они были перевернуты, но теперь могут отображаться прямо
|
|
155
|
+
AxisDomHelper.rotateElementsBack(axisElement);
|
|
156
|
+
AxisLabelHelper.cropLabels(block, scaleKey, scaleOptions, axisOptions, blockSize);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
requestAnimationFrame(labelHandler);
|
|
160
|
+
}
|
|
161
|
+
static handleLabelsHighlight(axisElement, selectedKeys) {
|
|
162
|
+
const labels = axisElement.selectAll(".tick text");
|
|
163
|
+
if (selectedKeys.length === 0) labels.classed("mdt-charts-opacity-inactive", false);
|
|
164
|
+
else
|
|
165
|
+
labels.each(function (data) {
|
|
166
|
+
const isActive = selectedKeys.includes(data);
|
|
167
|
+
select(this).classed("mdt-charts-opacity-inactive", !isActive);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
161
170
|
}
|
|
162
171
|
Axis.axesClass = NamesHelper.getClassName("axis");
|
|
@@ -2,6 +2,11 @@ import { Selection, BaseType } from "d3-selection";
|
|
|
2
2
|
import { Axis as IAxis } from "d3-axis";
|
|
3
3
|
import { TranslateModel } from "../../../model/model";
|
|
4
4
|
export declare class AxisDomHelper {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
static updateAxisElement(
|
|
6
|
+
axisGenerator: IAxis<any>,
|
|
7
|
+
axisElement: Selection<SVGGElement, any, BaseType, any>,
|
|
8
|
+
translate: TranslateModel,
|
|
9
|
+
transitionDuration?: number
|
|
10
|
+
): Promise<string>;
|
|
11
|
+
static rotateElementsBack(axisElement: Selection<SVGGElement, unknown, HTMLElement, any>): void;
|
|
7
12
|
}
|