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
|
@@ -2,103 +2,97 @@ import { Helper } from "../../helpers/helper";
|
|
|
2
2
|
import { Legend } from "./legend";
|
|
3
3
|
import { LegendHelperService } from "./legendHelperService";
|
|
4
4
|
export class LegendHelper {
|
|
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
|
-
"2d": Legend.label2DClass,
|
|
98
|
-
polar: Legend.labelPolarClass,
|
|
99
|
-
interval: Legend.labelIntervalClass
|
|
100
|
-
};
|
|
101
|
-
return `${Legend.labelClass} ${legendClasses[chartNotation]}`;
|
|
102
|
-
}
|
|
5
|
+
static getLegendItemsContent(options, data) {
|
|
6
|
+
if (options.type === "2d") {
|
|
7
|
+
let texts = [];
|
|
8
|
+
options.charts.forEach((chart) => {
|
|
9
|
+
texts = texts.concat(chart.data.valueFields.map((field) => (Object.assign(Object.assign({}, chart.legend), { textContent: field.title }))));
|
|
10
|
+
});
|
|
11
|
+
return texts;
|
|
12
|
+
}
|
|
13
|
+
if (options.type === "polar") {
|
|
14
|
+
return data[options.data.dataSource].map((record) => (Object.assign(Object.assign({}, options.charts[0].legend), { textContent: record[options.data.keyField.name] })));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
static getMarksColor(options, dataRows) {
|
|
18
|
+
if (options.type === "2d") {
|
|
19
|
+
let colors = [];
|
|
20
|
+
options.charts.forEach((chart) => {
|
|
21
|
+
colors = colors.concat(chart.style.elementColors);
|
|
22
|
+
});
|
|
23
|
+
return colors;
|
|
24
|
+
}
|
|
25
|
+
else if (options.type === "polar") {
|
|
26
|
+
if (!options.charts[0].data.colorField)
|
|
27
|
+
return options.charts.map((chart) => chart.style.elementColors)[0];
|
|
28
|
+
return dataRows.map((row) => row[options.charts[0].data.colorField]);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
static getMaxItemWidth(legendBlockWidth, marginsLeft, itemsDirection) {
|
|
32
|
+
if (itemsDirection === "row") {
|
|
33
|
+
const sumOfMargins = Helper.getSumOfNumeric(marginsLeft);
|
|
34
|
+
return (parseFloat(legendBlockWidth) - sumOfMargins) / marginsLeft.length;
|
|
35
|
+
}
|
|
36
|
+
return parseFloat(legendBlockWidth);
|
|
37
|
+
}
|
|
38
|
+
static getSumOfItemsWidths(itemsWidth, marginsLeft) {
|
|
39
|
+
let sumOfItemsWidth = Helper.getSumOfNumeric(itemsWidth);
|
|
40
|
+
sumOfItemsWidth += Helper.getSumOfNumeric(marginsLeft);
|
|
41
|
+
return sumOfItemsWidth;
|
|
42
|
+
}
|
|
43
|
+
static getLegendCoordinateByPosition(legendPosition, legendBlockModel, blockSize) {
|
|
44
|
+
const legendModel = legendBlockModel.coordinate[legendPosition];
|
|
45
|
+
const coordinate = {
|
|
46
|
+
x: 0,
|
|
47
|
+
y: 0,
|
|
48
|
+
width: 0,
|
|
49
|
+
height: 0
|
|
50
|
+
};
|
|
51
|
+
if (legendPosition === "left" || legendPosition === "right") {
|
|
52
|
+
coordinate.y = legendModel.margin.top + legendModel.pad;
|
|
53
|
+
coordinate.width = legendModel.size;
|
|
54
|
+
coordinate.height = blockSize.height - legendModel.margin.top - legendModel.margin.bottom;
|
|
55
|
+
}
|
|
56
|
+
else if (legendPosition === "bottom" || legendPosition === "top") {
|
|
57
|
+
coordinate.x = legendModel.margin.left;
|
|
58
|
+
coordinate.width = blockSize.width - legendModel.margin.left - legendModel.margin.right;
|
|
59
|
+
coordinate.height = legendModel.size;
|
|
60
|
+
}
|
|
61
|
+
if (legendPosition === "left")
|
|
62
|
+
coordinate.x = legendModel.margin.left;
|
|
63
|
+
else if (legendPosition === "right")
|
|
64
|
+
coordinate.x = blockSize.width - legendModel.size - legendModel.margin.right;
|
|
65
|
+
else if (legendPosition === "top")
|
|
66
|
+
coordinate.y = legendModel.margin.top + legendModel.pad;
|
|
67
|
+
else if (legendPosition === "bottom")
|
|
68
|
+
coordinate.y = blockSize.height - legendModel.size - legendModel.margin.bottom;
|
|
69
|
+
return coordinate;
|
|
70
|
+
}
|
|
71
|
+
static getContentRenderingOptions(chartNotation, legendPosition, legendBlockModel) {
|
|
72
|
+
const itemsDirection = this.service.getLegendItemsDirection(legendPosition);
|
|
73
|
+
const legendLabelClass = this.getLegendClassByChartNotation(chartNotation);
|
|
74
|
+
return {
|
|
75
|
+
wrapperClasses: [
|
|
76
|
+
Legend.legendBlockClass,
|
|
77
|
+
chartNotation === "2d" ? "legend-block-centered" : "",
|
|
78
|
+
this.service.getWrapperClassByItemsDirection(itemsDirection),
|
|
79
|
+
this.service.getWrapperClassByWrappingItems(legendPosition, chartNotation)
|
|
80
|
+
],
|
|
81
|
+
shouldCropLabels: chartNotation === "2d",
|
|
82
|
+
blockModel: legendBlockModel,
|
|
83
|
+
itemsOptions: {
|
|
84
|
+
markerClass: Legend.markerClass,
|
|
85
|
+
labelClass: this.service.getLegendLabelClassByPosition(legendPosition, chartNotation, legendLabelClass),
|
|
86
|
+
wrapperClasses: [Legend.itemClass, this.service.getItemClasses(itemsDirection)]
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
static getLegendClassByChartNotation(chartNotation) {
|
|
91
|
+
const legendClasses = {
|
|
92
|
+
"2d": Legend.label2DClass,
|
|
93
|
+
polar: Legend.labelPolarClass
|
|
94
|
+
};
|
|
95
|
+
return `${Legend.labelClass} ${legendClasses[chartNotation]}`;
|
|
96
|
+
}
|
|
103
97
|
}
|
|
104
98
|
LegendHelper.service = new LegendHelperService();
|
|
@@ -2,17 +2,10 @@ import { ChartNotation } from "../../../config/config";
|
|
|
2
2
|
import { LegendItemsDirection } from "../../../model/featuresModel/legendModel/legendCanvasModel";
|
|
3
3
|
import { LegendPosition } from "../../../model/model";
|
|
4
4
|
export declare class LegendHelperService {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
legendPosition: LegendPosition,
|
|
12
|
-
chartNotation: ChartNotation,
|
|
13
|
-
initialLabelClass: string
|
|
14
|
-
): string;
|
|
15
|
-
getItemClasses(itemsDirection: LegendItemsDirection): string;
|
|
16
|
-
getLegendItemsDirection(legendPosition: LegendPosition): LegendItemsDirection;
|
|
17
|
-
private doesLegendInTopBy2d;
|
|
5
|
+
getWrapperClassByItemsDirection(itemsDirection: LegendItemsDirection): "legend-block-column" | "legend-block-row";
|
|
6
|
+
getWrapperClassByWrappingItems(legendPosition: LegendPosition, chartNotation: ChartNotation): "legend-wrapper-with-wrap" | "legend-wrapper-without-wrap";
|
|
7
|
+
getLegendLabelClassByPosition(legendPosition: LegendPosition, chartNotation: ChartNotation, initialLabelClass: string): string;
|
|
8
|
+
getItemClasses(itemsDirection: LegendItemsDirection): string;
|
|
9
|
+
getLegendItemsDirection(legendPosition: LegendPosition): LegendItemsDirection;
|
|
10
|
+
private doesLegendInTopBy2d;
|
|
18
11
|
}
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
export class LegendHelperService {
|
|
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
|
+
getWrapperClassByItemsDirection(itemsDirection) {
|
|
3
|
+
return itemsDirection === "column" ? "legend-block-column" : "legend-block-row";
|
|
4
|
+
}
|
|
5
|
+
getWrapperClassByWrappingItems(legendPosition, chartNotation) {
|
|
6
|
+
if (this.doesLegendInTopBy2d(legendPosition, chartNotation)) {
|
|
7
|
+
return "legend-wrapper-without-wrap";
|
|
8
|
+
}
|
|
9
|
+
return "legend-wrapper-with-wrap";
|
|
10
|
+
}
|
|
11
|
+
getLegendLabelClassByPosition(legendPosition, chartNotation, initialLabelClass) {
|
|
12
|
+
if (this.doesLegendInTopBy2d(legendPosition, chartNotation))
|
|
13
|
+
return `${initialLabelClass} ${initialLabelClass + "-nowrap"}`;
|
|
14
|
+
return initialLabelClass;
|
|
15
|
+
}
|
|
16
|
+
getItemClasses(itemsDirection) {
|
|
17
|
+
return itemsDirection === "column" ? "legend-item-row" : "legend-item-inline";
|
|
18
|
+
}
|
|
19
|
+
getLegendItemsDirection(legendPosition) {
|
|
20
|
+
if (legendPosition === "right" || legendPosition === "left")
|
|
21
|
+
return "column";
|
|
22
|
+
return "row";
|
|
23
|
+
}
|
|
24
|
+
doesLegendInTopBy2d(legendPosition, chartNotation) {
|
|
25
|
+
return (legendPosition === "top" || legendPosition === "bottom") && chartNotation === "2d";
|
|
26
|
+
}
|
|
26
27
|
}
|
|
@@ -1,30 +1,21 @@
|
|
|
1
1
|
import { BaseType, Selection } from "d3-selection";
|
|
2
2
|
import { ChartLegendModel } from "../../../model/model";
|
|
3
3
|
interface MarkerCreationOptions extends ChartLegendModel {
|
|
4
|
-
|
|
4
|
+
color: string;
|
|
5
5
|
}
|
|
6
6
|
declare type MarkerParentSelection = Selection<BaseType, any, BaseType, any>;
|
|
7
7
|
export declare class LegendMarkerCreator {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
options: MarkerCreationOptions
|
|
11
|
-
): Selection<BaseType, ChartLegendModel, BaseType, unknown>;
|
|
12
|
-
updateColorForItem(selection: MarkerParentSelection, options: MarkerCreationOptions): void;
|
|
8
|
+
create(selection: MarkerParentSelection, options: MarkerCreationOptions): Selection<BaseType, ChartLegendModel, BaseType, unknown>;
|
|
9
|
+
updateColorForItem(selection: MarkerParentSelection, options: MarkerCreationOptions): void;
|
|
13
10
|
}
|
|
14
11
|
export interface MarkerCreator {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
color: string
|
|
18
|
-
): Selection<BaseType, ChartLegendModel, BaseType, unknown>;
|
|
19
|
-
updateColors(selection: MarkerParentSelection, color: string): void;
|
|
12
|
+
renderMarker(selection: MarkerParentSelection, color: string): Selection<BaseType, ChartLegendModel, BaseType, unknown>;
|
|
13
|
+
updateColors(selection: MarkerParentSelection, color: string): void;
|
|
20
14
|
}
|
|
21
15
|
interface MakerCreatorCustomOptions {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
default?: {
|
|
17
|
+
cssClass: string;
|
|
18
|
+
};
|
|
25
19
|
}
|
|
26
|
-
export declare function getMarkerCreator(
|
|
27
|
-
options: ChartLegendModel,
|
|
28
|
-
customOptions?: MakerCreatorCustomOptions
|
|
29
|
-
): MarkerCreator;
|
|
20
|
+
export declare function getMarkerCreator(options: ChartLegendModel, customOptions?: MakerCreatorCustomOptions): MarkerCreator;
|
|
30
21
|
export {};
|
|
@@ -3,93 +3,90 @@ import { HatchPatternDef } from "../../block/defs/hatchPattern";
|
|
|
3
3
|
import { applyLineDash } from "../../twoDimensionalNotation/line/lineHelper";
|
|
4
4
|
import { getClipPathValue } from "../../../engine/twoDimensionalNotation/bar/barHelper";
|
|
5
5
|
export class LegendMarkerCreator {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
create(selection, options) {
|
|
7
|
+
const creator = getMarkerCreator(options);
|
|
8
|
+
return creator.renderMarker(selection, options.color);
|
|
9
|
+
}
|
|
10
|
+
updateColorForItem(selection, options) {
|
|
11
|
+
const creator = getMarkerCreator(options);
|
|
12
|
+
creator.updateColors(selection, options.color);
|
|
13
|
+
}
|
|
14
14
|
}
|
|
15
15
|
export function getMarkerCreator(options, customOptions) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
? void 0
|
|
23
|
-
: _a.cssClass
|
|
24
|
-
);
|
|
16
|
+
var _a;
|
|
17
|
+
if (options.markerShape === "bar")
|
|
18
|
+
return new BarMarkerCreator(options.barViewOptions);
|
|
19
|
+
if (options.markerShape === "line")
|
|
20
|
+
return new LineMarkerCreator(options.lineViewOptions);
|
|
21
|
+
return new DefaultMarkerCreator((_a = customOptions === null || customOptions === void 0 ? void 0 : customOptions.default) === null || _a === void 0 ? void 0 : _a.cssClass);
|
|
25
22
|
}
|
|
26
23
|
class DefaultMarkerCreator {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
constructor(cssClass = Legend.markerCircle) {
|
|
25
|
+
this.cssClass = cssClass;
|
|
26
|
+
}
|
|
27
|
+
renderMarker(selection, color) {
|
|
28
|
+
return selection.append("span").style("background-color", color).classed(this.cssClass, true);
|
|
29
|
+
}
|
|
30
|
+
updateColors(selection, color) {
|
|
31
|
+
selection.select(`.${this.cssClass}`).style("background-color", color);
|
|
32
|
+
}
|
|
36
33
|
}
|
|
37
34
|
class SvgMarkerCreator {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
renderSvg(selection) {
|
|
36
|
+
return selection
|
|
37
|
+
.append("svg")
|
|
38
|
+
.style("display", "inline-block")
|
|
39
|
+
.style("height", "8px")
|
|
40
|
+
.classed(Legend.markerClass, true);
|
|
41
|
+
}
|
|
45
42
|
}
|
|
46
43
|
class BarMarkerCreator extends SvgMarkerCreator {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
44
|
+
constructor(options) {
|
|
45
|
+
super();
|
|
46
|
+
this.options = options;
|
|
47
|
+
}
|
|
48
|
+
renderMarker(selection, color) {
|
|
49
|
+
const svg = this.renderSvg(selection).style("width", this.options.width);
|
|
50
|
+
const bars = svg
|
|
51
|
+
.append("rect")
|
|
52
|
+
.attr("x", 0)
|
|
53
|
+
.attr("y", 0)
|
|
54
|
+
.attr("height", this.options.width)
|
|
55
|
+
.attr("width", this.options.width)
|
|
56
|
+
.style("fill", color)
|
|
57
|
+
.style("clip-path", getClipPathValue(this.options.borderRadius));
|
|
58
|
+
if (this.options.hatch.on) {
|
|
59
|
+
bars.style("mask", HatchPatternDef.getMaskValue());
|
|
60
|
+
}
|
|
61
|
+
return bars;
|
|
62
|
+
}
|
|
63
|
+
updateColors(selection, color) {
|
|
64
|
+
selection.select("svg rect").style("fill", color);
|
|
65
|
+
}
|
|
69
66
|
}
|
|
70
67
|
class LineMarkerCreator extends SvgMarkerCreator {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
68
|
+
constructor(options) {
|
|
69
|
+
super();
|
|
70
|
+
this.options = options;
|
|
71
|
+
}
|
|
72
|
+
renderMarker(selection, color) {
|
|
73
|
+
const svg = this.renderSvg(selection).style("width", this.options.length);
|
|
74
|
+
const line = svg
|
|
75
|
+
.append("line")
|
|
76
|
+
.style("stroke", "red")
|
|
77
|
+
.classed("line", true)
|
|
78
|
+
.attr("x1", 0)
|
|
79
|
+
.attr("x2", this.options.length)
|
|
80
|
+
.attr("y1", 5)
|
|
81
|
+
.attr("y2", 5)
|
|
82
|
+
.style("stroke", color)
|
|
83
|
+
.style("stroke-width", this.options.strokeWidth);
|
|
84
|
+
if (this.options.dashedStyles.on) {
|
|
85
|
+
applyLineDash(line, this.options.dashedStyles.dashSize, this.options.dashedStyles.gapSize);
|
|
86
|
+
}
|
|
87
|
+
return line;
|
|
88
|
+
}
|
|
89
|
+
updateColors(selection, color) {
|
|
90
|
+
selection.select("svg line").style("stroke", color);
|
|
91
|
+
}
|
|
95
92
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
declare type SizePx = number;
|
|
2
2
|
interface WidthCalculatorConfig {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
wrapper: LegendWrapperConfig;
|
|
4
|
+
items: LegendItemConfig[];
|
|
5
5
|
}
|
|
6
6
|
export declare function getNewLegendItemWidths(config: WidthCalculatorConfig): SizePx[];
|
|
7
7
|
interface LegendWrapperConfig {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
maxRowsAmount: number;
|
|
9
|
+
width: SizePx;
|
|
10
10
|
}
|
|
11
11
|
export interface LegendItemConfig {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
marginLeft: SizePx;
|
|
13
|
+
marginRight: SizePx;
|
|
14
|
+
width: SizePx;
|
|
15
15
|
}
|
|
16
16
|
export {};
|