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,45 +1,37 @@
|
|
|
1
1
|
class RecordOverflowAlertCoreClass {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
setAlertPosition(alertBlock, attrs) {
|
|
37
|
-
alertBlock
|
|
38
|
-
.style("position", "absolute")
|
|
39
|
-
.style("left", attrs.left)
|
|
40
|
-
.style("right", attrs.right)
|
|
41
|
-
.style("top", attrs.top)
|
|
42
|
-
.style("bottom", attrs.bottom);
|
|
43
|
-
}
|
|
2
|
+
constructor() {
|
|
3
|
+
this.blockClass = "record-overflow-alert";
|
|
4
|
+
}
|
|
5
|
+
render(block, options) {
|
|
6
|
+
if (options.show) {
|
|
7
|
+
const alertBlock = block
|
|
8
|
+
.getWrapper()
|
|
9
|
+
.append("div")
|
|
10
|
+
.attr("class", this.blockClass)
|
|
11
|
+
.text(options.textContent);
|
|
12
|
+
this.setAlertPosition(alertBlock, options.positionAttrs);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
update(block, options) {
|
|
16
|
+
let alertBlock = block.getWrapper().select(`.${this.blockClass}`);
|
|
17
|
+
if (alertBlock.empty()) {
|
|
18
|
+
if (options.show)
|
|
19
|
+
this.render(block, options);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
if (options.show)
|
|
23
|
+
alertBlock.text(options.textContent);
|
|
24
|
+
else
|
|
25
|
+
alertBlock.remove();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
setAlertPosition(alertBlock, attrs) {
|
|
29
|
+
alertBlock
|
|
30
|
+
.style("position", "absolute")
|
|
31
|
+
.style("left", attrs.left)
|
|
32
|
+
.style("right", attrs.right)
|
|
33
|
+
.style("top", attrs.top)
|
|
34
|
+
.style("bottom", attrs.bottom);
|
|
35
|
+
}
|
|
44
36
|
}
|
|
45
37
|
export const RecordOverflowAlertCore = new RecordOverflowAlertCoreClass();
|
|
@@ -2,25 +2,20 @@ import { ScaleLinear } from "d3-scale";
|
|
|
2
2
|
import { AxisScale } from "d3-axis";
|
|
3
3
|
import { BarChartSettings, ScaleKeyModel, ScaleValueModel } from "../../../model/model";
|
|
4
4
|
export interface Scales {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
key: AxisScale<any>;
|
|
6
|
+
value: AxisScale<any>;
|
|
7
7
|
}
|
|
8
8
|
export interface ScalesWithSecondary extends Scales {
|
|
9
|
-
|
|
9
|
+
valueSecondary: AxisScale<any>;
|
|
10
10
|
}
|
|
11
11
|
export declare class Scale {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
static getScaleStep(scale: AxisScale<any>): number;
|
|
22
|
-
static getScaledValue(scale: AxisScale<any>, value: any): number;
|
|
23
|
-
private static getScaleBand;
|
|
24
|
-
private static getScaleLinear;
|
|
25
|
-
private static getScalePoint;
|
|
12
|
+
static getScales(scaleKey: ScaleKeyModel, scaleValue: ScaleValueModel, bandSettings: BarChartSettings): Scales;
|
|
13
|
+
static getScalesWithSecondary(scaleKey: ScaleKeyModel, scaleValue: ScaleValueModel, scaleValueSecondary: ScaleValueModel, bandSettings: BarChartSettings): ScalesWithSecondary;
|
|
14
|
+
static getScaleValue(scaleValue: ScaleValueModel): ScaleLinear<number, number, never>;
|
|
15
|
+
static getScaleBandWidth(scale: AxisScale<any>): number;
|
|
16
|
+
static getScaleStep(scale: AxisScale<any>): number;
|
|
17
|
+
static getScaledValue(scale: AxisScale<any>, value: any): number;
|
|
18
|
+
private static getScaleBand;
|
|
19
|
+
private static getScaleLinear;
|
|
20
|
+
private static getScalePoint;
|
|
26
21
|
}
|
|
@@ -1,79 +1,72 @@
|
|
|
1
1
|
import { scaleBand, scaleLinear, scalePoint } from "d3-scale";
|
|
2
2
|
export class Scale {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
static getScaleLinear(domain, range) {
|
|
74
|
-
return scaleLinear().domain(domain).range([range.start, range.end]);
|
|
75
|
-
}
|
|
76
|
-
static getScalePoint(domain, range) {
|
|
77
|
-
return scalePoint().domain(domain).range([range.start, range.end]);
|
|
78
|
-
}
|
|
3
|
+
static getScales(scaleKey, scaleValue, bandSettings) {
|
|
4
|
+
const scales = {
|
|
5
|
+
key: null,
|
|
6
|
+
value: null
|
|
7
|
+
};
|
|
8
|
+
if (scaleKey.type === "band")
|
|
9
|
+
scales.key = this.getScaleBand(scaleKey.domain, scaleKey.range, bandSettings, scaleKey.elementsAmount);
|
|
10
|
+
else if (scaleKey.type === "point")
|
|
11
|
+
scales.key = this.getScalePoint(scaleKey.domain, scaleKey.range);
|
|
12
|
+
scales.value = this.getScaleValue(scaleValue);
|
|
13
|
+
return scales;
|
|
14
|
+
}
|
|
15
|
+
static getScalesWithSecondary(scaleKey, scaleValue, scaleValueSecondary, bandSettings) {
|
|
16
|
+
const scales = this.getScales(scaleKey, scaleValue, bandSettings);
|
|
17
|
+
return Object.assign(Object.assign({}, scales), (scaleValueSecondary && { valueSecondary: this.getScaleValue(scaleValueSecondary) }));
|
|
18
|
+
}
|
|
19
|
+
static getScaleValue(scaleValue) {
|
|
20
|
+
return this.getScaleLinear(scaleValue.domain, scaleValue.range);
|
|
21
|
+
}
|
|
22
|
+
static getScaleBandWidth(scale) {
|
|
23
|
+
if (scale.bandwidth && scale.bandwidth() !== 0) {
|
|
24
|
+
return scale.bandwidth();
|
|
25
|
+
}
|
|
26
|
+
else if (scale.step) {
|
|
27
|
+
return scale.step();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
static getScaleStep(scale) {
|
|
31
|
+
if (scale.step) {
|
|
32
|
+
return scale.step();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
static getScaledValue(scale, value) {
|
|
36
|
+
if (scale.bandwidth && scale.bandwidth() !== 0) {
|
|
37
|
+
return scale(value) + this.getScaleBandWidth(scale) / 2;
|
|
38
|
+
}
|
|
39
|
+
return scale(value);
|
|
40
|
+
}
|
|
41
|
+
static getScaleBand(domain, range, bandSettings, elementsInGroupAmount) {
|
|
42
|
+
const scale = scaleBand().domain(domain).range([range.start, range.end]);
|
|
43
|
+
const bandSize = scale.bandwidth();
|
|
44
|
+
if (bandSettings.groupMinDistance < bandSize) {
|
|
45
|
+
scale.paddingInner(bandSettings.groupMinDistance / bandSize);
|
|
46
|
+
scale.paddingOuter(bandSettings.groupMinDistance / bandSize / 2);
|
|
47
|
+
}
|
|
48
|
+
// Padding inner = 10. If bandwidth more than needed, paddingInner is increased to number less than 35
|
|
49
|
+
let paddingInner = bandSettings.groupMinDistance;
|
|
50
|
+
while (scale.bandwidth() >
|
|
51
|
+
bandSettings.maxBarWidth * elementsInGroupAmount +
|
|
52
|
+
bandSettings.barDistance * (elementsInGroupAmount - 1) &&
|
|
53
|
+
paddingInner < bandSettings.groupMaxDistance) {
|
|
54
|
+
scale.paddingInner(++paddingInner / bandSize);
|
|
55
|
+
}
|
|
56
|
+
// if bandwidth more than all bars widths in group + distance between it + distance between groups
|
|
57
|
+
let paddingOuter = 1;
|
|
58
|
+
while (scale.step() >
|
|
59
|
+
bandSettings.maxBarWidth * elementsInGroupAmount +
|
|
60
|
+
bandSettings.groupMaxDistance +
|
|
61
|
+
bandSettings.barDistance * (elementsInGroupAmount - 1)) {
|
|
62
|
+
scale.paddingOuter(++paddingOuter / bandSize);
|
|
63
|
+
}
|
|
64
|
+
return scale;
|
|
65
|
+
}
|
|
66
|
+
static getScaleLinear(domain, range) {
|
|
67
|
+
return scaleLinear().domain(domain).range([range.start, range.end]);
|
|
68
|
+
}
|
|
69
|
+
static getScalePoint(domain, range) {
|
|
70
|
+
return scalePoint().domain(domain).range([range.start, range.end]);
|
|
71
|
+
}
|
|
79
72
|
}
|
|
@@ -3,13 +3,9 @@ import { Block } from "../../block/block";
|
|
|
3
3
|
import { BlockMargin } from "../../../model/model";
|
|
4
4
|
import { Size } from "../../../config/config";
|
|
5
5
|
export declare class TipBox {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
): Selection<SVGRectElement, unknown, HTMLElement, any>;
|
|
12
|
-
static get(block: Block): Selection<SVGRectElement, unknown, HTMLElement, any>;
|
|
13
|
-
static clearEvents(block: Block): void;
|
|
14
|
-
private static renderBlock;
|
|
6
|
+
static readonly tipBoxClass = "tipbox";
|
|
7
|
+
static renderOrGet(block: Block, margin: BlockMargin, blockSize: Size): Selection<SVGRectElement, unknown, HTMLElement, any>;
|
|
8
|
+
static get(block: Block): Selection<SVGRectElement, unknown, HTMLElement, any>;
|
|
9
|
+
static clearEvents(block: Block): void;
|
|
10
|
+
private static renderBlock;
|
|
15
11
|
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { TipBoxHelper } from "./tipBoxHelper";
|
|
2
2
|
export class TipBox {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
3
|
+
static renderOrGet(block, margin, blockSize) {
|
|
4
|
+
const attributes = TipBoxHelper.getAttributes(margin, blockSize);
|
|
5
|
+
return this.renderBlock(block, attributes);
|
|
6
|
+
}
|
|
7
|
+
static get(block) {
|
|
8
|
+
return block.getSvg().select(`.${this.tipBoxClass}`);
|
|
9
|
+
}
|
|
10
|
+
static clearEvents(block) {
|
|
11
|
+
block.getSvg().select(`.${this.tipBoxClass}`).on("mousemove", null).on("mouseleave", null).on("click", null);
|
|
12
|
+
}
|
|
13
|
+
static renderBlock(block, attributes) {
|
|
14
|
+
let tipBox = block.getSvg().select(`rect.${this.tipBoxClass}`);
|
|
15
|
+
if (tipBox.empty())
|
|
16
|
+
tipBox = block
|
|
17
|
+
.getSvg()
|
|
18
|
+
.append("rect")
|
|
19
|
+
.attr("class", this.tipBoxClass)
|
|
20
|
+
.attr("x", attributes.x)
|
|
21
|
+
.attr("y", attributes.y)
|
|
22
|
+
.attr("width", attributes.width)
|
|
23
|
+
.attr("height", attributes.height)
|
|
24
|
+
.style("opacity", 0);
|
|
25
|
+
return tipBox;
|
|
26
|
+
}
|
|
27
27
|
}
|
|
28
28
|
TipBox.tipBoxClass = "tipbox";
|
|
@@ -2,22 +2,15 @@ import { AxisScale } from "d3-axis";
|
|
|
2
2
|
import { ChartOrientation, Size } from "../../../config/config";
|
|
3
3
|
import { BlockMargin, ScaleKeyType } from "../../../model/model";
|
|
4
4
|
export interface TipBoxAttributes {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
9
|
}
|
|
10
10
|
export declare class TipBoxHelper {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
scaleKey: AxisScale<any>,
|
|
17
|
-
scaleKeyType: ScaleKeyType
|
|
18
|
-
): string;
|
|
19
|
-
static getAttributes(margin: BlockMargin, blockSize: Size): TipBoxAttributes;
|
|
20
|
-
private static getKeyIndex;
|
|
21
|
-
private static getKeyIndexOfPoint;
|
|
22
|
-
private static getKeyIndexOfBand;
|
|
11
|
+
static getKeyValueByPointer(pointer: [number, number], chartOrient: ChartOrientation, margin: BlockMargin, blockSize: Size, scaleKey: AxisScale<any>, scaleKeyType: ScaleKeyType): string;
|
|
12
|
+
static getAttributes(margin: BlockMargin, blockSize: Size): TipBoxAttributes;
|
|
13
|
+
private static getKeyIndex;
|
|
14
|
+
private static getKeyIndexOfPoint;
|
|
15
|
+
private static getKeyIndexOfBand;
|
|
23
16
|
}
|
|
@@ -1,63 +1,48 @@
|
|
|
1
1
|
import { Scale } from "../scale/scale";
|
|
2
2
|
export class TipBoxHelper {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
margin,
|
|
49
|
-
chartOrient,
|
|
50
|
-
scaleKey
|
|
51
|
-
) {
|
|
52
|
-
const chartBlockSizeByDir =
|
|
53
|
-
chartOrient === "vertical"
|
|
54
|
-
? blockSize.width - margin.left - margin.right
|
|
55
|
-
: blockSize.height - margin.top - margin.bottom;
|
|
56
|
-
const outerPadding = chartBlockSizeByDir - scaleStep * scaleKey.domain().length;
|
|
57
|
-
if (pointer[pointerAxisType] - marginByOrient - 1 < outerPadding / 2) return 0; // Самый первый элемент
|
|
58
|
-
if (pointer[pointerAxisType] - marginByOrient - 1 + outerPadding / 2 > chartBlockSizeByDir)
|
|
59
|
-
return scaleKey.domain().length - 1; // последний индекс
|
|
60
|
-
const point = pointer[pointerAxisType] - outerPadding / 2 - marginByOrient - 1;
|
|
61
|
-
return Math.floor(point / scaleStep);
|
|
62
|
-
}
|
|
3
|
+
static getKeyValueByPointer(pointer, chartOrient, margin, blockSize, scaleKey, scaleKeyType) {
|
|
4
|
+
const index = TipBoxHelper.getKeyIndex(pointer, chartOrient, margin, blockSize, scaleKey, scaleKeyType);
|
|
5
|
+
let keyValue = scaleKey.domain()[index];
|
|
6
|
+
if (index >= scaleKey.domain().length)
|
|
7
|
+
keyValue = scaleKey.domain()[scaleKey.domain().length - 1];
|
|
8
|
+
return keyValue;
|
|
9
|
+
}
|
|
10
|
+
static getAttributes(margin, blockSize) {
|
|
11
|
+
const pad = 5;
|
|
12
|
+
return {
|
|
13
|
+
x: margin.left - pad,
|
|
14
|
+
y: margin.top - pad,
|
|
15
|
+
width: blockSize.width - margin.left - margin.right + pad * 2,
|
|
16
|
+
height: blockSize.height - margin.top - margin.bottom + pad * 2
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
static getKeyIndex(pointer, chartOrient, margin, blockSize, scaleKey, scaleKeyType) {
|
|
20
|
+
const pointerAxisType = chartOrient === "vertical" ? 0 : 1; // 0 - координата поинтера по оси x, 1 - по оси y
|
|
21
|
+
const marginByOrient = chartOrient === "vertical" ? margin.left : margin.top;
|
|
22
|
+
const scaleStep = Scale.getScaleStep(scaleKey);
|
|
23
|
+
if (scaleKeyType === "point") {
|
|
24
|
+
return this.getKeyIndexOfPoint(pointer, scaleStep, marginByOrient, pointerAxisType);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return this.getKeyIndexOfBand(pointer, scaleStep, marginByOrient, pointerAxisType, blockSize, margin, chartOrient, scaleKey);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
static getKeyIndexOfPoint(pointer, scaleStep, marginByOrient, pointerAxisType) {
|
|
31
|
+
const point = pointer[pointerAxisType] - marginByOrient + scaleStep / 2;
|
|
32
|
+
if (point < 0)
|
|
33
|
+
return 0;
|
|
34
|
+
return Math.floor(point / scaleStep);
|
|
35
|
+
}
|
|
36
|
+
static getKeyIndexOfBand(pointer, scaleStep, marginByOrient, pointerAxisType, blockSize, margin, chartOrient, scaleKey) {
|
|
37
|
+
const chartBlockSizeByDir = chartOrient === "vertical"
|
|
38
|
+
? blockSize.width - margin.left - margin.right
|
|
39
|
+
: blockSize.height - margin.top - margin.bottom;
|
|
40
|
+
const outerPadding = chartBlockSizeByDir - scaleStep * scaleKey.domain().length;
|
|
41
|
+
if (pointer[pointerAxisType] - marginByOrient - 1 < outerPadding / 2)
|
|
42
|
+
return 0; // Самый первый элемент
|
|
43
|
+
if (pointer[pointerAxisType] - marginByOrient - 1 + outerPadding / 2 > chartBlockSizeByDir)
|
|
44
|
+
return scaleKey.domain().length - 1; // последний индекс
|
|
45
|
+
const point = pointer[pointerAxisType] - outerPadding / 2 - marginByOrient - 1;
|
|
46
|
+
return Math.floor(point / scaleStep);
|
|
47
|
+
}
|
|
63
48
|
}
|
|
@@ -2,10 +2,10 @@ import { Size } from "../../../config/config";
|
|
|
2
2
|
import { OptionsModelTitle, TitleBlockModel } from "../../../model/model";
|
|
3
3
|
import { Block } from "../../block/block";
|
|
4
4
|
export declare class Title {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
private static readonly titleCssClass;
|
|
6
|
+
static render(block: Block, title: OptionsModelTitle, titleBlockModel: TitleBlockModel, blockSize: Size): void;
|
|
7
|
+
static updateData(block: Block, title: OptionsModelTitle): void;
|
|
8
|
+
private static fillTitleBlockAttributes;
|
|
9
|
+
private static getTitleAttributes;
|
|
10
|
+
private static setTitleTooltip;
|
|
11
11
|
}
|
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
import { DomHelper } from "../../helpers/domHelper";
|
|
2
2
|
export class Title {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
3
|
+
static render(block, title, titleBlockModel, blockSize) {
|
|
4
|
+
if (!title.textContent)
|
|
5
|
+
return;
|
|
6
|
+
const titleBlock = block.getSvg().append("text").attr("class", this.titleCssClass);
|
|
7
|
+
const titleCoordinate = this.getTitleAttributes(blockSize, titleBlockModel);
|
|
8
|
+
this.fillTitleBlockAttributes(titleBlock, titleCoordinate, title);
|
|
9
|
+
this.setTitleTooltip(titleBlock, title.textContent);
|
|
10
|
+
}
|
|
11
|
+
static updateData(block, title) {
|
|
12
|
+
block.getSvg().select(`.${this.titleCssClass}`).text(title.textContent);
|
|
13
|
+
}
|
|
14
|
+
static fillTitleBlockAttributes(titleBlock, attributes, title) {
|
|
15
|
+
titleBlock
|
|
16
|
+
.attr("x", attributes.x)
|
|
17
|
+
.attr("y", attributes.y)
|
|
18
|
+
.attr("dominant-baseline", attributes.dominantBaseline)
|
|
19
|
+
.text(title.textContent)
|
|
20
|
+
.style("font-size", `${title.fontSize}px`);
|
|
21
|
+
DomHelper.cropSvgLabels(titleBlock, attributes.maxWidth);
|
|
22
|
+
}
|
|
23
|
+
static getTitleAttributes(blockSize, titleBlockModel) {
|
|
24
|
+
const coordinate = {
|
|
25
|
+
x: 0,
|
|
26
|
+
y: 0,
|
|
27
|
+
maxWidth: 0,
|
|
28
|
+
dominantBaseline: "hanging"
|
|
29
|
+
};
|
|
30
|
+
coordinate.x = titleBlockModel.margin.left;
|
|
31
|
+
coordinate.y = titleBlockModel.margin.top;
|
|
32
|
+
coordinate.maxWidth = blockSize.width - titleBlockModel.margin.left - titleBlockModel.margin.right;
|
|
33
|
+
return coordinate;
|
|
34
|
+
}
|
|
35
|
+
static setTitleTooltip(titleBlock, text) {
|
|
36
|
+
titleBlock.append("title").text(text);
|
|
37
|
+
}
|
|
37
38
|
}
|
|
38
39
|
Title.titleCssClass = "chart-title";
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { Selection } from "d3-selection";
|
|
2
2
|
export interface TooltipCoordinate {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
left: string;
|
|
4
|
+
top: string;
|
|
5
|
+
right: string;
|
|
6
|
+
bottom: string;
|
|
7
7
|
}
|
|
8
8
|
export declare class NewTooltip {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
wrapper: Selection<HTMLElement, unknown, HTMLElement, any>
|
|
17
|
-
): Selection<HTMLElement, unknown, HTMLElement, any>;
|
|
18
|
-
appendContent(content: HTMLElement): void;
|
|
19
|
-
setCoordinate(coordinate: TooltipCoordinate): void;
|
|
9
|
+
static tooltipBlockClass: string;
|
|
10
|
+
private elSelection;
|
|
11
|
+
getEl(): Selection<HTMLElement, unknown, HTMLElement, any>;
|
|
12
|
+
findInWrapper(wrapper: Selection<HTMLElement, unknown, HTMLElement, any>): Selection<HTMLElement, unknown, HTMLElement, any>;
|
|
13
|
+
render(wrapper: Selection<HTMLElement, unknown, HTMLElement, any>): Selection<HTMLElement, unknown, HTMLElement, any>;
|
|
14
|
+
appendContent(content: HTMLElement): void;
|
|
15
|
+
setCoordinate(coordinate: TooltipCoordinate): void;
|
|
20
16
|
}
|