mdt-charts 1.12.11 → 1.12.15
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 +2 -2
- package/lib/engine/contentManager/contentManager.d.ts +9 -0
- package/lib/engine/contentManager/contentManager.js +15 -0
- package/lib/engine/contentManager/contentManagerFactory.d.ts +14 -0
- package/lib/engine/contentManager/contentManagerFactory.js +20 -0
- package/lib/engine/engine.js +4 -4
- package/lib/engine/features/axis/axis.js +1 -1
- package/lib/engine/features/axis/axisLabelDomHelper.js +1 -1
- package/lib/engine/features/tolltip/newTooltip/newTooltip.js +1 -1
- package/lib/engine/features/tolltip/tooltip.d.ts +4 -4
- package/lib/engine/features/tolltip/tooltip.js +4 -4
- package/lib/engine/polarNotation/polarManager.d.ts +6 -5
- package/lib/engine/polarNotation/polarManager.js +4 -4
- package/lib/engine/twoDimensionalNotation/twoDimensionalManager.d.ts +7 -6
- package/lib/engine/twoDimensionalNotation/twoDimensionalManager.js +5 -5
- package/lib/model/dataManagerModel/dataManagerModel.d.ts +1 -0
- package/lib/model/dataManagerModel/dataManagerModel.js +7 -0
- package/lib/model/featuresModel/legendModel/legendModel.d.ts +2 -1
- package/lib/model/featuresModel/legendModel/legendModel.js +9 -2
- package/lib/model/featuresModel/legendModel/polarMarginCalculator.js +2 -3
- package/lib/model/featuresModel/legendModel/twoDimLegendModel.js +2 -2
- package/lib/model/featuresModel/scaleModel/scaleAxisRecalcer.js +3 -1
- package/lib/model/featuresModel/scaleModel/scaleDomainService.d.ts +6 -0
- package/lib/model/featuresModel/scaleModel/scaleDomainService.js +53 -0
- package/lib/model/featuresModel/scaleModel/scaleModel.d.ts +5 -12
- package/lib/model/featuresModel/scaleModel/scaleModel.js +11 -94
- package/lib/model/featuresModel/scaleModel/scaleModelServices.d.ts +5 -0
- package/lib/model/featuresModel/scaleModel/scaleModelServices.js +22 -0
- package/lib/model/margin/marginModel.d.ts +10 -0
- package/lib/model/margin/marginModel.js +20 -0
- package/lib/model/margin/twoDim/twoDimMarginModel.d.ts +14 -0
- package/lib/model/margin/twoDim/twoDimMarginModel.js +69 -0
- package/lib/model/modelBuilder.d.ts +0 -1
- package/lib/model/modelBuilder.js +8 -12
- package/lib/model/modelInstance/canvasModel/canvasModel.d.ts +4 -3
- package/lib/model/modelInstance/canvasModel/canvasModel.js +1 -1
- package/lib/model/modelInstance/canvasModel/canvasSizesModel/canvasMarginModel.d.ts +11 -0
- package/lib/{engine/features/tolltip/newTooltip/newTooltip.test.d.ts → model/modelInstance/canvasModel/canvasSizesModel/canvasMarginModel.js} +0 -0
- package/lib/model/modelInstance/canvasModel/canvasSizesModel/canvasSizeModel.d.ts +4 -0
- package/lib/{engine/twoDimensionalNotation/bar/stackedData/dataStacker.test.d.ts → model/modelInstance/canvasModel/canvasSizesModel/canvasSizeModel.js} +0 -0
- package/lib/model/modelInstance/canvasModel/canvasSizesModel/marginModelService.d.ts +11 -0
- package/lib/model/modelInstance/canvasModel/canvasSizesModel/marginModelService.js +26 -0
- package/lib/model/modelInstance/canvasModel/titleCanvas.js +1 -1
- package/lib/model/notations/intervalModel.d.ts +3 -3
- package/lib/model/notations/intervalModel.js +8 -9
- package/lib/model/notations/polar/donut/donutAggregatorService.d.ts +1 -0
- package/lib/model/notations/polar/donut/donutAggregatorService.js +19 -4
- package/lib/model/notations/twoDimensionalModel.d.ts +2 -2
- package/lib/model/notations/twoDimensionalModel.js +6 -4
- package/lib/style/charts-main.css +9 -9
- package/lib/style/charts-main.less +9 -9
- package/package.json +1 -1
- package/tsconfig.production.json +2 -1
- package/lib/engine/features/tolltip/newTooltip/newTooltip.test.js +0 -186
- package/lib/engine/twoDimensionalNotation/bar/stackedData/dataStacker.test.js +0 -199
- package/lib/model/featuresModel/scaleModel.d.ts +0 -19
- package/lib/model/featuresModel/scaleModel.js +0 -115
- package/lib/model/marginModel.d.ts +0 -17
- package/lib/model/marginModel.js +0 -80
- package/lib/model/modelHelper.d.ts +0 -7
- package/lib/model/modelHelper.js +0 -41
- package/lib/model/modelInstance/dataModel.d.ts +0 -11
- package/lib/model/modelInstance/dataModel.js +0 -23
- package/lib/model/notations/polarModel.d.ts +0 -15
- package/lib/model/notations/polarModel.js +0 -59
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function getScaleKeyRangePeek(chartOrientation, canvasModel) {
|
|
2
|
+
if (chartOrientation === 'vertical')
|
|
3
|
+
return canvasModel.getChartBlockWidth();
|
|
4
|
+
return canvasModel.getChartBlockHeight();
|
|
5
|
+
}
|
|
6
|
+
export function getScaleValueRangePeek(chartOrientation, canvasModel) {
|
|
7
|
+
if (chartOrientation === 'vertical')
|
|
8
|
+
return canvasModel.getChartBlockHeight();
|
|
9
|
+
return canvasModel.getChartBlockWidth();
|
|
10
|
+
}
|
|
11
|
+
export function getElementsAmountForScale(barCharts) {
|
|
12
|
+
if (barCharts.length === 0)
|
|
13
|
+
return 1;
|
|
14
|
+
let barsAmount = 0;
|
|
15
|
+
barCharts.forEach(chart => {
|
|
16
|
+
if (chart.isSegmented)
|
|
17
|
+
barsAmount += 1; // Если бар сегментированный, то все valueFields являются частями одного бара
|
|
18
|
+
else
|
|
19
|
+
barsAmount += chart.data.valueFields.length;
|
|
20
|
+
});
|
|
21
|
+
return barsAmount;
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MdtChartsConfig, MdtChartsDataSource, MdtChartsTwoDimensionalOptions } from "../../config/config";
|
|
2
|
+
import { DesignerConfig } from "../../designer/designerConfig";
|
|
3
|
+
import { OtherCommonComponents } from "../model";
|
|
4
|
+
import { ModelInstance } from "../modelInstance/modelInstance";
|
|
5
|
+
export declare class MarginModel {
|
|
6
|
+
private twoDimModel;
|
|
7
|
+
initMargin(designerConfig: DesignerConfig, config: MdtChartsConfig, otherComponents: OtherCommonComponents, data: MdtChartsDataSource, modelInstance: ModelInstance): void;
|
|
8
|
+
recalcMarginByVerticalAxisLabel(modelInstance: ModelInstance, options: MdtChartsTwoDimensionalOptions, designerConfig: DesignerConfig): void;
|
|
9
|
+
private recalcMarginByTitle;
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TwoDimMarginModel } from "./twoDim/twoDimMarginModel";
|
|
2
|
+
export class MarginModel {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.twoDimModel = new TwoDimMarginModel();
|
|
5
|
+
}
|
|
6
|
+
initMargin(designerConfig, config, otherComponents, data, modelInstance) {
|
|
7
|
+
const canvasModel = modelInstance.canvasModel;
|
|
8
|
+
canvasModel.initMargin(Object.assign({}, designerConfig.canvas.chartBlockMargin));
|
|
9
|
+
this.recalcMarginByTitle(canvasModel);
|
|
10
|
+
if (config.options.type === '2d') {
|
|
11
|
+
this.twoDimModel.recalcMargin(designerConfig, config.options, otherComponents, data, modelInstance);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
recalcMarginByVerticalAxisLabel(modelInstance, options, designerConfig) {
|
|
15
|
+
this.twoDimModel.recalcMarginByVerticalAxisLabel(modelInstance, options, designerConfig);
|
|
16
|
+
}
|
|
17
|
+
recalcMarginByTitle(canvasModel) {
|
|
18
|
+
canvasModel.increaseMarginSide("top", canvasModel.titleCanvas.getAllNeededSpace());
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MdtChartsDataSource, MdtChartsTwoDimensionalOptions } from "../../../config/config";
|
|
2
|
+
import { DesignerConfig } from "../../../designer/designerConfig";
|
|
3
|
+
import { OtherCommonComponents } from "../../model";
|
|
4
|
+
import { ModelInstance } from "../../modelInstance/modelInstance";
|
|
5
|
+
export declare const AXIS_HORIZONTAL_LABEL_PADDING = 15;
|
|
6
|
+
export declare const AXIS_VERTICAL_LABEL_PADDING = 10;
|
|
7
|
+
export declare class TwoDimMarginModel {
|
|
8
|
+
private twoDimLegendModel;
|
|
9
|
+
recalcMargin(designerConfig: DesignerConfig, options: MdtChartsTwoDimensionalOptions, otherComponents: OtherCommonComponents, data: MdtChartsDataSource, modelInstance: ModelInstance): void;
|
|
10
|
+
recalcMarginByVerticalAxisLabel(modelInstance: ModelInstance, options: MdtChartsTwoDimensionalOptions, designerConfig: DesignerConfig): void;
|
|
11
|
+
private getHorizontalMarginByAxisLabels;
|
|
12
|
+
private recalcVerticalMarginByAxisLabelHeight;
|
|
13
|
+
private recalcHorizontalMarginByAxisLabelWidth;
|
|
14
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { DataManagerModel } from "../../dataManagerModel/dataManagerModel";
|
|
2
|
+
import { AxisModel } from "../../featuresModel/axisModel";
|
|
3
|
+
import { TwoDimLegendModel } from "../../featuresModel/legendModel/twoDimLegendModel";
|
|
4
|
+
import { keyAxisLabelHorizontalLog, keyAxisLabelVerticalLog } from "../../featuresModel/scaleModel/scaleAxisRecalcer";
|
|
5
|
+
import { AxisType } from "../../modelBuilder";
|
|
6
|
+
import { TwoDimensionalModel } from "../../notations/twoDimensionalModel";
|
|
7
|
+
export const AXIS_HORIZONTAL_LABEL_PADDING = 15;
|
|
8
|
+
export const AXIS_VERTICAL_LABEL_PADDING = 10;
|
|
9
|
+
export class TwoDimMarginModel {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.twoDimLegendModel = new TwoDimLegendModel();
|
|
12
|
+
}
|
|
13
|
+
recalcMargin(designerConfig, options, otherComponents, data, modelInstance) {
|
|
14
|
+
const canvasModel = modelInstance.canvasModel;
|
|
15
|
+
this.twoDimLegendModel.recalcMarginWith2DLegend(modelInstance, otherComponents.legendBlock);
|
|
16
|
+
const labelSize = this.getHorizontalMarginByAxisLabels(designerConfig.canvas.axisLabel.maxSize.main, options.axis, data, options);
|
|
17
|
+
this.recalcVerticalMarginByAxisLabelHeight(labelSize, canvasModel, options.orientation, options.axis);
|
|
18
|
+
// Если встроенный лейбл показывает ключи, то лейблы оси ключей не показываются
|
|
19
|
+
// При этом все графики должны иметь: embeddedLabels = 'key'
|
|
20
|
+
// И все графики должны быть типа bar.
|
|
21
|
+
const showingFlag = options.type === '2d'
|
|
22
|
+
? !TwoDimensionalModel.getChartsEmbeddedLabelsFlag(options.charts, options.orientation)
|
|
23
|
+
: true;
|
|
24
|
+
this.recalcHorizontalMarginByAxisLabelWidth(labelSize, canvasModel, options.orientation, options.axis, showingFlag);
|
|
25
|
+
}
|
|
26
|
+
recalcMarginByVerticalAxisLabel(modelInstance, options, designerConfig) {
|
|
27
|
+
if (options.orientation === 'vertical') {
|
|
28
|
+
const dataModel = modelInstance.dataModel;
|
|
29
|
+
const axisLabelSize = AxisModel.getLabelSize(designerConfig.canvas.axisLabel.maxSize.main, dataModel.getAllowableKeys());
|
|
30
|
+
const axisConfig = AxisModel.getKeyAxisLabelPosition(modelInstance.canvasModel, dataModel.getAllowableKeys().length, options.axis.key);
|
|
31
|
+
const marginOrient = options.axis.key.position === 'end' ? 'bottom' : 'top';
|
|
32
|
+
if (axisConfig === 'rotated') {
|
|
33
|
+
modelInstance.canvasModel.decreaseMarginSide(marginOrient, axisLabelSize.height);
|
|
34
|
+
modelInstance.canvasModel.increaseMarginSide(marginOrient, axisLabelSize.width, keyAxisLabelVerticalLog);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
getHorizontalMarginByAxisLabels(labelsMaxWidth, axis, data, options) {
|
|
39
|
+
const keyAxisOrient = AxisModel.getAxisOrient(AxisType.Key, options.orientation, axis.key.position);
|
|
40
|
+
let labelsTexts;
|
|
41
|
+
if (keyAxisOrient === 'left' || keyAxisOrient === 'right') {
|
|
42
|
+
labelsTexts = DataManagerModel.getDataValuesByKeyField(data, options.data.dataSource, options.data.keyField.name);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
labelsTexts = ['0000'];
|
|
46
|
+
}
|
|
47
|
+
return AxisModel.getLabelSize(labelsMaxWidth, labelsTexts);
|
|
48
|
+
}
|
|
49
|
+
recalcVerticalMarginByAxisLabelHeight(labelSize, canvasModel, orientation, axis) {
|
|
50
|
+
const keyAxisOrient = AxisModel.getAxisOrient(AxisType.Key, orientation, axis.key.position);
|
|
51
|
+
const valueAxisOrient = AxisModel.getAxisOrient(AxisType.Value, orientation, axis.value.position);
|
|
52
|
+
if ((keyAxisOrient === 'bottom' || keyAxisOrient === 'top')) {
|
|
53
|
+
if (axis.key.visibility)
|
|
54
|
+
canvasModel.increaseMarginSide(keyAxisOrient, labelSize.height + AXIS_HORIZONTAL_LABEL_PADDING, keyAxisLabelVerticalLog);
|
|
55
|
+
}
|
|
56
|
+
else if (axis.value.visibility)
|
|
57
|
+
canvasModel.increaseMarginSide(valueAxisOrient, labelSize.height + AXIS_HORIZONTAL_LABEL_PADDING);
|
|
58
|
+
}
|
|
59
|
+
recalcHorizontalMarginByAxisLabelWidth(labelSize, canvasModel, orientation, axis, isShow) {
|
|
60
|
+
const keyAxisOrient = AxisModel.getAxisOrient(AxisType.Key, orientation, axis.key.position);
|
|
61
|
+
const valueAxisOrient = AxisModel.getAxisOrient(AxisType.Value, orientation, axis.value.position);
|
|
62
|
+
if ((keyAxisOrient === 'left' || keyAxisOrient === 'right') && isShow && axis.key.visibility) {
|
|
63
|
+
canvasModel.increaseMarginSide(keyAxisOrient, labelSize.width + AXIS_VERTICAL_LABEL_PADDING, keyAxisLabelHorizontalLog);
|
|
64
|
+
}
|
|
65
|
+
else if ((valueAxisOrient === 'left' || valueAxisOrient === 'right') && axis.value.visibility) {
|
|
66
|
+
canvasModel.increaseMarginSide(valueAxisOrient, labelSize.width + AXIS_VERTICAL_LABEL_PADDING);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -13,4 +13,3 @@ export declare const CLASSES: {
|
|
|
13
13
|
};
|
|
14
14
|
export declare function assembleModel(config: MdtChartsConfig, data: MdtChartsDataSource, designerConfig: DesignerConfig): Model;
|
|
15
15
|
export declare function getPreparedData(model: Model, data: MdtChartsDataSource, config: MdtChartsConfig): MdtChartsDataSource;
|
|
16
|
-
export declare function getUpdatedModel(config: MdtChartsConfig, data: MdtChartsDataSource, designerConfig: DesignerConfig): Model;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MarginModel } from './marginModel';
|
|
1
|
+
import { MarginModel } from './margin/marginModel';
|
|
2
2
|
import { TwoDimensionalModel } from './notations/twoDimensionalModel';
|
|
3
3
|
import { PolarModel } from './notations/polar/polarModel';
|
|
4
4
|
import { DataManagerModel } from './dataManagerModel/dataManagerModel';
|
|
@@ -30,16 +30,16 @@ function getChartBlockModel(modelInstance) {
|
|
|
30
30
|
margin: modelInstance.canvasModel.getMargin()
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
function getOptions(config, designerConfig, modelInstance
|
|
33
|
+
function getOptions(config, designerConfig, modelInstance) {
|
|
34
34
|
//TODO: migrate to polymorphism
|
|
35
35
|
if (config.options.type === '2d') {
|
|
36
|
-
return TwoDimensionalModel.getOptions(config.options, designerConfig,
|
|
36
|
+
return TwoDimensionalModel.getOptions(config.options, designerConfig, modelInstance);
|
|
37
37
|
}
|
|
38
38
|
else if (config.options.type === 'polar') {
|
|
39
39
|
return PolarModel.getOptions(config.options, designerConfig, modelInstance);
|
|
40
40
|
}
|
|
41
41
|
else if (config.options.type === 'interval') {
|
|
42
|
-
return IntervalModel.getOptions(config, designerConfig, modelInstance
|
|
42
|
+
return IntervalModel.getOptions(config.options, designerConfig, modelInstance);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
function getDataSettings(dataScope, designerConfig) {
|
|
@@ -68,15 +68,14 @@ export function assembleModel(config, data, designerConfig) {
|
|
|
68
68
|
};
|
|
69
69
|
resetFalsyValues(data, config.options.data.keyField.name);
|
|
70
70
|
const otherComponents = OtherComponentsModel.getOtherComponentsModel({ elementsOptions: designerConfig.elementsOptions, title: config.options.title }, modelInstance);
|
|
71
|
-
|
|
71
|
+
const marginModel = new MarginModel();
|
|
72
|
+
marginModel.initMargin(designerConfig, config, otherComponents, data, modelInstance);
|
|
72
73
|
DataManagerModel.initDataScope(config, data, designerConfig, otherComponents.legendBlock, modelInstance);
|
|
73
|
-
const preparedData = DataManagerModel.getPreparedData(data, modelInstance.dataModel.getAllowableKeys(), config);
|
|
74
|
-
modelInstance.dataModel.repository.initScopedFullSource(preparedData);
|
|
75
74
|
if (config.options.type === '2d' && config.options.axis.key.visibility)
|
|
76
|
-
|
|
75
|
+
marginModel.recalcMarginByVerticalAxisLabel(modelInstance, config.options, designerConfig);
|
|
77
76
|
const blockCanvas = getBlockCanvas(config, modelInstance);
|
|
78
77
|
const chartBlock = getChartBlockModel(modelInstance);
|
|
79
|
-
const options = getOptions(config, designerConfig, modelInstance
|
|
78
|
+
const options = getOptions(config, designerConfig, modelInstance);
|
|
80
79
|
const dataSettings = getDataSettings(modelInstance.dataModel.getScope(), designerConfig);
|
|
81
80
|
const transitions = getTransitions(designerConfig);
|
|
82
81
|
modelInstance.canvasModel.roundMargin();
|
|
@@ -111,6 +110,3 @@ export function getPreparedData(model, data, config) {
|
|
|
111
110
|
const preparedData = DataManagerModel.getPreparedData(data, model.dataSettings.scope.allowableKeys, config);
|
|
112
111
|
return preparedData;
|
|
113
112
|
}
|
|
114
|
-
export function getUpdatedModel(config, data, designerConfig) {
|
|
115
|
-
return assembleModel(config, data, designerConfig);
|
|
116
|
-
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Size } from "../../../config/config";
|
|
2
2
|
import { BlockMargin } from "../../model";
|
|
3
3
|
import { LegendCanvasModelInstance } from "./legendCanvasModel";
|
|
4
|
-
import {
|
|
4
|
+
import { CanvasMarginModel, MarginSide } from "./canvasSizesModel/canvasMarginModel";
|
|
5
|
+
import { MarginModelService } from "./canvasSizesModel/marginModelService";
|
|
5
6
|
import { TitleCanvasModel } from "./titleCanvas";
|
|
6
|
-
|
|
7
|
-
export declare class CanvasModel {
|
|
7
|
+
import { CanvasSizesModel } from "./canvasSizesModel/canvasSizeModel";
|
|
8
|
+
export declare class CanvasModel implements CanvasMarginModel, CanvasSizesModel {
|
|
8
9
|
titleCanvas: TitleCanvasModel;
|
|
9
10
|
legendCanvas: LegendCanvasModelInstance;
|
|
10
11
|
marginService: MarginModelService;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LegendCanvasModelInstance } from "./legendCanvasModel";
|
|
2
|
-
import { MarginModelService } from "./marginModelService";
|
|
2
|
+
import { MarginModelService } from "./canvasSizesModel/marginModelService";
|
|
3
3
|
import { TitleCanvasModel } from "./titleCanvas";
|
|
4
4
|
export class CanvasModel {
|
|
5
5
|
constructor() {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BlockMargin } from "../../../model";
|
|
2
|
+
export declare type MarginSide = keyof BlockMargin;
|
|
3
|
+
export interface CanvasMarginModel {
|
|
4
|
+
initMargin(margin: BlockMargin): void;
|
|
5
|
+
getMargin(): BlockMargin;
|
|
6
|
+
getMarginSide(side: MarginSide): number;
|
|
7
|
+
setMarginSide(side: MarginSide, size: number): void;
|
|
8
|
+
increaseMarginSide(side: MarginSide, byValue: number, key?: string): void;
|
|
9
|
+
decreaseMarginSide(side: MarginSide, byValue: number): void;
|
|
10
|
+
roundMargin(): void;
|
|
11
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MarginSide } from "./canvasMarginModel";
|
|
2
|
+
export interface MarginLogData {
|
|
3
|
+
side: MarginSide;
|
|
4
|
+
byValue: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class MarginModelService {
|
|
7
|
+
private log;
|
|
8
|
+
appendLog(key: string, side: MarginSide, byValue: number): void;
|
|
9
|
+
getDataByKey(key: string): MarginLogData;
|
|
10
|
+
private findLogByKey;
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class MarginModelService {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.log = [];
|
|
4
|
+
}
|
|
5
|
+
appendLog(key, side, byValue) {
|
|
6
|
+
const log = this.findLogByKey(key);
|
|
7
|
+
if (log) {
|
|
8
|
+
log.data = { side, byValue };
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
this.log.push({
|
|
12
|
+
key,
|
|
13
|
+
data: {
|
|
14
|
+
side,
|
|
15
|
+
byValue
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
getDataByKey(key) {
|
|
20
|
+
var _a;
|
|
21
|
+
return (_a = this.findLogByKey(key)) === null || _a === void 0 ? void 0 : _a.data;
|
|
22
|
+
}
|
|
23
|
+
findLogByKey(key) {
|
|
24
|
+
return this.log.find(l => l.key === key);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MdtChartsIntervalOptions } from "../../config/config";
|
|
2
2
|
import { DesignerConfig } from "../../designer/designerConfig";
|
|
3
|
-
import { AdditionalElementsOptions,
|
|
3
|
+
import { AdditionalElementsOptions, IntervalOptionsModel } from "../model";
|
|
4
4
|
import { ModelInstance } from "../modelInstance/modelInstance";
|
|
5
5
|
export declare class IntervalModel {
|
|
6
|
-
static getOptions(
|
|
6
|
+
static getOptions(options: MdtChartsIntervalOptions, designerConfig: DesignerConfig, modelInstance: ModelInstance): IntervalOptionsModel;
|
|
7
7
|
static getAdditionalElements(options: MdtChartsIntervalOptions): AdditionalElementsOptions;
|
|
8
8
|
private static getChartsModel;
|
|
9
9
|
}
|
|
@@ -2,12 +2,11 @@ import { AxisModel } from "../featuresModel/axisModel";
|
|
|
2
2
|
import { ChartStyleModelService } from "../chartStyleModel/chartStyleModel";
|
|
3
3
|
import { DataManagerModel } from "../dataManagerModel/dataManagerModel";
|
|
4
4
|
import { AxisType } from "../modelBuilder";
|
|
5
|
-
import { ScaleModel, ScaleType } from "../featuresModel/scaleModel/scaleModel";
|
|
6
5
|
import { TwoDimensionalModel } from "./twoDimensionalModel";
|
|
7
6
|
export class IntervalModel {
|
|
8
|
-
static getOptions(
|
|
9
|
-
const options = config.options;
|
|
7
|
+
static getOptions(options, designerConfig, modelInstance) {
|
|
10
8
|
const canvasModel = modelInstance.canvasModel;
|
|
9
|
+
const dataModelRep = modelInstance.dataModel.repository;
|
|
11
10
|
return {
|
|
12
11
|
legend: canvasModel.legendCanvas.getModel(),
|
|
13
12
|
title: options.title,
|
|
@@ -15,19 +14,19 @@ export class IntervalModel {
|
|
|
15
14
|
orient: options.orientation,
|
|
16
15
|
scale: {
|
|
17
16
|
key: {
|
|
18
|
-
domain:
|
|
17
|
+
domain: modelInstance.dataModel.getAllowableKeys(),
|
|
19
18
|
range: {
|
|
20
19
|
start: 0,
|
|
21
|
-
end:
|
|
20
|
+
end: 0
|
|
22
21
|
},
|
|
23
22
|
type: 'band',
|
|
24
23
|
elementsAmount: 1
|
|
25
24
|
},
|
|
26
25
|
value: {
|
|
27
|
-
domain:
|
|
26
|
+
domain: [],
|
|
28
27
|
range: {
|
|
29
28
|
start: 0,
|
|
30
|
-
end:
|
|
29
|
+
end: 0
|
|
31
30
|
},
|
|
32
31
|
type: 'datetime'
|
|
33
32
|
}
|
|
@@ -43,8 +42,8 @@ export class IntervalModel {
|
|
|
43
42
|
cssClass: 'key-axis',
|
|
44
43
|
ticks: options.axis.key.ticks,
|
|
45
44
|
labels: {
|
|
46
|
-
maxSize: AxisModel.getLabelSize(designerConfig.canvas.axisLabel.maxSize.main,
|
|
47
|
-
position: AxisModel.getKeyAxisLabelPosition(canvasModel, DataManagerModel.getDataValuesByKeyField(
|
|
45
|
+
maxSize: AxisModel.getLabelSize(designerConfig.canvas.axisLabel.maxSize.main, dataModelRep.getScopedRows().map(d => d[options.data.keyField.name])).width,
|
|
46
|
+
position: AxisModel.getKeyAxisLabelPosition(canvasModel, DataManagerModel.getDataValuesByKeyField(dataModelRep.getScopedFullSource(), options.data.dataSource, options.data.keyField.name).length),
|
|
48
47
|
visible: true,
|
|
49
48
|
defaultTooltip: designerConfig.elementsOptions.tooltip.position === 'fixed'
|
|
50
49
|
},
|
|
@@ -4,14 +4,25 @@ export class DonutAggregatorService {
|
|
|
4
4
|
if (!(aggregatorOptions === null || aggregatorOptions === void 0 ? void 0 : aggregatorOptions.content) || !dataOptions.rows)
|
|
5
5
|
return this.generateDefaultContent(dataOptions);
|
|
6
6
|
const content = aggregatorOptions.content({ data: dataOptions.rows });
|
|
7
|
-
if (this.doesValueExist(content.value) && content.title)
|
|
8
|
-
return
|
|
7
|
+
if (!content || (!this.doesValueExist(content.value) && !content.title))
|
|
8
|
+
return this.generateDefaultContent(dataOptions);
|
|
9
|
+
if (this.doesValueExist(content.value) && content.title) {
|
|
10
|
+
return {
|
|
11
|
+
title: content.title,
|
|
12
|
+
value: content.value
|
|
13
|
+
};
|
|
14
|
+
}
|
|
9
15
|
if (!content.title && this.doesValueExist(content.value))
|
|
10
16
|
return {
|
|
11
17
|
value: content.value,
|
|
12
18
|
title: AGGREGATOR_DEFAULT_TITLE
|
|
13
19
|
};
|
|
14
|
-
|
|
20
|
+
if (!this.doesValueExist(content.value) && content.title) {
|
|
21
|
+
return {
|
|
22
|
+
value: this.getDefaultValue(dataOptions),
|
|
23
|
+
title: content.title
|
|
24
|
+
};
|
|
25
|
+
}
|
|
15
26
|
}
|
|
16
27
|
doesValueExist(content) {
|
|
17
28
|
return content != null;
|
|
@@ -19,7 +30,11 @@ export class DonutAggregatorService {
|
|
|
19
30
|
generateDefaultContent(dataOptions) {
|
|
20
31
|
return {
|
|
21
32
|
title: AGGREGATOR_DEFAULT_TITLE,
|
|
22
|
-
value: dataOptions.rows ?
|
|
33
|
+
value: dataOptions.rows ? this.getDefaultValue(dataOptions) : 0
|
|
23
34
|
};
|
|
24
35
|
}
|
|
36
|
+
getDefaultValue(dataOptions) {
|
|
37
|
+
const totalSumOfValues = dataOptions.rows.reduce((acc, row) => acc + row[dataOptions.valueFieldName], 0);
|
|
38
|
+
return totalSumOfValues;
|
|
39
|
+
}
|
|
25
40
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ChartOrientation,
|
|
1
|
+
import { ChartOrientation, MdtChartsTwoDimensionalChart, MdtChartsTwoDimensionalOptions } from "../../config/config";
|
|
2
2
|
import { BarOptionsCanvas, DesignerConfig } from "../../designer/designerConfig";
|
|
3
3
|
import { TwoDimensionalOptionsModel, TwoDimChartElementsSettings } from "../model";
|
|
4
4
|
import { ModelInstance } from "../modelInstance/modelInstance";
|
|
5
5
|
export declare class TwoDimensionalModel {
|
|
6
|
-
static getOptions(options: MdtChartsTwoDimensionalOptions, designerConfig: DesignerConfig,
|
|
6
|
+
static getOptions(options: MdtChartsTwoDimensionalOptions, designerConfig: DesignerConfig, modelInstance: ModelInstance): TwoDimensionalOptionsModel;
|
|
7
7
|
static getChartsEmbeddedLabelsFlag(charts: MdtChartsTwoDimensionalChart[], chartOrientation: ChartOrientation): boolean;
|
|
8
8
|
/**
|
|
9
9
|
* Сортирует список чартов в порядке: area - bar - line.
|
|
@@ -4,9 +4,11 @@ import { AxisModel } from "../featuresModel/axisModel";
|
|
|
4
4
|
import { ScaleAxisRecalcer } from "../featuresModel/scaleModel/scaleAxisRecalcer";
|
|
5
5
|
import { ScaleModel } from "../featuresModel/scaleModel/scaleModel";
|
|
6
6
|
export class TwoDimensionalModel {
|
|
7
|
-
static getOptions(options, designerConfig,
|
|
7
|
+
static getOptions(options, designerConfig, modelInstance) {
|
|
8
8
|
const canvasModel = modelInstance.canvasModel;
|
|
9
|
-
const
|
|
9
|
+
const dataModelRep = modelInstance.dataModel.repository;
|
|
10
|
+
const scaleModel = new ScaleModel();
|
|
11
|
+
const scaleMarginRecalcer = new ScaleAxisRecalcer(() => scaleModel.getScaleLinear(options, dataModelRep.getScopedRows(), canvasModel));
|
|
10
12
|
scaleMarginRecalcer.recalculateMargin(canvasModel, options.orientation, options.axis.key);
|
|
11
13
|
const scaleValueInfo = scaleMarginRecalcer.getScaleValue();
|
|
12
14
|
return {
|
|
@@ -15,11 +17,11 @@ export class TwoDimensionalModel {
|
|
|
15
17
|
selectable: !!options.selectable,
|
|
16
18
|
orient: options.orientation,
|
|
17
19
|
scale: {
|
|
18
|
-
key:
|
|
20
|
+
key: scaleModel.getScaleKey(modelInstance.dataModel.getAllowableKeys(), options.orientation, canvasModel, options.charts, this.getChartsByType(options.charts, 'bar')),
|
|
19
21
|
value: scaleValueInfo.scale
|
|
20
22
|
},
|
|
21
23
|
axis: {
|
|
22
|
-
key: AxisModel.getKeyAxis(options,
|
|
24
|
+
key: AxisModel.getKeyAxis(options, dataModelRep.getScopedFullSource(), designerConfig.canvas.axisLabel, canvasModel, designerConfig.elementsOptions.tooltip, () => scaleValueInfo.scaleFn(0)),
|
|
23
25
|
value: AxisModel.getValueAxis(options.orientation, options.axis.value, designerConfig.canvas.axisLabel, canvasModel)
|
|
24
26
|
},
|
|
25
27
|
type: options.type,
|
|
@@ -109,14 +109,14 @@
|
|
|
109
109
|
|
|
110
110
|
|
|
111
111
|
/*========================================================================= Tooltip */
|
|
112
|
-
.tooltip-block {
|
|
112
|
+
.mdt-charts-tooltip-block {
|
|
113
113
|
pointer-events: none;
|
|
114
114
|
z-index: 100;
|
|
115
115
|
filter: drop-shadow(0px 4px 10px rgba(0, 0, 0, 0.1));
|
|
116
116
|
width: max-content;
|
|
117
117
|
max-width: 500px;
|
|
118
118
|
}
|
|
119
|
-
.tooltip-content {
|
|
119
|
+
.mdt-charts-tooltip-content {
|
|
120
120
|
position: relative;
|
|
121
121
|
pointer-events: none;
|
|
122
122
|
font-family: "Roboto", sans-serif;
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
background: rgba(0, 0, 0, 0.82);
|
|
129
129
|
font-size: 11px;
|
|
130
130
|
}
|
|
131
|
-
.tooltip-arrow {
|
|
131
|
+
.mdt-charts-tooltip-arrow {
|
|
132
132
|
width: 0;
|
|
133
133
|
height: 0;
|
|
134
134
|
border-style: solid;
|
|
@@ -159,26 +159,26 @@
|
|
|
159
159
|
font-weight: 400;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
.tooltip-line {
|
|
162
|
+
.mdt-charts-tooltip-line {
|
|
163
163
|
stroke: #AAA;
|
|
164
164
|
stroke-width: 1px;
|
|
165
165
|
stroke-linecap: round;
|
|
166
166
|
}
|
|
167
|
-
.tooltip-content .tooltip-head {
|
|
167
|
+
.mdt-charts-tooltip-content .tooltip-head {
|
|
168
168
|
font-size: 12px;
|
|
169
169
|
margin-bottom: 10px;
|
|
170
170
|
}
|
|
171
|
-
.tooltip-content .tooltip-texts {
|
|
171
|
+
.mdt-charts-tooltip-content .tooltip-texts {
|
|
172
172
|
width: 100%;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
.tooltip-content .tooltip-text-item > span {
|
|
175
|
+
.mdt-charts-tooltip-content .tooltip-text-item > span {
|
|
176
176
|
display: block;
|
|
177
177
|
}
|
|
178
|
-
.tooltip-content .tooltip-text-item > span:first-of-type {
|
|
178
|
+
.mdt-charts-tooltip-content .tooltip-text-item > span:first-of-type {
|
|
179
179
|
flex: 1;
|
|
180
180
|
}
|
|
181
|
-
.tooltip-content .tooltip-text-item > span:last-of-type {
|
|
181
|
+
.mdt-charts-tooltip-content .tooltip-text-item > span:last-of-type {
|
|
182
182
|
flex: 0;
|
|
183
183
|
}
|
|
184
184
|
.tooltip-field-value {
|
|
@@ -109,14 +109,14 @@
|
|
|
109
109
|
|
|
110
110
|
|
|
111
111
|
/*========================================================================= Tooltip */
|
|
112
|
-
.tooltip-block {
|
|
112
|
+
.mdt-charts-tooltip-block {
|
|
113
113
|
pointer-events: none;
|
|
114
114
|
z-index: 100;
|
|
115
115
|
filter: drop-shadow(0px 4px 10px rgba(0, 0, 0, 0.1));
|
|
116
116
|
width: max-content;
|
|
117
117
|
max-width: 500px;
|
|
118
118
|
}
|
|
119
|
-
.tooltip-content {
|
|
119
|
+
.mdt-charts-tooltip-content {
|
|
120
120
|
position: relative;
|
|
121
121
|
pointer-events: none;
|
|
122
122
|
font-family: "Roboto", sans-serif;
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
background: rgba(0, 0, 0, 0.82);
|
|
129
129
|
font-size: 11px;
|
|
130
130
|
}
|
|
131
|
-
.tooltip-arrow {
|
|
131
|
+
.mdt-charts-tooltip-arrow {
|
|
132
132
|
width: 0;
|
|
133
133
|
height: 0;
|
|
134
134
|
border-style: solid;
|
|
@@ -159,26 +159,26 @@
|
|
|
159
159
|
font-weight: 400;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
.tooltip-line {
|
|
162
|
+
.mdt-charts-tooltip-line {
|
|
163
163
|
stroke: #AAA;
|
|
164
164
|
stroke-width: 1px;
|
|
165
165
|
stroke-linecap: round;
|
|
166
166
|
}
|
|
167
|
-
.tooltip-content .tooltip-head {
|
|
167
|
+
.mdt-charts-tooltip-content .tooltip-head {
|
|
168
168
|
font-size: 12px;
|
|
169
169
|
margin-bottom: 10px;
|
|
170
170
|
}
|
|
171
|
-
.tooltip-content .tooltip-texts {
|
|
171
|
+
.mdt-charts-tooltip-content .tooltip-texts {
|
|
172
172
|
width: 100%;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
.tooltip-content .tooltip-text-item > span {
|
|
175
|
+
.mdt-charts-tooltip-content .tooltip-text-item > span {
|
|
176
176
|
display: block;
|
|
177
177
|
}
|
|
178
|
-
.tooltip-content .tooltip-text-item > span:first-of-type {
|
|
178
|
+
.mdt-charts-tooltip-content .tooltip-text-item > span:first-of-type {
|
|
179
179
|
flex: 1;
|
|
180
180
|
}
|
|
181
|
-
.tooltip-content .tooltip-text-item > span:last-of-type {
|
|
181
|
+
.mdt-charts-tooltip-content .tooltip-text-item > span:last-of-type {
|
|
182
182
|
flex: 0;
|
|
183
183
|
}
|
|
184
184
|
.tooltip-field-value {
|
package/package.json
CHANGED