mdt-charts 1.12.14 → 1.12.17
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 +42 -8
- package/lib/engine/block/block.d.ts +4 -13
- package/lib/engine/block/block.js +12 -61
- package/lib/engine/block/blockHtml.d.ts +14 -0
- package/lib/engine/block/blockHtml.js +18 -0
- package/lib/engine/block/blockSvg.d.ts +26 -0
- package/lib/engine/block/blockSvg.js +69 -0
- package/lib/engine/cardsNotation/card/card.d.ts +30 -0
- package/lib/engine/cardsNotation/card/card.js +97 -0
- package/lib/engine/cardsNotation/card/cardChange.d.ts +21 -0
- package/lib/engine/cardsNotation/card/cardChange.js +72 -0
- package/lib/engine/cardsNotation/card/cardElementsStyler.d.ts +6 -0
- package/lib/engine/cardsNotation/card/cardElementsStyler.js +11 -0
- package/lib/engine/cardsNotation/card/cardService.d.ts +11 -0
- package/lib/engine/cardsNotation/card/cardService.js +12 -0
- package/lib/engine/cardsNotation/cardsManager.d.ts +11 -0
- package/lib/engine/cardsNotation/cardsManager.js +14 -0
- package/lib/engine/contentManager/contentManager.d.ts +11 -0
- package/lib/engine/contentManager/contentManager.js +15 -0
- package/lib/engine/contentManager/contentManagerFactory.d.ts +14 -0
- package/lib/engine/contentManager/contentManagerFactory.js +22 -0
- package/lib/engine/engine.d.ts +4 -3
- package/lib/engine/engine.js +12 -8
- package/lib/engine/features/embeddedLabels/embeddedLabels.js +6 -6
- package/lib/engine/features/legend/legend.js +1 -1
- package/lib/engine/features/markDots/markDot.js +4 -4
- package/lib/engine/features/tolltip/newTooltip/newTooltip.js +1 -1
- package/lib/engine/features/tolltip/tooltip.d.ts +6 -6
- package/lib/engine/features/tolltip/tooltip.js +4 -7
- package/lib/engine/features/tolltip/tooltipComponentsManager.js +2 -2
- package/lib/engine/helpers/fontResizer/fontResizer.d.ts +16 -0
- package/lib/engine/helpers/fontResizer/fontResizer.js +21 -0
- package/lib/engine/helpers/fontResizer/fontResizerService.d.ts +6 -0
- package/lib/engine/helpers/fontResizer/fontResizerService.js +12 -0
- package/lib/engine/helpers/namesHelper.js +1 -1
- package/lib/engine/intervalNotation/gantt.js +2 -2
- package/lib/engine/intervalNotation/intervalManager.js +2 -4
- package/lib/engine/polarNotation/polarManager.d.ts +8 -7
- package/lib/engine/polarNotation/polarManager.js +5 -5
- package/lib/engine/twoDimensionalNotation/area/area.js +7 -7
- package/lib/engine/twoDimensionalNotation/bar/bar.js +11 -11
- package/lib/engine/twoDimensionalNotation/line/line.d.ts +1 -1
- package/lib/engine/twoDimensionalNotation/line/line.js +9 -9
- package/lib/engine/twoDimensionalNotation/twoDimensionalManager.d.ts +9 -8
- package/lib/engine/twoDimensionalNotation/twoDimensionalManager.js +9 -9
- package/lib/main.js +1 -1
- package/lib/model/chartStyleModel/chartStyleModel.d.ts +1 -1
- package/lib/model/chartStyleModel/chartStyleModel.js +2 -2
- package/lib/model/chartStyleModel/colorRange.d.ts +7 -0
- package/lib/model/chartStyleModel/colorRange.js +30 -0
- package/lib/model/dataManagerModel/dataManagerModel.js +7 -0
- package/lib/model/dataManagerModel/notations/cardsDataManagerModel.d.ts +5 -0
- package/lib/model/dataManagerModel/notations/cardsDataManagerModel.js +10 -0
- package/lib/model/featuresModel/legendModel/legendModel.d.ts +2 -1
- package/lib/model/featuresModel/legendModel/legendModel.js +7 -0
- package/lib/model/featuresModel/legendModel/polarMarginCalculator.js +2 -3
- package/lib/model/featuresModel/legendModel/twoDimLegendModel.d.ts +2 -1
- package/lib/model/featuresModel/legendModel/twoDimLegendModel.js +7 -6
- 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 +5 -6
- package/lib/model/margin/marginModel.js +10 -16
- package/lib/model/margin/twoDim/twoDimMarginModel.js +1 -1
- package/lib/model/model.d.ts +25 -8
- package/lib/model/modelBuilder.js +7 -2
- 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/model/modelInstance/canvasModel/canvasSizesModel/canvasMarginModel.js +1 -0
- package/lib/model/modelInstance/canvasModel/canvasSizesModel/canvasSizeModel.d.ts +4 -0
- package/lib/model/modelInstance/canvasModel/canvasSizesModel/canvasSizeModel.js +1 -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/modelInstance/dataModel/dataRepository.d.ts +1 -0
- package/lib/model/modelInstance/dataModel/dataRepository.js +3 -0
- package/lib/model/notations/cards/cardsChangeService.d.ts +10 -0
- package/lib/model/notations/cards/cardsChangeService.js +50 -0
- package/lib/model/notations/cards/cardsModel.d.ts +8 -0
- package/lib/model/notations/cards/cardsModel.js +19 -0
- package/lib/model/notations/cards/cardsModelService.d.ts +6 -0
- package/lib/model/notations/cards/cardsModelService.js +10 -0
- package/lib/model/notations/intervalModel.js +3 -4
- package/lib/model/notations/twoDimensionalModel.js +3 -2
- package/lib/optionsServices/publicOptionsService.d.ts +1 -1
- package/lib/optionsServices/validators/sizeValidator.d.ts +1 -1
- package/lib/style/charts-main.css +84 -14
- package/lib/style/charts-main.less +84 -14
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ export declare class Line {
|
|
|
10
10
|
private static renderGrouped;
|
|
11
11
|
private static renderSegmented;
|
|
12
12
|
private static updateGrouped;
|
|
13
|
-
private static
|
|
13
|
+
private static updateSegmented;
|
|
14
14
|
private static updateGroupedPath;
|
|
15
15
|
private static updateSegmentedPath;
|
|
16
16
|
private static setSegmentColor;
|
|
@@ -14,7 +14,7 @@ export class Line {
|
|
|
14
14
|
static update(block, scales, newData, keyField, margin, keyAxisOrient, chart) {
|
|
15
15
|
let promises;
|
|
16
16
|
if (chart.isSegmented) {
|
|
17
|
-
promises = this.
|
|
17
|
+
promises = this.updateSegmented(block, scales, newData, keyField, margin, keyAxisOrient, chart);
|
|
18
18
|
}
|
|
19
19
|
else {
|
|
20
20
|
promises = this.updateGrouped(block, scales, newData, keyField, margin, keyAxisOrient, chart);
|
|
@@ -23,7 +23,7 @@ export class Line {
|
|
|
23
23
|
}
|
|
24
24
|
static updateColors(block, chart) {
|
|
25
25
|
chart.data.valueFields.forEach((_vf, valueIndex) => {
|
|
26
|
-
const path = block.getChartGroup(chart.index)
|
|
26
|
+
const path = block.svg.getChartGroup(chart.index)
|
|
27
27
|
.select(`.${this.lineChartClass}${Helper.getCssClassesLine(chart.cssClasses)}.chart-element-${valueIndex}`);
|
|
28
28
|
DomHelper.setChartStyle(path, chart.style, valueIndex, 'stroke');
|
|
29
29
|
MarkDot.updateColors(block, chart, valueIndex);
|
|
@@ -32,12 +32,12 @@ export class Line {
|
|
|
32
32
|
static renderGrouped(block, scales, data, keyField, margin, keyAxisOrient, chart) {
|
|
33
33
|
chart.data.valueFields.forEach((valueField, valueIndex) => {
|
|
34
34
|
const lineGenerator = LineHelper.getLineGenerator(keyAxisOrient, scales, keyField.name, valueField.name, margin);
|
|
35
|
-
const path = block.getChartGroup(chart.index)
|
|
35
|
+
const path = block.svg.getChartGroup(chart.index)
|
|
36
36
|
.append('path')
|
|
37
37
|
.attr('d', lineGenerator(data))
|
|
38
38
|
.attr('class', this.lineChartClass)
|
|
39
39
|
.style('fill', 'none')
|
|
40
|
-
.style('clip-path', `url(#${block.getClipPathId()})`)
|
|
40
|
+
.style('clip-path', `url(#${block.svg.getClipPathId()})`)
|
|
41
41
|
.style('pointer-events', 'none');
|
|
42
42
|
DomHelper.setCssClasses(path, Helper.getCssClassesWithElementIndex(chart.cssClasses, valueIndex));
|
|
43
43
|
DomHelper.setChartStyle(path, chart.style, valueIndex, 'stroke');
|
|
@@ -47,7 +47,7 @@ export class Line {
|
|
|
47
47
|
static renderSegmented(block, scales, data, keyField, margin, keyAxisOrient, chart) {
|
|
48
48
|
const stackedData = stack().keys(chart.data.valueFields.map(field => field.name))(data);
|
|
49
49
|
const lineGenerator = LineHelper.getSegmentedLineGenerator(keyAxisOrient, scales, keyField.name, margin);
|
|
50
|
-
const lines = block.getChartGroup(chart.index)
|
|
50
|
+
const lines = block.svg.getChartGroup(chart.index)
|
|
51
51
|
.selectAll(`.${this.lineChartClass}${Helper.getCssClassesLine(chart.cssClasses)}`)
|
|
52
52
|
.data(stackedData)
|
|
53
53
|
.enter()
|
|
@@ -55,7 +55,7 @@ export class Line {
|
|
|
55
55
|
.attr('d', d => lineGenerator(d))
|
|
56
56
|
.attr('class', this.lineChartClass)
|
|
57
57
|
.style('fill', 'none')
|
|
58
|
-
.style('clip-path', `url(#${block.getClipPathId()})`)
|
|
58
|
+
.style('clip-path', `url(#${block.svg.getClipPathId()})`)
|
|
59
59
|
.style('pointer-events', 'none');
|
|
60
60
|
lines.each(function (d, i) {
|
|
61
61
|
DomHelper.setCssClasses(select(this), Helper.getCssClassesWithElementIndex(chart.cssClasses, i));
|
|
@@ -69,7 +69,7 @@ export class Line {
|
|
|
69
69
|
const promises = [];
|
|
70
70
|
chart.data.valueFields.forEach((valueField, valueFieldIndex) => {
|
|
71
71
|
const lineGenerator = LineHelper.getLineGenerator(keyAxisOrient, scales, keyField.name, valueField.name, margin);
|
|
72
|
-
const lineObject = block.getChartGroup(chart.index)
|
|
72
|
+
const lineObject = block.svg.getChartGroup(chart.index)
|
|
73
73
|
.select(`.${this.lineChartClass}${Helper.getCssClassesLine(chart.cssClasses)}.chart-element-${valueFieldIndex}`);
|
|
74
74
|
const prom = this.updateGroupedPath(block, lineObject, lineGenerator, newData);
|
|
75
75
|
promises.push(prom);
|
|
@@ -77,10 +77,10 @@ export class Line {
|
|
|
77
77
|
});
|
|
78
78
|
return promises;
|
|
79
79
|
}
|
|
80
|
-
static
|
|
80
|
+
static updateSegmented(block, scales, newData, keyField, margin, keyAxisOrient, chart) {
|
|
81
81
|
const stackedData = stack().keys(chart.data.valueFields.map(field => field.name))(newData);
|
|
82
82
|
const lineGenerator = LineHelper.getSegmentedLineGenerator(keyAxisOrient, scales, keyField.name, margin);
|
|
83
|
-
const lines = block.getChartGroup(chart.index)
|
|
83
|
+
const lines = block.svg.getChartGroup(chart.index)
|
|
84
84
|
.selectAll(`path.${this.lineChartClass}${Helper.getCssClassesLine(chart.cssClasses)}`)
|
|
85
85
|
.data(stackedData);
|
|
86
86
|
const prom = this.updateSegmentedPath(block, lines, lineGenerator);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { MdtChartsDataSource } from "../../config/config";
|
|
2
|
-
import { Model } from "../../model/model";
|
|
2
|
+
import { Model, TwoDimensionalOptionsModel } from "../../model/model";
|
|
3
3
|
import { Block } from "../block/block";
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
private
|
|
4
|
+
import { ChartContentManager } from "../contentManager/contentManagerFactory";
|
|
5
|
+
import { Engine } from "../engine";
|
|
6
|
+
export declare class TwoDimensionalManager implements ChartContentManager {
|
|
7
|
+
render(engine: Engine, model: Model<TwoDimensionalOptionsModel>): void;
|
|
8
|
+
updateData(block: Block, model: Model<TwoDimensionalOptionsModel>, data: MdtChartsDataSource): void;
|
|
9
|
+
updateColors(block: Block, model: Model<TwoDimensionalOptionsModel>): void;
|
|
10
|
+
private renderCharts;
|
|
11
|
+
private updateCharts;
|
|
11
12
|
}
|
|
@@ -14,11 +14,11 @@ import { BarHelper } from "./bar/barHelper";
|
|
|
14
14
|
import { TwoDimRecordOverflowAlert } from "./extenders/twoDimRecordOverflowAlert";
|
|
15
15
|
import { Line } from "./line/line";
|
|
16
16
|
export class TwoDimensionalManager {
|
|
17
|
-
|
|
17
|
+
render(engine, model) {
|
|
18
18
|
const options = model.options;
|
|
19
19
|
const scales = Scale.getScales(options.scale.key, options.scale.value, options.chartSettings.bar);
|
|
20
20
|
engine.block.scales = scales;
|
|
21
|
-
engine.block.
|
|
21
|
+
engine.block.svg.render(model.blockCanvas.size);
|
|
22
22
|
Axis.render(engine.block, scales, options.scale, options.axis, model.blockCanvas.size);
|
|
23
23
|
GridLine.render(engine.block, options.additionalElements.gridLine.flag, options.axis, model.blockCanvas.size, model.chartBlock.margin, scales);
|
|
24
24
|
this.renderCharts(engine.block, options.charts, scales, engine.data, options.data, model.chartBlock.margin, options.axis.key.orient, options.chartSettings.bar, model.blockCanvas.size);
|
|
@@ -39,7 +39,7 @@ export class TwoDimensionalManager {
|
|
|
39
39
|
engine.block.filterEventManager.clearKeysFor2D(options);
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
updateData(block, model, data) {
|
|
43
43
|
block.transitionManager.interruptTransitions();
|
|
44
44
|
block.filterEventManager.updateData(data[model.options.data.dataSource]);
|
|
45
45
|
TipBox.clearEvents(block);
|
|
@@ -63,7 +63,7 @@ export class TwoDimensionalManager {
|
|
|
63
63
|
chartOrientation: options.orient
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
updateColors(block, model) {
|
|
67
67
|
Legend.updateColors(block, model.options);
|
|
68
68
|
model.options.charts.forEach(chart => {
|
|
69
69
|
if (chart.type === 'bar')
|
|
@@ -74,9 +74,9 @@ export class TwoDimensionalManager {
|
|
|
74
74
|
Area.updateColors(block, chart);
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
block.renderChartClipPath(margin, blockSize);
|
|
79
|
-
block.renderChartsBlock();
|
|
77
|
+
renderCharts(block, charts, scales, data, dataOptions, margin, keyAxisOrient, barSettings, blockSize) {
|
|
78
|
+
block.svg.renderChartClipPath(margin, blockSize);
|
|
79
|
+
block.svg.renderChartsBlock();
|
|
80
80
|
charts.forEach((chart) => {
|
|
81
81
|
if (chart.type === 'bar')
|
|
82
82
|
Bar.render(block, scales, data[dataOptions.dataSource], dataOptions.keyField, margin, keyAxisOrient, chart, blockSize, barSettings, BarHelper.getBarsInGroupAmount(charts), chart.isSegmented, charts.findIndex(ch => ch.type === 'bar'));
|
|
@@ -87,8 +87,8 @@ export class TwoDimensionalManager {
|
|
|
87
87
|
});
|
|
88
88
|
EmbeddedLabels.raiseGroups(block);
|
|
89
89
|
}
|
|
90
|
-
|
|
91
|
-
block.updateChartClipPath(margin, blockSize);
|
|
90
|
+
updateCharts(block, charts, scales, data, dataOptions, margin, keyAxisOrient, blockSize, barSettings) {
|
|
91
|
+
block.svg.updateChartClipPath(margin, blockSize);
|
|
92
92
|
let promises = [];
|
|
93
93
|
charts.forEach((chart) => {
|
|
94
94
|
let proms;
|
package/lib/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChartStyleConfig } from "../../designer/designerConfig";
|
|
2
2
|
import { ChartStyle } from "../model";
|
|
3
3
|
export declare class ChartStyleModelService {
|
|
4
|
-
private static
|
|
4
|
+
private static standardColors;
|
|
5
5
|
static getCssClasses(chartIndex: number): string[];
|
|
6
6
|
static getChartStyle(elementsAmount: number, styleConfig: ChartStyleConfig): ChartStyle;
|
|
7
7
|
static getColorSet(baseColors: string[], elementsAmount: number): string[];
|
|
@@ -19,9 +19,9 @@ export class ChartStyleModelService {
|
|
|
19
19
|
}
|
|
20
20
|
static checkAndGet(baseColors) {
|
|
21
21
|
if (baseColors.length === 0 || baseColors.filter(color => color === 'rgba(0, 0, 0, 0)' || !color).length > 0) {
|
|
22
|
-
return this.
|
|
22
|
+
return this.standardColors;
|
|
23
23
|
}
|
|
24
24
|
return baseColors;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
ChartStyleModelService.
|
|
27
|
+
ChartStyleModelService.standardColors = ["#209DE3", "#FF3131", "#FFBA00", "#20B078"];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MdtChartsColorRangeItem } from "../../config/config";
|
|
2
|
+
export declare class ColorRangeManager {
|
|
3
|
+
private sortedRange;
|
|
4
|
+
constructor(range: MdtChartsColorRangeItem[]);
|
|
5
|
+
getColorByValue(value: number): string;
|
|
6
|
+
}
|
|
7
|
+
export declare function sortColorRange(colorRange: MdtChartsColorRangeItem[]): MdtChartsColorRangeItem[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class ColorRangeManager {
|
|
2
|
+
constructor(range) {
|
|
3
|
+
this.sortedRange = sortColorRange(range);
|
|
4
|
+
}
|
|
5
|
+
getColorByValue(value) {
|
|
6
|
+
for (let i = 0; i < this.sortedRange.length; i++) {
|
|
7
|
+
const currentItem = this.sortedRange[i];
|
|
8
|
+
const nextItem = this.sortedRange[i + 1];
|
|
9
|
+
if (!nextItem)
|
|
10
|
+
return currentItem.color;
|
|
11
|
+
if (currentItem.value == null && value < nextItem.value)
|
|
12
|
+
return currentItem.color;
|
|
13
|
+
if (currentItem.value === value)
|
|
14
|
+
return currentItem.color;
|
|
15
|
+
if (value >= currentItem.value && value < nextItem.value)
|
|
16
|
+
return currentItem.color;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function sortColorRange(colorRange) {
|
|
21
|
+
const range = [...colorRange];
|
|
22
|
+
range.sort((a, b) => {
|
|
23
|
+
if (a.value == null)
|
|
24
|
+
return -1;
|
|
25
|
+
return a.value < b.value
|
|
26
|
+
? -1
|
|
27
|
+
: (a.value == b.value ? 0 : 1);
|
|
28
|
+
});
|
|
29
|
+
return range;
|
|
30
|
+
}
|
|
@@ -4,6 +4,7 @@ import { ModelHelper } from "../helpers/modelHelper";
|
|
|
4
4
|
import { MIN_DONUT_BLOCK_SIZE, PolarModel } from "../notations/polar/polarModel";
|
|
5
5
|
import { DataManagerModelService } from "./dataManagerModelService";
|
|
6
6
|
import { LegendPolarMarginCalculator } from "../featuresModel/legendModel/polarMarginCalculator";
|
|
7
|
+
import { CardsDataManagerModel } from "./notations/cardsDataManagerModel";
|
|
7
8
|
export class DataManagerModel {
|
|
8
9
|
static getPreparedData(data, allowableKeys, config) {
|
|
9
10
|
const scopedData = this.getScopedData(data, allowableKeys, config);
|
|
@@ -17,6 +18,10 @@ export class DataManagerModel {
|
|
|
17
18
|
else if (config.options.type === 'polar') {
|
|
18
19
|
this.initDataScopeForPolar(config.options, modelInstance, data, legendBlock, designerConfig.canvas.legendBlock);
|
|
19
20
|
}
|
|
21
|
+
else if (config.options.type === "card") {
|
|
22
|
+
const manager = new CardsDataManagerModel();
|
|
23
|
+
manager.initDataScope(modelInstance, data, config.options);
|
|
24
|
+
}
|
|
20
25
|
this.initScopedData(data, modelInstance, config);
|
|
21
26
|
}
|
|
22
27
|
static initScopedData(data, modelInstance, config) {
|
|
@@ -54,6 +59,7 @@ export class DataManagerModel {
|
|
|
54
59
|
const keyFieldName = configOptions.data.keyField.name;
|
|
55
60
|
const keys = data[configOptions.data.dataSource].map(dataRow => dataRow[keyFieldName]);
|
|
56
61
|
if (!configOptions.legend.show) {
|
|
62
|
+
canvasModel.legendCanvas.setPosition("off");
|
|
57
63
|
modelInstance.dataModel.initScope(this.getMaximumPossibleScope(keys, modelInstance.dataModel));
|
|
58
64
|
return;
|
|
59
65
|
}
|
|
@@ -71,6 +77,7 @@ export class DataManagerModel {
|
|
|
71
77
|
//TODO: global refactor of method
|
|
72
78
|
const allowableKeys = keys.slice(0, maxItemsNumber);
|
|
73
79
|
const hidedRecordsAmount = keys.length - maxItemsNumber;
|
|
80
|
+
canvasModel.legendCanvas.setPosition(position);
|
|
74
81
|
this.polarMarginCalculator.updateMargin(position, canvasModel, legendBlock, position === "bottom" ? size.height : size.width);
|
|
75
82
|
modelInstance.dataModel.initScope(this.limitAllowableKeys(allowableKeys, hidedRecordsAmount, modelInstance.dataModel));
|
|
76
83
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MdtChartsCardsOptions, MdtChartsDataSource } from "../../../config/config";
|
|
2
|
+
import { ModelInstance } from "../../modelInstance/modelInstance";
|
|
3
|
+
export declare class CardsDataManagerModel {
|
|
4
|
+
initDataScope(modelInstance: ModelInstance, data: MdtChartsDataSource, configOptions: MdtChartsCardsOptions): void;
|
|
5
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DataManagerModel } from "../dataManagerModel";
|
|
2
|
+
export class CardsDataManagerModel {
|
|
3
|
+
initDataScope(modelInstance, data, configOptions) {
|
|
4
|
+
const firstKey = DataManagerModel.getDataValuesByKeyField(data, configOptions.data.dataSource, configOptions.data.keyField.name)[0];
|
|
5
|
+
modelInstance.dataModel.initScope({
|
|
6
|
+
allowableKeys: [firstKey],
|
|
7
|
+
hidedRecordsAmount: 0
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { LegendBlockModel } from "../../model";
|
|
1
|
+
import { LegendBlockModel, Orient } from "../../model";
|
|
2
2
|
import { CanvasModel } from "../../modelInstance/canvasModel/canvasModel";
|
|
3
3
|
import { LegendItemsDirection } from "./legendCanvasModel";
|
|
4
4
|
export declare class LegendModel {
|
|
5
5
|
static getBaseLegendBlockModel(canvasModel: CanvasModel): LegendBlockModel;
|
|
6
6
|
static getLegendItemClass(itemsPosition: LegendItemsDirection): string;
|
|
7
|
+
static appendToGlobalMarginValuesLegendMargin(canvasModel: CanvasModel, position: Orient, legendBlockModel: LegendBlockModel): void;
|
|
7
8
|
}
|
|
@@ -29,4 +29,11 @@ export class LegendModel {
|
|
|
29
29
|
static getLegendItemClass(itemsPosition) {
|
|
30
30
|
return itemsPosition === 'column' ? 'legend-item-row' : 'legend-item-inline';
|
|
31
31
|
}
|
|
32
|
+
static appendToGlobalMarginValuesLegendMargin(canvasModel, position, legendBlockModel) {
|
|
33
|
+
const legendCoordinate = legendBlockModel.coordinate;
|
|
34
|
+
if (position === 'left' || position === 'right')
|
|
35
|
+
canvasModel.increaseMarginSide(position, legendCoordinate[position].margin.left + legendCoordinate[position].margin.right);
|
|
36
|
+
else
|
|
37
|
+
canvasModel.increaseMarginSide(position, legendCoordinate[position].margin.top + legendCoordinate[position].margin.bottom);
|
|
38
|
+
}
|
|
32
39
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { getPxPercentUnitByValue } from "../../helpers/unitsFromConfigReader";
|
|
2
|
-
import {
|
|
2
|
+
import { LegendModel } from "./legendModel";
|
|
3
3
|
export class LegendPolarMarginCalculator {
|
|
4
4
|
updateMargin(legendPosition, canvasModel, legendBlockModel, size) {
|
|
5
|
-
canvasModel.legendCanvas.setPosition(legendPosition);
|
|
6
5
|
this.updateMarginObj(legendBlockModel, legendPosition, size, canvasModel);
|
|
7
6
|
}
|
|
8
7
|
getMaxLegendWidth(legendCanvas, blockWidth) {
|
|
@@ -18,7 +17,7 @@ export class LegendPolarMarginCalculator {
|
|
|
18
17
|
updateMarginObj(legendBlockModel, legendPosition, legendSize, canvasModel) {
|
|
19
18
|
if (legendSize !== 0) {
|
|
20
19
|
canvasModel.increaseMarginSide(legendPosition, legendSize);
|
|
21
|
-
|
|
20
|
+
LegendModel.appendToGlobalMarginValuesLegendMargin(canvasModel, legendPosition, legendBlockModel);
|
|
22
21
|
}
|
|
23
22
|
legendBlockModel.coordinate[legendPosition].size = legendSize;
|
|
24
23
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { Legend } from "../../../config/config";
|
|
1
2
|
import { LegendBlockModel } from "../../model";
|
|
2
3
|
import { ModelInstance } from "../../modelInstance/modelInstance";
|
|
3
4
|
export declare class TwoDimLegendModel {
|
|
4
|
-
recalcMarginWith2DLegend(modelInstance: ModelInstance, legendBlockModel: LegendBlockModel): void;
|
|
5
|
+
recalcMarginWith2DLegend(modelInstance: ModelInstance, legendBlockModel: LegendBlockModel, legendOptions: Legend): void;
|
|
5
6
|
private getLegendSize;
|
|
6
7
|
private getLegendModel;
|
|
7
8
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LegendModel } from "./legendModel";
|
|
2
2
|
export class TwoDimLegendModel {
|
|
3
|
-
recalcMarginWith2DLegend(modelInstance, legendBlockModel) {
|
|
3
|
+
recalcMarginWith2DLegend(modelInstance, legendBlockModel, legendOptions) {
|
|
4
4
|
const canvasModel = modelInstance.canvasModel;
|
|
5
|
-
const legendPosition = this.getLegendModel().position;
|
|
5
|
+
const legendPosition = this.getLegendModel(legendOptions).position;
|
|
6
6
|
modelInstance.canvasModel.legendCanvas.setPosition(legendPosition);
|
|
7
7
|
if (legendPosition !== 'off') {
|
|
8
8
|
const legendSize = this.getLegendSize();
|
|
9
9
|
canvasModel.increaseMarginSide(legendPosition, legendSize);
|
|
10
10
|
if (legendSize !== 0)
|
|
11
|
-
|
|
11
|
+
LegendModel.appendToGlobalMarginValuesLegendMargin(canvasModel, legendPosition, legendBlockModel);
|
|
12
12
|
legendBlockModel.coordinate[legendPosition].size = legendSize;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -16,9 +16,10 @@ export class TwoDimLegendModel {
|
|
|
16
16
|
const heightOfLegendItemWithoutWordWrapping = 20;
|
|
17
17
|
return heightOfLegendItemWithoutWordWrapping;
|
|
18
18
|
}
|
|
19
|
-
getLegendModel() {
|
|
19
|
+
getLegendModel(legendOptions) {
|
|
20
|
+
const position = legendOptions.show ? "top" : "off";
|
|
20
21
|
return {
|
|
21
|
-
position
|
|
22
|
+
position
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
25
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MdtChartsDataRow, MdtChartsTwoDimensionalChart, MdtChartsTwoDimensionalOptions, NumberDomain } from "../../../config/config";
|
|
2
|
+
export declare function getScaleLinearDomain(configDomain: NumberDomain, dataRows: MdtChartsDataRow[], configOptions: MdtChartsTwoDimensionalOptions): number[];
|
|
3
|
+
export declare class ScaleDomainCalculator {
|
|
4
|
+
getScaleMinValue(charts: MdtChartsTwoDimensionalChart[], dataRows: MdtChartsDataRow[]): number;
|
|
5
|
+
getScaleMaxValue(charts: MdtChartsTwoDimensionalChart[], dataRows: MdtChartsDataRow[]): number;
|
|
6
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export function getScaleLinearDomain(configDomain, dataRows, configOptions) {
|
|
2
|
+
const calculator = new ScaleDomainCalculator();
|
|
3
|
+
let domainPeekMin;
|
|
4
|
+
let domainPeekMax;
|
|
5
|
+
if (configDomain.start === -1)
|
|
6
|
+
domainPeekMin = calculator.getScaleMinValue(configOptions.charts, dataRows);
|
|
7
|
+
else
|
|
8
|
+
domainPeekMin = configDomain.start;
|
|
9
|
+
if (configDomain.end === -1)
|
|
10
|
+
domainPeekMax = calculator.getScaleMaxValue(configOptions.charts, dataRows);
|
|
11
|
+
else
|
|
12
|
+
domainPeekMax = configDomain.end;
|
|
13
|
+
if (configOptions.axis.key.position === 'start')
|
|
14
|
+
return [domainPeekMin, domainPeekMax];
|
|
15
|
+
return [domainPeekMax, domainPeekMin];
|
|
16
|
+
}
|
|
17
|
+
export class ScaleDomainCalculator {
|
|
18
|
+
getScaleMinValue(charts, dataRows) {
|
|
19
|
+
let min = 0;
|
|
20
|
+
charts.forEach(chart => {
|
|
21
|
+
dataRows.forEach(dataRow => {
|
|
22
|
+
let sumInRow = 0;
|
|
23
|
+
chart.data.valueFields.forEach(field => {
|
|
24
|
+
if (chart.isSegmented && dataRow[field.name] < 0) {
|
|
25
|
+
sumInRow += dataRow[field.name];
|
|
26
|
+
}
|
|
27
|
+
else if (dataRow[field.name] < sumInRow)
|
|
28
|
+
sumInRow = dataRow[field.name];
|
|
29
|
+
});
|
|
30
|
+
if (min > sumInRow)
|
|
31
|
+
min = sumInRow;
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
return min;
|
|
35
|
+
}
|
|
36
|
+
getScaleMaxValue(charts, dataRows) {
|
|
37
|
+
let max = 0;
|
|
38
|
+
charts.forEach(chart => {
|
|
39
|
+
dataRows.forEach(dataRow => {
|
|
40
|
+
let sumInRow = 0;
|
|
41
|
+
chart.data.valueFields.forEach(field => {
|
|
42
|
+
if (chart.isSegmented && dataRow[field.name] > 0)
|
|
43
|
+
sumInRow += dataRow[field.name];
|
|
44
|
+
else if (dataRow[field.name] > sumInRow)
|
|
45
|
+
sumInRow = dataRow[field.name];
|
|
46
|
+
});
|
|
47
|
+
if (max < sumInRow)
|
|
48
|
+
max = sumInRow;
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
return max;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
import { ScaleKeyModel,
|
|
2
|
-
import {
|
|
1
|
+
import { ScaleKeyModel, ScaleValueModel } from "../../model";
|
|
2
|
+
import { MdtChartsTwoDimensionalChart, MdtChartsTwoDimensionalOptions, ChartOrientation, MdtChartsDataRow } from "../../../config/config";
|
|
3
3
|
import { CanvasModel } from "../../modelInstance/canvasModel/canvasModel";
|
|
4
4
|
export declare enum ScaleType {
|
|
5
5
|
Key = 0,
|
|
6
6
|
Value = 1
|
|
7
7
|
}
|
|
8
8
|
export declare class ScaleModel {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
static getDateValueDomain(data: MdtChartsDataSource, chart: IntervalChart, keyAxisPosition: AxisPosition, dataSource: string): [Date, Date];
|
|
13
|
-
static getLinearDomain(configDomain: NumberDomain, dataRows: MdtChartsDataRow[], configOptions: MdtChartsTwoDimensionalOptions): [number, number];
|
|
14
|
-
static getScaleKeyType(charts: MdtChartsTwoDimensionalChart[]): ScaleKeyType;
|
|
15
|
-
static getScaleValueType(charts: MdtChartsTwoDimensionalChart[] | IntervalChart[]): ScaleValueType;
|
|
16
|
-
static getElementsAmount(barCharts: MdtChartsTwoDimensionalChart[]): number;
|
|
17
|
-
static getScaleMaxValue(charts: MdtChartsTwoDimensionalChart[], dataRows: MdtChartsDataRow[]): number;
|
|
18
|
-
static getScaleMinValue(charts: MdtChartsTwoDimensionalChart[], dataRows: MdtChartsDataRow[]): number;
|
|
9
|
+
getScaleKey(allowableKeys: string[], orient: ChartOrientation, canvasModel: CanvasModel, charts: MdtChartsTwoDimensionalChart[], barCharts: MdtChartsTwoDimensionalChart[]): ScaleKeyModel;
|
|
10
|
+
getScaleLinear(options: MdtChartsTwoDimensionalOptions, dataRows: MdtChartsDataRow[], canvasModel: CanvasModel): ScaleValueModel;
|
|
11
|
+
private getScaleKeyType;
|
|
19
12
|
}
|
|
@@ -1,118 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getElementsAmountForScale, getScaleKeyRangePeek, getScaleValueRangePeek } from "./scaleModelServices";
|
|
2
|
+
import { getScaleLinearDomain } from "./scaleDomainService";
|
|
2
3
|
export var ScaleType;
|
|
3
4
|
(function (ScaleType) {
|
|
4
5
|
ScaleType[ScaleType["Key"] = 0] = "Key";
|
|
5
6
|
ScaleType[ScaleType["Value"] = 1] = "Value";
|
|
6
7
|
})(ScaleType || (ScaleType = {}));
|
|
7
8
|
export class ScaleModel {
|
|
8
|
-
|
|
9
|
+
getScaleKey(allowableKeys, orient, canvasModel, charts, barCharts) {
|
|
9
10
|
return {
|
|
10
11
|
domain: allowableKeys,
|
|
11
12
|
range: {
|
|
12
13
|
start: 0,
|
|
13
|
-
end:
|
|
14
|
+
end: getScaleKeyRangePeek(orient, canvasModel)
|
|
14
15
|
},
|
|
15
|
-
type:
|
|
16
|
-
elementsAmount:
|
|
16
|
+
type: this.getScaleKeyType(charts),
|
|
17
|
+
elementsAmount: getElementsAmountForScale(barCharts)
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
+
getScaleLinear(options, dataRows, canvasModel) {
|
|
20
21
|
return {
|
|
21
|
-
domain:
|
|
22
|
+
domain: getScaleLinearDomain(options.axis.value.domain, dataRows, options),
|
|
22
23
|
range: {
|
|
23
24
|
start: 0,
|
|
24
|
-
end:
|
|
25
|
+
end: getScaleValueRangePeek(options.orientation, canvasModel)
|
|
25
26
|
},
|
|
26
|
-
type:
|
|
27
|
+
type: "linear"
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
if (chartOrientation === 'vertical')
|
|
31
|
-
return scaleType === ScaleType.Key
|
|
32
|
-
? canvasModel.getChartBlockWidth()
|
|
33
|
-
: canvasModel.getChartBlockHeight();
|
|
34
|
-
return scaleType === ScaleType.Key
|
|
35
|
-
? canvasModel.getChartBlockHeight()
|
|
36
|
-
: canvasModel.getChartBlockWidth();
|
|
37
|
-
}
|
|
38
|
-
static getDateValueDomain(data, chart, keyAxisPosition, dataSource) {
|
|
39
|
-
const minMax = ModelHelper.getMinAndMaxOfIntervalData(data, dataSource, chart);
|
|
40
|
-
let domainPeekMin = minMax[0];
|
|
41
|
-
let domainPeekMax = minMax[1];
|
|
42
|
-
if (keyAxisPosition === 'start')
|
|
43
|
-
return [domainPeekMin, domainPeekMax];
|
|
44
|
-
return [domainPeekMax, domainPeekMin];
|
|
45
|
-
}
|
|
46
|
-
static getLinearDomain(configDomain, dataRows, configOptions) {
|
|
47
|
-
let domainPeekMin;
|
|
48
|
-
let domainPeekMax;
|
|
49
|
-
if (configDomain.start === -1)
|
|
50
|
-
domainPeekMin = this.getScaleMinValue(configOptions.charts, dataRows);
|
|
51
|
-
else
|
|
52
|
-
domainPeekMin = configDomain.start;
|
|
53
|
-
if (configDomain.end === -1)
|
|
54
|
-
domainPeekMax = this.getScaleMaxValue(configOptions.charts, dataRows);
|
|
55
|
-
else
|
|
56
|
-
domainPeekMax = configDomain.end;
|
|
57
|
-
if (configOptions.axis.key.position === 'start')
|
|
58
|
-
return [domainPeekMin, domainPeekMax];
|
|
59
|
-
return [domainPeekMax, domainPeekMin];
|
|
60
|
-
}
|
|
61
|
-
static getScaleKeyType(charts) {
|
|
30
|
+
getScaleKeyType(charts) {
|
|
62
31
|
if (charts.findIndex((chart) => chart.type === 'bar') === -1)
|
|
63
32
|
return 'point';
|
|
64
33
|
return 'band';
|
|
65
34
|
}
|
|
66
|
-
static getScaleValueType(charts) {
|
|
67
|
-
if (charts.findIndex((chart) => chart.type === 'gantt') !== -1)
|
|
68
|
-
return 'datetime';
|
|
69
|
-
return 'linear';
|
|
70
|
-
}
|
|
71
|
-
static getElementsAmount(barCharts) {
|
|
72
|
-
if (barCharts.length === 0)
|
|
73
|
-
return 1;
|
|
74
|
-
let barsAmount = 0;
|
|
75
|
-
barCharts.forEach(chart => {
|
|
76
|
-
if (chart.isSegmented)
|
|
77
|
-
barsAmount += 1; // Если бар сегментированный, то все valueFields являются частями одного бара
|
|
78
|
-
else
|
|
79
|
-
barsAmount += chart.data.valueFields.length;
|
|
80
|
-
});
|
|
81
|
-
return barsAmount;
|
|
82
|
-
}
|
|
83
|
-
static getScaleMaxValue(charts, dataRows) {
|
|
84
|
-
let max = 0;
|
|
85
|
-
charts.forEach(chart => {
|
|
86
|
-
dataRows.forEach(dataRow => {
|
|
87
|
-
let sumInRow = 0;
|
|
88
|
-
chart.data.valueFields.forEach(field => {
|
|
89
|
-
if (chart.isSegmented && dataRow[field.name] > 0)
|
|
90
|
-
sumInRow += dataRow[field.name];
|
|
91
|
-
else if (dataRow[field.name] > sumInRow)
|
|
92
|
-
sumInRow = dataRow[field.name];
|
|
93
|
-
});
|
|
94
|
-
if (max < sumInRow)
|
|
95
|
-
max = sumInRow;
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
return max;
|
|
99
|
-
}
|
|
100
|
-
static getScaleMinValue(charts, dataRows) {
|
|
101
|
-
let min = 0;
|
|
102
|
-
charts.forEach(chart => {
|
|
103
|
-
dataRows.forEach(dataRow => {
|
|
104
|
-
let sumInRow = 0;
|
|
105
|
-
chart.data.valueFields.forEach(field => {
|
|
106
|
-
if (chart.isSegmented && dataRow[field.name] < 0) {
|
|
107
|
-
sumInRow += dataRow[field.name];
|
|
108
|
-
}
|
|
109
|
-
else if (dataRow[field.name] < sumInRow)
|
|
110
|
-
sumInRow = dataRow[field.name];
|
|
111
|
-
});
|
|
112
|
-
if (min > sumInRow)
|
|
113
|
-
min = sumInRow;
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
return min;
|
|
117
|
-
}
|
|
118
35
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ChartOrientation, MdtChartsTwoDimensionalChart } from "../../../config/config";
|
|
2
|
+
import { CanvasSizesModel } from "../../modelInstance/canvasModel/canvasSizesModel/canvasSizeModel";
|
|
3
|
+
export declare function getScaleKeyRangePeek(chartOrientation: ChartOrientation, canvasModel: CanvasSizesModel): number;
|
|
4
|
+
export declare function getScaleValueRangePeek(chartOrientation: string, canvasModel: CanvasSizesModel): number;
|
|
5
|
+
export declare function getElementsAmountForScale(barCharts: MdtChartsTwoDimensionalChart[]): number;
|
|
@@ -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
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { MdtChartsConfig, MdtChartsDataSource, MdtChartsTwoDimensionalOptions } from "../../config/config";
|
|
2
2
|
import { DesignerConfig } from "../../designer/designerConfig";
|
|
3
|
-
import {
|
|
3
|
+
import { OtherCommonComponents } from "../model";
|
|
4
4
|
import { ModelInstance } from "../modelInstance/modelInstance";
|
|
5
|
-
import { CanvasModel } from "../modelInstance/canvasModel/canvasModel";
|
|
6
5
|
export declare class MarginModel {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
private
|
|
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;
|
|
11
10
|
}
|