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
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
export class AxisDomHelper {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
static updateAxisElement(axisGenerator, axisElement, translate, transitionDuration = 0) {
|
|
3
|
+
return new Promise((resolve) => {
|
|
4
|
+
let axisHandler = axisElement;
|
|
5
|
+
if (transitionDuration > 0) {
|
|
6
|
+
axisHandler = axisHandler
|
|
7
|
+
.interrupt()
|
|
8
|
+
.transition()
|
|
9
|
+
.duration(transitionDuration)
|
|
10
|
+
.on("end", () => resolve("updated"));
|
|
11
|
+
}
|
|
12
|
+
axisHandler
|
|
13
|
+
.attr("transform", `translate(${translate.translateX}, ${translate.translateY})`)
|
|
14
|
+
.call(axisGenerator.bind(this));
|
|
15
|
+
if (transitionDuration <= 0)
|
|
16
|
+
resolve("updated");
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
static rotateElementsBack(axisElement) {
|
|
20
|
+
axisElement.selectAll(".tick text").attr("transform", null).attr("text-anchor", "middle").attr("x", null);
|
|
21
|
+
}
|
|
21
22
|
}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { AxisScale, Axis as IAxis } from "d3-axis";
|
|
2
2
|
import { AxisLabelModel, AxisModelOptions, Orient, ScaleValueModel } from "../../../model/model";
|
|
3
3
|
export declare class AxisHelper {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
): void;
|
|
10
|
-
static getBaseAxisGenerator(axisOptions: AxisModelOptions, scale: AxisScale<any>): IAxis<any>;
|
|
11
|
-
private static removeTicks;
|
|
12
|
-
private static setNumTickFormat;
|
|
4
|
+
static getAxisByOrient(orient: Orient, scale: AxisScale<any>): IAxis<any>;
|
|
5
|
+
static setValueAxisLabelsSettings(axisGenerator: IAxis<any>, scaleOptions: ScaleValueModel, labelsOptions: AxisLabelModel): void;
|
|
6
|
+
static getBaseAxisGenerator(axisOptions: AxisModelOptions, scale: AxisScale<any>): IAxis<any>;
|
|
7
|
+
private static removeTicks;
|
|
8
|
+
private static setNumTickFormat;
|
|
13
9
|
}
|
|
@@ -2,32 +2,37 @@ import { axisTop, axisBottom, axisLeft, axisRight } from "d3-axis";
|
|
|
2
2
|
import { format } from "d3-format";
|
|
3
3
|
import { AxisLabelHelper } from "./axisLabelDomHelper";
|
|
4
4
|
export class AxisHelper {
|
|
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
|
-
|
|
5
|
+
static getAxisByOrient(orient, scale) {
|
|
6
|
+
if (orient === "top")
|
|
7
|
+
return axisTop(scale);
|
|
8
|
+
if (orient === "bottom")
|
|
9
|
+
return axisBottom(scale);
|
|
10
|
+
if (orient === "left")
|
|
11
|
+
return axisLeft(scale);
|
|
12
|
+
if (orient === "right")
|
|
13
|
+
return axisRight(scale);
|
|
14
|
+
}
|
|
15
|
+
static setValueAxisLabelsSettings(axisGenerator, scaleOptions, labelsOptions) {
|
|
16
|
+
if (labelsOptions.tickAmountSettings.policy.type === "amount")
|
|
17
|
+
axisGenerator.ticks(labelsOptions.tickAmountSettings.policy.amount);
|
|
18
|
+
if (labelsOptions.tickAmountSettings.policy.type === "constant")
|
|
19
|
+
axisGenerator.tickValues(labelsOptions.tickAmountSettings.policy.values);
|
|
20
|
+
if (scaleOptions.type === "linear") {
|
|
21
|
+
this.setNumTickFormat(axisGenerator, scaleOptions.formatter);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
static getBaseAxisGenerator(axisOptions, scale) {
|
|
25
|
+
const axisGenerator = AxisHelper.getAxisByOrient(axisOptions.orient, scale);
|
|
26
|
+
if (!axisOptions.ticks.flag)
|
|
27
|
+
this.removeTicks(axisGenerator);
|
|
28
|
+
AxisLabelHelper.setAxisLabelPaddingByOrient(axisGenerator, axisOptions);
|
|
29
|
+
return axisGenerator;
|
|
30
|
+
}
|
|
31
|
+
static removeTicks(axis) {
|
|
32
|
+
axis.tickSize(0);
|
|
33
|
+
}
|
|
34
|
+
static setNumTickFormat(axis, formatter) {
|
|
35
|
+
const defaultFormatter = format("~s");
|
|
36
|
+
axis.tickFormat(formatter !== null && formatter !== void 0 ? formatter : defaultFormatter);
|
|
37
|
+
}
|
|
33
38
|
}
|
|
@@ -4,30 +4,15 @@ import { AxisModelOptions, Orient, ScaleKeyModel, ScaleValueModel } from "../../
|
|
|
4
4
|
import { Block } from "../../block/block";
|
|
5
5
|
import { Size } from "../../../config/config";
|
|
6
6
|
export declare class AxisLabelHelper {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
static alignLabelsInKeyAxis(
|
|
19
|
-
axisOptions: AxisModelOptions,
|
|
20
|
-
axisElement: Selection<SVGGElement, unknown, HTMLElement, any>
|
|
21
|
-
): void;
|
|
22
|
-
private static alignLabelsInVerticalAxis;
|
|
23
|
-
static alignHorizontalAxisLastLabel(
|
|
24
|
-
block: Block,
|
|
25
|
-
maxLabelSize: number,
|
|
26
|
-
axisOptions: AxisModelOptions,
|
|
27
|
-
blockSize: Size,
|
|
28
|
-
crop: boolean
|
|
29
|
-
): void;
|
|
30
|
-
private static cropAndAlignExtremeLabels;
|
|
31
|
-
private static getTranslateNumber;
|
|
32
|
-
static wrapHandler(textBlocks: Selection<SVGGElement, unknown, BaseType, any>, maxWidth: number): void;
|
|
7
|
+
static setTitles(axisElement: Selection<SVGGElement, unknown, BaseType, any>, axisOptions: AxisModelOptions): void;
|
|
8
|
+
static setAxisLabelPaddingByOrient(axis: IAxis<any>, axisOptions: AxisModelOptions): void;
|
|
9
|
+
static rotateLabels(axisElement: Selection<SVGGElement, unknown, HTMLElement, any>, keyAxisOrient: Orient): void;
|
|
10
|
+
static cropLabels(block: Block, scale: AxisScale<any>, scaleOptions: ScaleKeyModel | ScaleValueModel, axisOptions: AxisModelOptions, blockSize: Size): void;
|
|
11
|
+
static hideLabels(axisElement: Selection<SVGGElement, unknown, BaseType, unknown>): void;
|
|
12
|
+
static alignLabelsInKeyAxis(axisOptions: AxisModelOptions, axisElement: Selection<SVGGElement, unknown, HTMLElement, any>): void;
|
|
13
|
+
private static alignLabelsInVerticalAxis;
|
|
14
|
+
static alignHorizontalAxisLastLabel(block: Block, maxLabelSize: number, axisOptions: AxisModelOptions, blockSize: Size, crop: boolean): void;
|
|
15
|
+
private static cropAndAlignExtremeLabels;
|
|
16
|
+
private static getTranslateNumber;
|
|
17
|
+
static wrapHandler(textBlocks: Selection<SVGGElement, unknown, BaseType, any>, maxWidth: number): void;
|
|
33
18
|
}
|
|
@@ -1,161 +1,157 @@
|
|
|
1
1
|
import { select } from "d3-selection";
|
|
2
2
|
import { DomHelper } from "../../helpers/domHelper";
|
|
3
3
|
import { Helper } from "../../helpers/helper";
|
|
4
|
-
import {
|
|
5
|
-
AXIS_HORIZONTAL_LABEL_PADDING,
|
|
6
|
-
AXIS_VERTICAL_LABEL_PADDING
|
|
7
|
-
} from "../../../model/margin/twoDim/twoDimMarginModel";
|
|
4
|
+
import { AXIS_HORIZONTAL_LABEL_PADDING, AXIS_VERTICAL_LABEL_PADDING } from "../../../model/margin/twoDim/twoDimMarginModel";
|
|
8
5
|
export class AxisLabelHelper {
|
|
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
|
-
|
|
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
|
-
}
|
|
6
|
+
static setTitles(axisElement, axisOptions) {
|
|
7
|
+
axisElement.selectAll(".tick text").each(function (d, i) {
|
|
8
|
+
const tickTitle = select(this).select("title");
|
|
9
|
+
if (tickTitle.empty())
|
|
10
|
+
select(this).append("title").text(axisOptions.browserTooltip.format(d));
|
|
11
|
+
else {
|
|
12
|
+
tickTitle.text(axisOptions.browserTooltip.format(d));
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
static setAxisLabelPaddingByOrient(axis, axisOptions) {
|
|
17
|
+
let axisLabelPadding = AXIS_HORIZONTAL_LABEL_PADDING;
|
|
18
|
+
if (axisOptions.orient === "left" || axisOptions.orient === "right")
|
|
19
|
+
axisLabelPadding = AXIS_VERTICAL_LABEL_PADDING;
|
|
20
|
+
axis.tickPadding(axisLabelPadding);
|
|
21
|
+
}
|
|
22
|
+
static rotateLabels(axisElement, keyAxisOrient) {
|
|
23
|
+
const labelBlocks = axisElement.selectAll("text");
|
|
24
|
+
labelBlocks.attr("transform", "rotate(-90)");
|
|
25
|
+
if (keyAxisOrient === "bottom") {
|
|
26
|
+
labelBlocks.attr("text-anchor", "end").attr("x", -AXIS_HORIZONTAL_LABEL_PADDING).attr("y", -4);
|
|
27
|
+
}
|
|
28
|
+
else if (keyAxisOrient === "top") {
|
|
29
|
+
labelBlocks.attr("text-anchor", "start").attr("x", AXIS_HORIZONTAL_LABEL_PADDING).attr("y", 6);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
static cropLabels(block, scale, scaleOptions, axisOptions, blockSize) {
|
|
33
|
+
var _a, _b, _c;
|
|
34
|
+
const axisTextBlocks = block
|
|
35
|
+
.getSvg()
|
|
36
|
+
.select(`.${axisOptions.cssClass}`)
|
|
37
|
+
.selectAll("text");
|
|
38
|
+
let maxLabelSize;
|
|
39
|
+
if (axisOptions.orient === "left" ||
|
|
40
|
+
axisOptions.orient === "right" ||
|
|
41
|
+
(axisOptions.type === "key" && axisOptions.labels.position === "rotated"))
|
|
42
|
+
maxLabelSize = axisOptions.labels.maxSize;
|
|
43
|
+
else
|
|
44
|
+
maxLabelSize = ((_c = (_b = (_a = scale).step) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : Infinity) - 4;
|
|
45
|
+
DomHelper.cropSvgLabels(axisTextBlocks, maxLabelSize);
|
|
46
|
+
if (axisOptions.labels.position === "straight" &&
|
|
47
|
+
(axisOptions.orient === "top" || axisOptions.orient === "bottom")) {
|
|
48
|
+
this.cropAndAlignExtremeLabels(block, maxLabelSize, axisOptions, blockSize);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
static hideLabels(axisElement) {
|
|
52
|
+
axisElement.selectAll(".tick text").style("display", "none");
|
|
53
|
+
}
|
|
54
|
+
static alignLabelsInKeyAxis(axisOptions, axisElement) {
|
|
55
|
+
if (axisOptions.orient === "left")
|
|
56
|
+
this.alignLabelsInVerticalAxis(axisElement, "start", axisOptions.labels.maxSize, true);
|
|
57
|
+
else if (axisOptions.orient === "right")
|
|
58
|
+
this.alignLabelsInVerticalAxis(axisElement, "start", axisOptions.labels.maxSize, false);
|
|
59
|
+
}
|
|
60
|
+
static alignLabelsInVerticalAxis(axisElement, anchor, maxLabelSize, changeCoordinate) {
|
|
61
|
+
const axisTextBlocks = axisElement.selectAll("text");
|
|
62
|
+
const spans = axisElement.selectAll("tspan");
|
|
63
|
+
axisTextBlocks.attr("text-anchor", anchor);
|
|
64
|
+
spans.attr("text-anchor", anchor);
|
|
65
|
+
if (changeCoordinate) {
|
|
66
|
+
axisTextBlocks.attr("x", -(maxLabelSize + AXIS_VERTICAL_LABEL_PADDING));
|
|
67
|
+
spans.attr("x", -(maxLabelSize + AXIS_VERTICAL_LABEL_PADDING));
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
spans.attr("x", AXIS_VERTICAL_LABEL_PADDING);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
static alignHorizontalAxisLastLabel(block, maxLabelSize, axisOptions, blockSize, crop) {
|
|
74
|
+
const lastTick = block
|
|
75
|
+
.getSvg()
|
|
76
|
+
.select(`.${axisOptions.cssClass}`)
|
|
77
|
+
.select(".tick:last-of-type");
|
|
78
|
+
const lastLabel = lastTick.select("text");
|
|
79
|
+
if (lastTick.empty() || lastTick.size() === 0 || lastLabel.size() === 0)
|
|
80
|
+
return;
|
|
81
|
+
const tickTranslateX = Helper.getTranslateNumbers(lastTick.attr("transform"))[0];
|
|
82
|
+
const marginRight = blockSize.width - axisOptions.translate.translateX - tickTranslateX;
|
|
83
|
+
if (tickTranslateX + lastLabel.node().getBBox().width + axisOptions.translate.translateX > blockSize.width) {
|
|
84
|
+
lastLabel.attr("text-anchor", "start");
|
|
85
|
+
lastLabel.attr("transform", `translate(${this.getTranslateNumber(maxLabelSize, lastLabel, marginRight)}, 0)`);
|
|
86
|
+
if (crop)
|
|
87
|
+
DomHelper.cropSvgLabels(lastLabel, maxLabelSize / 2 + marginRight);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
static cropAndAlignExtremeLabels(block, maxLabelSize, axisOptions, blockSize) {
|
|
91
|
+
this.alignHorizontalAxisLastLabel(block, maxLabelSize, axisOptions, blockSize, true);
|
|
92
|
+
const firstLabel = block
|
|
93
|
+
.getSvg()
|
|
94
|
+
.select(`.${axisOptions.cssClass}`)
|
|
95
|
+
.select(".tick:first-of-type")
|
|
96
|
+
.select("text");
|
|
97
|
+
if (firstLabel.empty())
|
|
98
|
+
return;
|
|
99
|
+
const axisElementTranslate = Helper.getTranslateNumbers(block.getSvg().select(`.${axisOptions.cssClass}`).attr("transform"))[0];
|
|
100
|
+
if (axisOptions.translate.translateX - firstLabel.node().getBBox().width / 2 < 0) {
|
|
101
|
+
firstLabel.attr("text-anchor", "start");
|
|
102
|
+
firstLabel.attr("transform", `translate(${-axisOptions.translate.translateX}, 0)`);
|
|
103
|
+
DomHelper.cropSvgLabels(firstLabel, maxLabelSize / 2 + axisElementTranslate);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
static getTranslateNumber(maxLabelSize, lastLabel, marginRight) {
|
|
107
|
+
if (maxLabelSize / 2 > lastLabel.node().getBBox().width)
|
|
108
|
+
return -(lastLabel.node().getBBox().width - marginRight);
|
|
109
|
+
return -maxLabelSize / 2;
|
|
110
|
+
// return -Math.min(maxLabelSize / 2, lastLabel.node().getBBox().width - marginRight)
|
|
111
|
+
}
|
|
112
|
+
static wrapHandler(textBlocks, maxWidth) {
|
|
113
|
+
textBlocks.each(function () {
|
|
114
|
+
let textBlock = select(this);
|
|
115
|
+
if (!textBlock.selectAll("tspan").empty())
|
|
116
|
+
return;
|
|
117
|
+
textBlock.select("title").remove();
|
|
118
|
+
let textContent = textBlock.text();
|
|
119
|
+
if (textBlock.node().getBBox().width > maxWidth) {
|
|
120
|
+
let letters = textBlock.text().split("").reverse(), // split text to letters.
|
|
121
|
+
letter, line = [], // one line. letters from this var into tpsans.
|
|
122
|
+
lineNumber = 0, dy = 1.4, tspan = textBlock
|
|
123
|
+
.text(null)
|
|
124
|
+
.append("tspan")
|
|
125
|
+
.attr("dy", dy + "em");
|
|
126
|
+
while ((letter = letters.pop())) {
|
|
127
|
+
line.push(letter);
|
|
128
|
+
tspan.text(line.join(""));
|
|
129
|
+
if (tspan.node().getComputedTextLength() > maxWidth && line.length > 1 && letters.length > 0) {
|
|
130
|
+
line.pop();
|
|
131
|
+
tspan.text(line.join(""));
|
|
132
|
+
if (lineNumber === 0 && line[line.length - 1] !== " ")
|
|
133
|
+
tspan.text(tspan.text() + "-");
|
|
134
|
+
line = [letter];
|
|
135
|
+
if (lineNumber >= 1) {
|
|
136
|
+
// If text block has 2 lines, text cropped.
|
|
137
|
+
if (letters.length > 0)
|
|
138
|
+
tspan.text(tspan.text().substr(0, tspan.text().length - 1) + "...");
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
tspan = textBlock
|
|
142
|
+
.append("tspan")
|
|
143
|
+
.attr("dy", dy * lineNumber + 1 + "em")
|
|
144
|
+
.text(letter);
|
|
145
|
+
lineNumber++;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (textBlock.selectAll("tspan").size() === 1) {
|
|
149
|
+
textBlock.text(textContent).attr("y", null);
|
|
150
|
+
}
|
|
151
|
+
if (!textBlock.selectAll("tspan").empty()) {
|
|
152
|
+
textBlock.attr("y", -(textBlock.node().getBBox().height / 2 + 4.8));
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
161
157
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Selection } from "d3-selection";
|
|
2
2
|
import { Block } from "../../block/block";
|
|
3
3
|
export declare class AxisLabelsEventManager {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
static setHoverEvents(block: Block, axisElement: Selection<SVGGElement, unknown, HTMLElement, any>): void;
|
|
5
|
+
static removeEvents(axisElement: Selection<SVGGElement, unknown, HTMLElement, any>): void;
|
|
6
6
|
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { pointer } from "d3-selection";
|
|
2
2
|
import { TipBox } from "../tipBox/tipBox";
|
|
3
3
|
export class AxisLabelsEventManager {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
4
|
+
static setHoverEvents(block, axisElement) {
|
|
5
|
+
const labels = axisElement.selectAll(".tick text");
|
|
6
|
+
labels.on("mousemove", function (e, d) {
|
|
7
|
+
TipBox.get(block).dispatch("mousemove", {
|
|
8
|
+
bubbles: false,
|
|
9
|
+
cancelable: true,
|
|
10
|
+
detail: {
|
|
11
|
+
keyValue: d,
|
|
12
|
+
pointer: pointer(e, block.getWrapper().node())
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
labels.on("mouseleave", function (e, d) {
|
|
17
|
+
TipBox.get(block).dispatch("mouseleave");
|
|
18
|
+
});
|
|
19
|
+
labels.on("click", function (e, d) {
|
|
20
|
+
TipBox.get(block).dispatch("click", {
|
|
21
|
+
bubbles: false,
|
|
22
|
+
cancelable: true,
|
|
23
|
+
detail: {
|
|
24
|
+
multySelect: e.ctrlKey || e.metaKey,
|
|
25
|
+
keyValue: d
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
static removeEvents(axisElement) {
|
|
31
|
+
const labels = axisElement.selectAll(".tick text");
|
|
32
|
+
labels.on("mousemove", null);
|
|
33
|
+
labels.on("mouseleave", null);
|
|
34
|
+
labels.on("click", null);
|
|
35
|
+
}
|
|
36
36
|
}
|