mdt-charts 1.29.0 → 1.29.1
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 +167 -177
- 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 +169 -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 +284 -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 +1 -1
- 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
|
@@ -1,138 +1,134 @@
|
|
|
1
1
|
export function getNewLegendItemWidths(config) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const wrapper = new LegendWrapper(config.wrapper);
|
|
3
|
+
const collection = new LegendItemCollection(config.items.map((i) => new LegendItem(i)));
|
|
4
|
+
return getNewWidths(collection, wrapper);
|
|
5
5
|
}
|
|
6
6
|
function getNewWidths(collection, wrapper) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
let extra = collection.getTotalWidth() - wrapper.getMaxWidth();
|
|
8
|
+
if (extra <= 0) {
|
|
9
|
+
return fixWidthsByLinePos(collection, wrapper);
|
|
10
|
+
}
|
|
11
|
+
const avgWidth = (wrapper.getMaxWidth() - collection.getTotalMarginSizes()) / collection.getItemsAmount();
|
|
12
|
+
const biggerThanAvg = collection.getItemsWithWidthBiggerThan(avgWidth);
|
|
13
|
+
let avgExtra = extra / biggerThanAvg.length;
|
|
14
|
+
biggerThanAvg.forEach((item, index) => {
|
|
15
|
+
const avgDiff = item.getCurrentWidth() - avgWidth;
|
|
16
|
+
const decreaseBy = index === biggerThanAvg.length - 1 ? extra : avgDiff < avgExtra ? avgDiff : avgExtra;
|
|
17
|
+
item.decreaseBy(decreaseBy);
|
|
18
|
+
extra -= decreaseBy;
|
|
19
|
+
avgExtra = extra / (biggerThanAvg.length - index - 1);
|
|
20
|
+
});
|
|
21
|
+
return fixWidthsByLinePos(collection, wrapper);
|
|
22
22
|
}
|
|
23
23
|
function fixWidthsByLinePos(collection, wrapper) {
|
|
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
|
-
return result;
|
|
24
|
+
const byRows = [];
|
|
25
|
+
let currentRow = [];
|
|
26
|
+
collection.items.forEach((item, i) => {
|
|
27
|
+
const currentRowSum = currentRow.reduce((acc, i) => acc + i.getCurrentTotalWidth(), 0);
|
|
28
|
+
if (currentRowSum + item.getCurrentTotalWidth() <= wrapper.getWidthOfOneLine()) {
|
|
29
|
+
currentRow.push(item);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
byRows.push(new LegendItemCollection(currentRow));
|
|
33
|
+
currentRow = [item];
|
|
34
|
+
}
|
|
35
|
+
if (i === collection.items.length - 1)
|
|
36
|
+
byRows.push(new LegendItemCollection(currentRow));
|
|
37
|
+
});
|
|
38
|
+
if (byRows.length <= wrapper.getMaxRowsCount())
|
|
39
|
+
return collection.getActualWidths();
|
|
40
|
+
const result = [];
|
|
41
|
+
for (let i = 0; i < byRows.length - 1; i++) {
|
|
42
|
+
const top = byRows[i];
|
|
43
|
+
const bottom = byRows[i + 1];
|
|
44
|
+
const topFreeSpace = wrapper.getWidthOfOneLine() - top.getTotalWidth();
|
|
45
|
+
const firstOfBottom = bottom.getFirstItem();
|
|
46
|
+
if (i === byRows.length - 2)
|
|
47
|
+
top.pushMany(bottom.shiftAll());
|
|
48
|
+
else if (topFreeSpace / firstOfBottom.getCurrentTotalWidth() > 0.5) {
|
|
49
|
+
const fromBottom = bottom.shift();
|
|
50
|
+
top.push(fromBottom);
|
|
51
|
+
}
|
|
52
|
+
result.push(...getNewWidths(top, new LegendWrapper({ maxRowsAmount: 1, width: wrapper.getWidthOfOneLine() })));
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
59
55
|
}
|
|
60
56
|
class LegendWrapper {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
57
|
+
constructor(config) {
|
|
58
|
+
this.config = config;
|
|
59
|
+
}
|
|
60
|
+
getMaxWidth() {
|
|
61
|
+
return this.config.width * this.config.maxRowsAmount;
|
|
62
|
+
}
|
|
63
|
+
getWidthOfOneLine() {
|
|
64
|
+
return this.config.width;
|
|
65
|
+
}
|
|
66
|
+
getMaxRowsCount() {
|
|
67
|
+
return this.config.maxRowsAmount;
|
|
68
|
+
}
|
|
73
69
|
}
|
|
74
70
|
class LegendItem {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
71
|
+
constructor(config) {
|
|
72
|
+
this.config = config;
|
|
73
|
+
this.width = this.config.width;
|
|
74
|
+
}
|
|
75
|
+
getCurrentTotalWidth() {
|
|
76
|
+
return this.width + this.getTotalMarginSize();
|
|
77
|
+
}
|
|
78
|
+
getWidthWithoutRightMargin() {
|
|
79
|
+
return this.width + this.config.marginLeft;
|
|
80
|
+
}
|
|
81
|
+
decreaseBy(by) {
|
|
82
|
+
this.width -= by;
|
|
83
|
+
}
|
|
84
|
+
getCurrentWidth() {
|
|
85
|
+
return Math.round(this.width * 100) / 100;
|
|
86
|
+
}
|
|
87
|
+
getTotalMarginSize() {
|
|
88
|
+
return this.config.marginLeft + this.config.marginRight;
|
|
89
|
+
}
|
|
90
|
+
resetWidthToOriginal() {
|
|
91
|
+
this.width = this.config.width;
|
|
92
|
+
}
|
|
97
93
|
}
|
|
98
94
|
class LegendItemCollection {
|
|
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
|
-
|
|
95
|
+
constructor(items) {
|
|
96
|
+
this.items = items;
|
|
97
|
+
}
|
|
98
|
+
getTotalWidth() {
|
|
99
|
+
return this.items.reduce((acc, item) => acc + item.getCurrentTotalWidth(), 0);
|
|
100
|
+
}
|
|
101
|
+
getActualWidths() {
|
|
102
|
+
return this.items.map((item) => item.getCurrentWidth());
|
|
103
|
+
}
|
|
104
|
+
getTotalMarginSizes() {
|
|
105
|
+
return this.items.reduce((acc, item) => acc + item.getTotalMarginSize(), 0);
|
|
106
|
+
}
|
|
107
|
+
getItemsAmount() {
|
|
108
|
+
return this.items.length;
|
|
109
|
+
}
|
|
110
|
+
getItemsWithWidthBiggerThan(thanWidth) {
|
|
111
|
+
return this.items
|
|
112
|
+
.filter((item) => item.getCurrentWidth() > thanWidth)
|
|
113
|
+
.sort((a, b) => a.getCurrentWidth() - b.getCurrentWidth());
|
|
114
|
+
}
|
|
115
|
+
getFirstItem() {
|
|
116
|
+
return this.items[0];
|
|
117
|
+
}
|
|
118
|
+
shift() {
|
|
119
|
+
return this.items.shift();
|
|
120
|
+
}
|
|
121
|
+
shiftAll() {
|
|
122
|
+
return this.items.splice(0, this.items.length);
|
|
123
|
+
}
|
|
124
|
+
push(item) {
|
|
125
|
+
this.items.push(item);
|
|
126
|
+
}
|
|
127
|
+
pushMany(items) {
|
|
128
|
+
this.items.push(...items);
|
|
129
|
+
}
|
|
130
|
+
resetItemsToOriginalWidth() {
|
|
131
|
+
this.items.forEach((item) => item.resetWidthToOriginal());
|
|
132
|
+
return this;
|
|
133
|
+
}
|
|
138
134
|
}
|
|
@@ -4,51 +4,24 @@ import { BlockMargin, MarkersOptions, Orient, TwoDimensionalChartModel } from ".
|
|
|
4
4
|
import { Block } from "../../block/block";
|
|
5
5
|
import { Scales } from "../scale/scale";
|
|
6
6
|
export interface DotAttrs {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
cx: (data: MdtChartsDataRow) => number;
|
|
8
|
+
cy: (data: MdtChartsDataRow) => number;
|
|
9
9
|
}
|
|
10
10
|
interface MarkDotDataItem extends MdtChartsDataRow {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
$mdtChartsMetadata: {
|
|
12
|
+
valueFieldName: string;
|
|
13
|
+
};
|
|
14
14
|
}
|
|
15
15
|
export declare class MarkDot {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
valueFieldName: string,
|
|
27
|
-
chart: TwoDimensionalChartModel
|
|
28
|
-
): void;
|
|
29
|
-
static update(
|
|
30
|
-
block: Block,
|
|
31
|
-
newData: MdtChartsDataRow[],
|
|
32
|
-
keyAxisOrient: Orient,
|
|
33
|
-
scales: Scales,
|
|
34
|
-
margin: BlockMargin,
|
|
35
|
-
keyFieldName: string,
|
|
36
|
-
vfIndex: number,
|
|
37
|
-
valueFieldName: string,
|
|
38
|
-
chart: TwoDimensionalChartModel
|
|
39
|
-
): void;
|
|
40
|
-
static updateColors(block: Block, chart: TwoDimensionalChartModel, valueFieldIndex: number): void;
|
|
41
|
-
static getMarkDotForChart(
|
|
42
|
-
block: Block,
|
|
43
|
-
chartCssClasses: string[]
|
|
44
|
-
): Selection<BaseType, MarkDotDataItem, BaseType, unknown>;
|
|
45
|
-
static tryMakeMarkDotVisible(
|
|
46
|
-
elems: Selection<BaseType, MdtChartsDataRow, BaseType, unknown>,
|
|
47
|
-
markersOptions: MarkersOptions,
|
|
48
|
-
turnOnIfCan: boolean
|
|
49
|
-
): void;
|
|
50
|
-
private static toggleMarkDotVisible;
|
|
51
|
-
private static setClassesAndStyle;
|
|
52
|
-
private static setAttrs;
|
|
16
|
+
static readonly markerDotClass: string;
|
|
17
|
+
static readonly hiddenDotClass: string;
|
|
18
|
+
static render(block: Block, data: MdtChartsDataRow[], keyAxisOrient: Orient, scales: Scales, margin: BlockMargin, keyFieldName: string, vfIndex: number, valueFieldName: string, chart: TwoDimensionalChartModel): void;
|
|
19
|
+
static update(block: Block, newData: MdtChartsDataRow[], keyAxisOrient: Orient, scales: Scales, margin: BlockMargin, keyFieldName: string, vfIndex: number, valueFieldName: string, chart: TwoDimensionalChartModel): void;
|
|
20
|
+
static updateColors(block: Block, chart: TwoDimensionalChartModel, valueFieldIndex: number): void;
|
|
21
|
+
static getMarkDotForChart(block: Block, chartCssClasses: string[]): Selection<BaseType, MarkDotDataItem, BaseType, unknown>;
|
|
22
|
+
static tryMakeMarkDotVisible(elems: Selection<BaseType, MdtChartsDataRow, BaseType, unknown>, markersOptions: MarkersOptions, turnOnIfCan: boolean): void;
|
|
23
|
+
private static toggleMarkDotVisible;
|
|
24
|
+
private static setClassesAndStyle;
|
|
25
|
+
private static setAttrs;
|
|
53
26
|
}
|
|
54
27
|
export {};
|
|
@@ -6,107 +6,76 @@ import { NamesHelper } from "../../helpers/namesHelper";
|
|
|
6
6
|
import { MarkDotHelper } from "./markDotsHelper";
|
|
7
7
|
select.prototype.transition = transition;
|
|
8
8
|
export class MarkDot {
|
|
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
|
-
return block.getSvg().selectAll(`.${MarkDot.markerDotClass}${Helper.getCssClassesLine(chartCssClasses)}`);
|
|
80
|
-
}
|
|
81
|
-
static tryMakeMarkDotVisible(elems, markersOptions, turnOnIfCan) {
|
|
82
|
-
elems.each(function (datum) {
|
|
83
|
-
var _a;
|
|
84
|
-
if (
|
|
85
|
-
!markersOptions.show({
|
|
86
|
-
row: datum,
|
|
87
|
-
valueFieldName:
|
|
88
|
-
(_a = datum.$mdtChartsMetadata) === null || _a === void 0 ? void 0 : _a.valueFieldName
|
|
89
|
-
})
|
|
90
|
-
)
|
|
91
|
-
MarkDot.toggleMarkDotVisible(select(this), turnOnIfCan);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
static toggleMarkDotVisible(markDots, isHighlight) {
|
|
95
|
-
markDots.classed(MarkDot.hiddenDotClass, !isHighlight);
|
|
96
|
-
}
|
|
97
|
-
static setClassesAndStyle(dots, cssClasses, vfIndex, elementColors) {
|
|
98
|
-
DomHelper.setCssClasses(dots, Helper.getCssClassesWithElementIndex(cssClasses, vfIndex));
|
|
99
|
-
DomHelper.setChartElementColor(dots, elementColors, vfIndex, "stroke");
|
|
100
|
-
}
|
|
101
|
-
static setAttrs(block, dots, attrs, styles) {
|
|
102
|
-
dots.attr("class", this.markerDotClass)
|
|
103
|
-
.attr("cx", (d) => attrs.cx(d))
|
|
104
|
-
.attr("cy", (d) => attrs.cy(d))
|
|
105
|
-
.attr("r", styles.normal.size.radius)
|
|
106
|
-
.style("stroke-width", styles.normal.size.borderSize)
|
|
107
|
-
.style("fill", "white")
|
|
108
|
-
.style("clip-path", `url(#${block.svg.getClipPathId()})`);
|
|
109
|
-
}
|
|
9
|
+
static render(block, data, keyAxisOrient, scales, margin, keyFieldName, vfIndex, valueFieldName, chart) {
|
|
10
|
+
const dotsWrapper = block.svg
|
|
11
|
+
.getChartGroup(chart.index)
|
|
12
|
+
.selectAll(`.${this.markerDotClass}${Helper.getCssClassesLine(chart.cssClasses)}.chart-index-${vfIndex}`)
|
|
13
|
+
.data(data.map((row) => (Object.assign(Object.assign({}, row), { $mdtChartsMetadata: { valueFieldName } }))))
|
|
14
|
+
.enter();
|
|
15
|
+
const attrs = MarkDotHelper.getDotAttrs(keyAxisOrient, scales, margin, keyFieldName, valueFieldName, chart.isSegmented);
|
|
16
|
+
const dots = dotsWrapper.append("circle");
|
|
17
|
+
this.setAttrs(block, dots, attrs, chart.markersOptions.styles);
|
|
18
|
+
this.setClassesAndStyle(dots, chart.cssClasses, vfIndex, chart.style.elementColors);
|
|
19
|
+
MarkDot.tryMakeMarkDotVisible(dots, chart.markersOptions, false);
|
|
20
|
+
}
|
|
21
|
+
static update(block, newData, keyAxisOrient, scales, margin, keyFieldName, vfIndex, valueFieldName, chart) {
|
|
22
|
+
const dots = block.svg
|
|
23
|
+
.getChartGroup(chart.index)
|
|
24
|
+
.selectAll(`.${this.markerDotClass}${Helper.getCssClassesLine(chart.cssClasses)}.chart-element-${vfIndex}`)
|
|
25
|
+
.data(newData.map((row) => (Object.assign(Object.assign({}, row), { $mdtChartsMetadata: { valueFieldName } }))));
|
|
26
|
+
dots.exit().remove();
|
|
27
|
+
dots.each(function (datum) {
|
|
28
|
+
if (chart.markersOptions.show({ row: datum, valueFieldName })) {
|
|
29
|
+
MarkDot.toggleMarkDotVisible(select(this), true);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const attrs = MarkDotHelper.getDotAttrs(keyAxisOrient, scales, margin, keyFieldName, valueFieldName, chart.isSegmented);
|
|
33
|
+
const newDots = dots.enter().append("circle");
|
|
34
|
+
this.setAttrs(block, newDots, attrs, chart.markersOptions.styles);
|
|
35
|
+
this.setClassesAndStyle(newDots, chart.cssClasses, vfIndex, chart.style.elementColors);
|
|
36
|
+
MarkDot.tryMakeMarkDotVisible(newDots, chart.markersOptions, false);
|
|
37
|
+
const animationName = "data-updating";
|
|
38
|
+
dots.interrupt(animationName)
|
|
39
|
+
.transition(animationName)
|
|
40
|
+
.duration(block.transitionManager.durations.chartUpdate)
|
|
41
|
+
.attr("cx", (d) => attrs.cx(d))
|
|
42
|
+
.attr("cy", (d) => attrs.cy(d));
|
|
43
|
+
}
|
|
44
|
+
static updateColors(block, chart, valueFieldIndex) {
|
|
45
|
+
const dots = block.svg
|
|
46
|
+
.getChartGroup(chart.index)
|
|
47
|
+
.selectAll(`.${this.markerDotClass}${Helper.getCssClassesLine(chart.cssClasses)}.chart-element-${valueFieldIndex}`);
|
|
48
|
+
DomHelper.setChartElementColor(dots, chart.style.elementColors, valueFieldIndex, "stroke");
|
|
49
|
+
}
|
|
50
|
+
static getMarkDotForChart(block, chartCssClasses) {
|
|
51
|
+
return block.getSvg().selectAll(`.${MarkDot.markerDotClass}${Helper.getCssClassesLine(chartCssClasses)}`);
|
|
52
|
+
}
|
|
53
|
+
static tryMakeMarkDotVisible(elems, markersOptions, turnOnIfCan) {
|
|
54
|
+
elems.each(function (datum) {
|
|
55
|
+
var _a;
|
|
56
|
+
if (!markersOptions.show({
|
|
57
|
+
row: datum,
|
|
58
|
+
valueFieldName: (_a = datum.$mdtChartsMetadata) === null || _a === void 0 ? void 0 : _a.valueFieldName
|
|
59
|
+
}))
|
|
60
|
+
MarkDot.toggleMarkDotVisible(select(this), turnOnIfCan);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
static toggleMarkDotVisible(markDots, isHighlight) {
|
|
64
|
+
markDots.classed(MarkDot.hiddenDotClass, !isHighlight);
|
|
65
|
+
}
|
|
66
|
+
static setClassesAndStyle(dots, cssClasses, vfIndex, elementColors) {
|
|
67
|
+
DomHelper.setCssClasses(dots, Helper.getCssClassesWithElementIndex(cssClasses, vfIndex));
|
|
68
|
+
DomHelper.setChartElementColor(dots, elementColors, vfIndex, "stroke");
|
|
69
|
+
}
|
|
70
|
+
static setAttrs(block, dots, attrs, styles) {
|
|
71
|
+
dots.attr("class", this.markerDotClass)
|
|
72
|
+
.attr("cx", (d) => attrs.cx(d))
|
|
73
|
+
.attr("cy", (d) => attrs.cy(d))
|
|
74
|
+
.attr("r", styles.normal.size.radius)
|
|
75
|
+
.style("stroke-width", styles.normal.size.borderSize)
|
|
76
|
+
.style("fill", "white")
|
|
77
|
+
.style("clip-path", `url(#${block.svg.getClipPathId()})`);
|
|
78
|
+
}
|
|
110
79
|
}
|
|
111
80
|
MarkDot.markerDotClass = NamesHelper.getClassName("dot");
|
|
112
81
|
MarkDot.hiddenDotClass = NamesHelper.getClassName("dot-hidden");
|
|
@@ -2,12 +2,5 @@ import { BlockMargin, Orient } from "../../../model/model";
|
|
|
2
2
|
import { Scales } from "../scale/scale";
|
|
3
3
|
import { DotAttrs } from "./markDot";
|
|
4
4
|
export declare class MarkDotHelper {
|
|
5
|
-
|
|
6
|
-
keyAxisOrient: Orient,
|
|
7
|
-
scales: Scales,
|
|
8
|
-
margin: BlockMargin,
|
|
9
|
-
keyField: string,
|
|
10
|
-
valueField: string,
|
|
11
|
-
isSegmented: boolean
|
|
12
|
-
): DotAttrs;
|
|
5
|
+
static getDotAttrs(keyAxisOrient: Orient, scales: Scales, margin: BlockMargin, keyField: string, valueField: string, isSegmented: boolean): DotAttrs;
|
|
13
6
|
}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { Helper } from "../../helpers/helper";
|
|
2
2
|
import { Scale } from "../scale/scale";
|
|
3
3
|
export class MarkDotHelper {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
4
|
+
static getDotAttrs(keyAxisOrient, scales, margin, keyField, valueField, isSegmented) {
|
|
5
|
+
const attrs = { cx: null, cy: null };
|
|
6
|
+
if (keyAxisOrient === "left" || keyAxisOrient === "right") {
|
|
7
|
+
attrs.cx = (d) => scales.value(d[valueField]) + margin.left;
|
|
8
|
+
attrs.cy = (d) => Scale.getScaledValue(scales.key, Helper.getKeyFieldValue(d, keyField, isSegmented)) + margin.top;
|
|
9
|
+
}
|
|
10
|
+
else if (keyAxisOrient === "bottom" || keyAxisOrient === "top") {
|
|
11
|
+
attrs.cx = (d) => Scale.getScaledValue(scales.key, Helper.getKeyFieldValue(d, keyField, isSegmented)) + margin.left;
|
|
12
|
+
attrs.cy = (d) => scales.value(d[valueField]) + margin.top;
|
|
13
|
+
}
|
|
14
|
+
return attrs;
|
|
15
|
+
}
|
|
17
16
|
}
|
|
@@ -1,28 +1,10 @@
|
|
|
1
|
+
import { RecordOverflowAlertModel } from "../../../model/model";
|
|
1
2
|
import { Block } from "../../block/block";
|
|
2
|
-
export interface RecordOverflowAlertOptions {
|
|
3
|
-
hidedRecordsAmount: number;
|
|
4
|
-
text: RecordOverflowAlertText;
|
|
5
|
-
positionAttrs: AlertBlockPositionAttrs;
|
|
6
|
-
}
|
|
7
|
-
export interface RecordOverflowAlertText {
|
|
8
|
-
one: string;
|
|
9
|
-
twoToFour: string;
|
|
10
|
-
tenToTwenty: string;
|
|
11
|
-
other: string;
|
|
12
|
-
}
|
|
13
|
-
export interface AlertBlockPositionAttrs {
|
|
14
|
-
top?: string;
|
|
15
|
-
bottom?: string;
|
|
16
|
-
right?: string;
|
|
17
|
-
left?: string;
|
|
18
|
-
}
|
|
19
3
|
declare class RecordOverflowAlertCoreClass {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
private getWordTextEndingByAmount;
|
|
25
|
-
private setAlertPosition;
|
|
4
|
+
private readonly blockClass;
|
|
5
|
+
render(block: Block, options: RecordOverflowAlertModel): void;
|
|
6
|
+
update(block: Block, options: RecordOverflowAlertModel): void;
|
|
7
|
+
private setAlertPosition;
|
|
26
8
|
}
|
|
27
9
|
export declare const RecordOverflowAlertCore: RecordOverflowAlertCoreClass;
|
|
28
10
|
export {};
|