mdt-charts 1.12.2 → 1.12.6
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 +19 -12
- package/lib/designer/designerConfig.d.ts +3 -5
- package/lib/engine/features/aggregator/aggregator.d.ts +9 -7
- package/lib/engine/features/aggregator/aggregator.js +51 -37
- package/lib/engine/features/gridLine/gidLineHelper.d.ts +2 -0
- package/lib/engine/features/gridLine/gidLineHelper.js +22 -0
- package/lib/engine/features/gridLine/gridLine.d.ts +5 -3
- package/lib/engine/features/gridLine/gridLine.js +16 -17
- package/lib/engine/features/scale/scale.d.ts +2 -0
- package/lib/engine/features/scale/scale.js +6 -3
- package/lib/engine/intervalNotation/intervalManager.js +1 -1
- package/lib/engine/polarNotation/donut/donut.js +1 -1
- package/lib/engine/polarNotation/polarManager.js +1 -1
- package/lib/engine/twoDimensionalNotation/area/areaHelper.js +2 -2
- package/lib/engine/twoDimensionalNotation/bar/bar.js +3 -3
- package/lib/engine/twoDimensionalNotation/bar/barHelper.js +8 -8
- package/lib/engine/twoDimensionalNotation/twoDimensionalManager.js +2 -2
- package/lib/model/chartStyleModel/TwoDimensionalChartStyleModel.d.ts +4 -4
- package/lib/model/dataManagerModel/dataManagerModel.js +1 -1
- package/lib/model/featuresModel/axisModel.d.ts +2 -1
- package/lib/model/featuresModel/axisModel.js +19 -5
- package/lib/model/featuresModel/legendModel/legendModel.js +3 -3
- package/lib/model/featuresModel/legendModel/polarMarginCalculator.js +1 -1
- package/lib/model/featuresModel/scaleModel/scaleAxisRecalcer.d.ts +20 -0
- package/lib/model/featuresModel/scaleModel/scaleAxisRecalcer.js +31 -0
- package/lib/model/featuresModel/scaleModel/scaleModel.d.ts +19 -0
- package/lib/model/featuresModel/scaleModel/scaleModel.js +115 -0
- package/lib/model/featuresModel/scaleModel.d.ts +7 -6
- package/lib/model/featuresModel/scaleModel.js +19 -4
- package/lib/model/featuresModel/titleModel.js +4 -4
- package/lib/model/marginModel.d.ts +1 -3
- package/lib/model/marginModel.js +7 -29
- package/lib/model/model.d.ts +18 -6
- package/lib/model/modelBuilder.js +8 -9
- package/lib/model/modelInstance/canvasModel/canvasModel.d.ts +5 -4
- package/lib/model/modelInstance/canvasModel/canvasModel.js +6 -2
- package/lib/model/modelInstance/canvasModel/marginModelService.d.ts +11 -0
- package/lib/model/modelInstance/canvasModel/marginModelService.js +26 -0
- package/lib/model/modelInstance/dataModel/dataModel.d.ts +14 -0
- package/lib/model/modelInstance/dataModel/dataModel.js +26 -0
- package/lib/model/modelInstance/dataModel/dataRepository.d.ts +12 -0
- package/lib/model/modelInstance/dataModel/dataRepository.js +20 -0
- package/lib/model/modelInstance/modelInstance.d.ts +3 -3
- package/lib/model/modelInstance/modelInstance.js +6 -4
- package/lib/model/notations/intervalModel.d.ts +2 -2
- package/lib/model/notations/intervalModel.js +1 -1
- package/lib/model/notations/polar/donut/donutAggregatorService.d.ts +12 -0
- package/lib/model/notations/polar/donut/donutAggregatorService.js +25 -0
- package/lib/model/notations/polar/donut/donutModel.d.ts +10 -0
- package/lib/model/notations/polar/donut/donutModel.js +32 -0
- package/lib/model/notations/polar/donut/donutThicknessService.d.ts +9 -0
- package/lib/model/notations/polar/donut/donutThicknessService.js +30 -0
- package/lib/model/notations/polar/polarModel.d.ts +15 -0
- package/lib/model/notations/polar/polarModel.js +53 -0
- package/lib/model/notations/twoDimensionalModel.d.ts +6 -6
- package/lib/model/notations/twoDimensionalModel.js +9 -5
- package/lib/style/charts-main.css +6 -2
- package/lib/style/charts-main.less +6 -2
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MdtChartsDataSource } from "../../../config/config";
|
|
2
|
+
export declare class DataRepositoryModel {
|
|
3
|
+
private rawFullSource;
|
|
4
|
+
private scopedFullSource;
|
|
5
|
+
private sourceName;
|
|
6
|
+
initSourceName(sourceName: string): void;
|
|
7
|
+
initRawFullSource(rawSource: MdtChartsDataSource): void;
|
|
8
|
+
getRawRows(): import("../../../config/config").MdtChartsDataRow[];
|
|
9
|
+
initScopedFullSource(scopedSource: MdtChartsDataSource): void;
|
|
10
|
+
getScopedFullSource(): MdtChartsDataSource;
|
|
11
|
+
getScopedRows(): import("../../../config/config").MdtChartsDataRow[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export class DataRepositoryModel {
|
|
2
|
+
initSourceName(sourceName) {
|
|
3
|
+
this.sourceName = sourceName;
|
|
4
|
+
}
|
|
5
|
+
initRawFullSource(rawSource) {
|
|
6
|
+
this.rawFullSource = rawSource;
|
|
7
|
+
}
|
|
8
|
+
getRawRows() {
|
|
9
|
+
return this.rawFullSource[this.sourceName];
|
|
10
|
+
}
|
|
11
|
+
initScopedFullSource(scopedSource) {
|
|
12
|
+
this.scopedFullSource = scopedSource;
|
|
13
|
+
}
|
|
14
|
+
getScopedFullSource() {
|
|
15
|
+
return this.scopedFullSource;
|
|
16
|
+
}
|
|
17
|
+
getScopedRows() {
|
|
18
|
+
return this.scopedFullSource[this.sourceName];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { MdtChartsConfig } from "../../
|
|
1
|
+
import { MdtChartsConfig, MdtChartsDataSource } from "../../config/config";
|
|
2
2
|
import { CanvasModel } from "./canvasModel/canvasModel";
|
|
3
|
-
import { DataModelInstance } from "./dataModel";
|
|
3
|
+
import { DataModelInstance } from "./dataModel/dataModel";
|
|
4
4
|
export declare class ModelInstance {
|
|
5
|
-
static create(config: MdtChartsConfig): ModelInstance;
|
|
5
|
+
static create(config: MdtChartsConfig, data: MdtChartsDataSource): ModelInstance;
|
|
6
6
|
private static initInitialParams;
|
|
7
7
|
canvasModel: CanvasModel;
|
|
8
8
|
dataModel: DataModelInstance;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { CanvasModel } from "./canvasModel/canvasModel";
|
|
2
|
-
import { DataModelInstance } from "./dataModel";
|
|
2
|
+
import { DataModelInstance } from "./dataModel/dataModel";
|
|
3
3
|
export class ModelInstance {
|
|
4
4
|
constructor() {
|
|
5
5
|
this.canvasModel = new CanvasModel();
|
|
6
6
|
this.dataModel = new DataModelInstance();
|
|
7
7
|
}
|
|
8
|
-
static create(config) {
|
|
8
|
+
static create(config, data) {
|
|
9
9
|
const modelInstance = new ModelInstance();
|
|
10
|
-
this.initInitialParams(modelInstance, config);
|
|
10
|
+
this.initInitialParams(modelInstance, config, data);
|
|
11
11
|
return modelInstance;
|
|
12
12
|
}
|
|
13
|
-
static initInitialParams(modelInstance, config) {
|
|
13
|
+
static initInitialParams(modelInstance, config, data) {
|
|
14
14
|
modelInstance.canvasModel.initBlockSize(config.canvas.size);
|
|
15
15
|
modelInstance.dataModel.initMaxRecordsAmount(config.options.data.maxRecordsAmount);
|
|
16
|
+
modelInstance.dataModel.repository.initSourceName(config.options.data.dataSource);
|
|
17
|
+
modelInstance.dataModel.repository.initRawFullSource(data);
|
|
16
18
|
}
|
|
17
19
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { MdtChartsConfig, MdtChartsDataSource,
|
|
1
|
+
import { MdtChartsConfig, MdtChartsDataSource, MdtChartsIntervalOptions } from "../../config/config";
|
|
2
2
|
import { DesignerConfig } from "../../designer/designerConfig";
|
|
3
3
|
import { AdditionalElementsOptions, BlockMargin, DataScope, IntervalOptionsModel } from "../model";
|
|
4
4
|
import { ModelInstance } from "../modelInstance/modelInstance";
|
|
5
5
|
export declare class IntervalModel {
|
|
6
6
|
static getOptions(config: MdtChartsConfig, designerConfig: DesignerConfig, margin: BlockMargin, dataScope: DataScope, data: MdtChartsDataSource, modelInstance: ModelInstance): IntervalOptionsModel;
|
|
7
|
-
static getAdditionalElements(options:
|
|
7
|
+
static getAdditionalElements(options: MdtChartsIntervalOptions): AdditionalElementsOptions;
|
|
8
8
|
private static getChartsModel;
|
|
9
9
|
}
|
|
@@ -2,7 +2,7 @@ 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";
|
|
5
|
+
import { ScaleModel, ScaleType } from "../featuresModel/scaleModel/scaleModel";
|
|
6
6
|
import { TwoDimensionalModel } from "./twoDimensionalModel";
|
|
7
7
|
export class IntervalModel {
|
|
8
8
|
static getOptions(config, designerConfig, margin, dataScope, data, modelInstance) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MdtChartsDataRow, MdtChartsDonutAggregator } from "../../../../config/config";
|
|
2
|
+
import { DonutAggregatorContent } from "../../../model";
|
|
3
|
+
export declare const AGGREGATOR_DEFAULT_TITLE = "\u0421\u0443\u043C\u043C\u0430";
|
|
4
|
+
export interface AggregatorServiceDataOptions {
|
|
5
|
+
rows: MdtChartsDataRow[];
|
|
6
|
+
valueFieldName: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class DonutAggregatorService {
|
|
9
|
+
getContent(aggregatorOptions: MdtChartsDonutAggregator, dataOptions: AggregatorServiceDataOptions): DonutAggregatorContent;
|
|
10
|
+
private doesValueExist;
|
|
11
|
+
private generateDefaultContent;
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const AGGREGATOR_DEFAULT_TITLE = "Сумма";
|
|
2
|
+
export class DonutAggregatorService {
|
|
3
|
+
getContent(aggregatorOptions, dataOptions) {
|
|
4
|
+
if (!(aggregatorOptions === null || aggregatorOptions === void 0 ? void 0 : aggregatorOptions.content) || !dataOptions.rows)
|
|
5
|
+
return this.generateDefaultContent(dataOptions);
|
|
6
|
+
const content = aggregatorOptions.content({ data: dataOptions.rows });
|
|
7
|
+
if (this.doesValueExist(content.value) && content.title)
|
|
8
|
+
return content;
|
|
9
|
+
if (!content.title && this.doesValueExist(content.value))
|
|
10
|
+
return {
|
|
11
|
+
value: content.value,
|
|
12
|
+
title: AGGREGATOR_DEFAULT_TITLE
|
|
13
|
+
};
|
|
14
|
+
return this.generateDefaultContent(dataOptions);
|
|
15
|
+
}
|
|
16
|
+
doesValueExist(content) {
|
|
17
|
+
return content != null;
|
|
18
|
+
}
|
|
19
|
+
generateDefaultContent(dataOptions) {
|
|
20
|
+
return {
|
|
21
|
+
title: AGGREGATOR_DEFAULT_TITLE,
|
|
22
|
+
value: dataOptions.rows ? dataOptions.rows.reduce((acc, row) => acc + row[dataOptions.valueFieldName], 0) : 0
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MdtChartsDataRow, PolarChart } from "../../../../config/config";
|
|
2
|
+
import { DonutOptionsCanvas } from "../../../../designer/designerConfig";
|
|
3
|
+
import { DonutChartSettings } from "../../../model";
|
|
4
|
+
export declare class DonutModel {
|
|
5
|
+
private thicknessService;
|
|
6
|
+
private aggregatorService;
|
|
7
|
+
getSettings(settingsFromConfig: DonutOptionsCanvas, chartOptions: PolarChart, rawDataRows: MdtChartsDataRow[]): DonutChartSettings;
|
|
8
|
+
private getThicknessOptions;
|
|
9
|
+
private getAggregatorOptions;
|
|
10
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DonutAggregatorService } from "./donutAggregatorService";
|
|
2
|
+
import { DonutThicknessService } from "./donutThicknessService";
|
|
3
|
+
export class DonutModel {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.thicknessService = new DonutThicknessService();
|
|
6
|
+
this.aggregatorService = new DonutAggregatorService();
|
|
7
|
+
}
|
|
8
|
+
getSettings(settingsFromConfig, chartOptions, rawDataRows) {
|
|
9
|
+
return {
|
|
10
|
+
padAngle: settingsFromConfig.padAngle,
|
|
11
|
+
thickness: this.getThicknessOptions(settingsFromConfig.thickness),
|
|
12
|
+
aggregator: this.getAggregatorOptions(settingsFromConfig, chartOptions, rawDataRows)
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
getThicknessOptions(settingsFromConfig) {
|
|
16
|
+
return {
|
|
17
|
+
unit: this.thicknessService.getUnit(settingsFromConfig),
|
|
18
|
+
max: this.thicknessService.valueToNumber(settingsFromConfig.max),
|
|
19
|
+
min: this.thicknessService.valueToNumber(settingsFromConfig.min),
|
|
20
|
+
value: this.thicknessService.valueToNumber(settingsFromConfig.value),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
getAggregatorOptions(settingsFromConfig, chartOptions, rawDataRows) {
|
|
24
|
+
return {
|
|
25
|
+
margin: settingsFromConfig.aggregatorPad,
|
|
26
|
+
content: this.aggregatorService.getContent(chartOptions.aggregator, {
|
|
27
|
+
rows: rawDataRows,
|
|
28
|
+
valueFieldName: chartOptions.data.valueField.name
|
|
29
|
+
})
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MdtChartsDonutThicknessOptions } from "../../../../designer/designerConfig";
|
|
2
|
+
import { DonutThicknessUnit } from "../../../model";
|
|
3
|
+
export declare class DonutThicknessService {
|
|
4
|
+
private defaultUnit;
|
|
5
|
+
getUnit(settingsFromConfig: MdtChartsDonutThicknessOptions): DonutThicknessUnit;
|
|
6
|
+
valueToNumber(value: string | number): number;
|
|
7
|
+
private getUnitByValue;
|
|
8
|
+
private getLastUnitFromString;
|
|
9
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class DonutThicknessService {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.defaultUnit = "px";
|
|
4
|
+
}
|
|
5
|
+
getUnit(settingsFromConfig) {
|
|
6
|
+
if (settingsFromConfig.value)
|
|
7
|
+
return this.getUnitByValue(settingsFromConfig.value);
|
|
8
|
+
const minUnit = this.getUnitByValue(settingsFromConfig.min);
|
|
9
|
+
const maxUnit = this.getUnitByValue(settingsFromConfig.max);
|
|
10
|
+
return minUnit === maxUnit ? minUnit : this.defaultUnit;
|
|
11
|
+
}
|
|
12
|
+
valueToNumber(value) {
|
|
13
|
+
if (typeof value === "number")
|
|
14
|
+
return value;
|
|
15
|
+
return parseInt(value);
|
|
16
|
+
}
|
|
17
|
+
getUnitByValue(value) {
|
|
18
|
+
if (typeof value !== "string")
|
|
19
|
+
return this.defaultUnit;
|
|
20
|
+
return this.getLastUnitFromString(value);
|
|
21
|
+
}
|
|
22
|
+
getLastUnitFromString(value) {
|
|
23
|
+
let resultUnit = this.defaultUnit;
|
|
24
|
+
["%", "px"].forEach(unit => {
|
|
25
|
+
if (value.endsWith(unit))
|
|
26
|
+
resultUnit = unit;
|
|
27
|
+
});
|
|
28
|
+
return resultUnit;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MdtChartsPolarOptions } from "../../../config/config";
|
|
2
|
+
import { DesignerConfig } from "../../../designer/designerConfig";
|
|
3
|
+
import { PolarOptionsModel, LegendCoordinate } from "../../model";
|
|
4
|
+
import { CanvasModel } from "../../modelInstance/canvasModel/canvasModel";
|
|
5
|
+
import { ModelInstance } from "../../modelInstance/modelInstance";
|
|
6
|
+
export declare const MIN_DONUT_BLOCK_SIZE = 120;
|
|
7
|
+
export declare class PolarModel {
|
|
8
|
+
private static donutModel;
|
|
9
|
+
static getOptions(options: MdtChartsPolarOptions, designerConfig: DesignerConfig, modelInstance: ModelInstance): PolarOptionsModel;
|
|
10
|
+
static getLegendPositionByBlockSize(canvasModel: CanvasModel): "bottom" | "right";
|
|
11
|
+
static doesChartBlockHasEnoughWidthForContainsLegend(chartBlockWidth: number, legendWidth: number, legendCoordinate: LegendCoordinate): boolean;
|
|
12
|
+
static doesChartBlockHasEnoughHeightForContainsLegend(chartBlockHeight: number, legendCoordinate: LegendCoordinate): boolean;
|
|
13
|
+
private static getDonutSettings;
|
|
14
|
+
private static getChartsModel;
|
|
15
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ChartStyleModelService } from "../../chartStyleModel/chartStyleModel";
|
|
2
|
+
import { DonutModel } from "./donut/donutModel";
|
|
3
|
+
export const MIN_DONUT_BLOCK_SIZE = 120;
|
|
4
|
+
export class PolarModel {
|
|
5
|
+
static getOptions(options, designerConfig, modelInstance) {
|
|
6
|
+
return {
|
|
7
|
+
type: options.type,
|
|
8
|
+
selectable: !!options.selectable,
|
|
9
|
+
title: options.title,
|
|
10
|
+
data: Object.assign({}, options.data),
|
|
11
|
+
charts: this.getChartsModel(options.chart, modelInstance.dataModel.repository.getScopedRows().length, designerConfig.chartStyle),
|
|
12
|
+
legend: modelInstance.canvasModel.legendCanvas.getModel(),
|
|
13
|
+
tooltip: options.tooltip,
|
|
14
|
+
chartCanvas: this.getDonutSettings(designerConfig.canvas.chartOptions.donut, options.chart, modelInstance.dataModel.repository.getRawRows())
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//TODO: type for returned value
|
|
18
|
+
static getLegendPositionByBlockSize(canvasModel) {
|
|
19
|
+
const widthCoefficientWhenLegendShouldInBottom = 1.5;
|
|
20
|
+
const avgLegendWidth = 100;
|
|
21
|
+
const blockWidth = canvasModel.getBlockSize().width;
|
|
22
|
+
const blockHeight = canvasModel.getBlockSize().height;
|
|
23
|
+
return canvasModel.getChartBlockWidth() < MIN_DONUT_BLOCK_SIZE + avgLegendWidth
|
|
24
|
+
&& blockWidth * widthCoefficientWhenLegendShouldInBottom < blockHeight
|
|
25
|
+
? 'bottom'
|
|
26
|
+
: 'right';
|
|
27
|
+
}
|
|
28
|
+
static doesChartBlockHasEnoughWidthForContainsLegend(chartBlockWidth, legendWidth, legendCoordinate) {
|
|
29
|
+
const rightLegendMargin = legendCoordinate.right.margin;
|
|
30
|
+
return chartBlockWidth - legendWidth - rightLegendMargin.left - rightLegendMargin.right >= MIN_DONUT_BLOCK_SIZE;
|
|
31
|
+
}
|
|
32
|
+
static doesChartBlockHasEnoughHeightForContainsLegend(chartBlockHeight, legendCoordinate) {
|
|
33
|
+
const minHeightForLegend = 30;
|
|
34
|
+
const bottomLegendMargin = legendCoordinate.bottom.margin;
|
|
35
|
+
const heightForLegend = chartBlockHeight - bottomLegendMargin.bottom - bottomLegendMargin.top - MIN_DONUT_BLOCK_SIZE;
|
|
36
|
+
return heightForLegend >= minHeightForLegend;
|
|
37
|
+
}
|
|
38
|
+
static getDonutSettings(settings, chartOptions, dataRows) {
|
|
39
|
+
return this.donutModel.getSettings(settings, chartOptions, dataRows);
|
|
40
|
+
}
|
|
41
|
+
static getChartsModel(chart, dataLength, chartStyleConfig) {
|
|
42
|
+
const chartsModel = [];
|
|
43
|
+
chartsModel.push({
|
|
44
|
+
type: chart.type,
|
|
45
|
+
data: Object.assign({}, chart.data),
|
|
46
|
+
tooltip: chart.tooltip,
|
|
47
|
+
cssClasses: ChartStyleModelService.getCssClasses(0),
|
|
48
|
+
style: ChartStyleModelService.getChartStyle(dataLength, chartStyleConfig)
|
|
49
|
+
});
|
|
50
|
+
return chartsModel;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
PolarModel.donutModel = new DonutModel();
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { ChartOrientation, MdtChartsDataSource,
|
|
1
|
+
import { ChartOrientation, MdtChartsDataSource, MdtChartsTwoDimensionalChart, MdtChartsTwoDimensionalOptions } from "../../config/config";
|
|
2
2
|
import { BarOptionsCanvas, DesignerConfig } from "../../designer/designerConfig";
|
|
3
|
-
import {
|
|
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,
|
|
7
|
-
static getChartsEmbeddedLabelsFlag(charts:
|
|
6
|
+
static getOptions(options: MdtChartsTwoDimensionalOptions, designerConfig: DesignerConfig, data: MdtChartsDataSource, modelInstance: ModelInstance): TwoDimensionalOptionsModel;
|
|
7
|
+
static getChartsEmbeddedLabelsFlag(charts: MdtChartsTwoDimensionalChart[], chartOrientation: ChartOrientation): boolean;
|
|
8
8
|
/**
|
|
9
9
|
* Сортирует список чартов в порядке: area - bar - line.
|
|
10
10
|
* Используется для того, чтобы при рендере графики с наибольшей площадью (area) не перекрывали графики с меньшей площадью (bar, line).
|
|
11
11
|
* @param charts Чарты из конфига
|
|
12
12
|
*/
|
|
13
|
-
static sortCharts(charts:
|
|
13
|
+
static sortCharts(charts: MdtChartsTwoDimensionalChart[]): void;
|
|
14
14
|
static getChartsSettings(barSettings: BarOptionsCanvas): TwoDimChartElementsSettings;
|
|
15
15
|
private static getChartsModel;
|
|
16
16
|
private static findChartsWithEmbeddedKeyLabels;
|
|
17
17
|
private static getEmbeddedLabelType;
|
|
18
18
|
private static getAdditionalElements;
|
|
19
19
|
private static getChartsByType;
|
|
20
|
-
static getChartsValueFieldsAmount(charts:
|
|
20
|
+
static getChartsValueFieldsAmount(charts: MdtChartsTwoDimensionalChart[]): number[];
|
|
21
21
|
}
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import { ChartStyleModelService } from "../chartStyleModel/chartStyleModel";
|
|
2
2
|
import { TwoDimensionalChartStyleModel } from "../chartStyleModel/TwoDimensionalChartStyleModel";
|
|
3
3
|
import { AxisModel } from "../featuresModel/axisModel";
|
|
4
|
-
import {
|
|
4
|
+
import { ScaleAxisRecalcer } from "../featuresModel/scaleModel/scaleAxisRecalcer";
|
|
5
|
+
import { ScaleModel } from "../featuresModel/scaleModel/scaleModel";
|
|
5
6
|
export class TwoDimensionalModel {
|
|
6
|
-
static getOptions(options, designerConfig,
|
|
7
|
+
static getOptions(options, designerConfig, data, modelInstance) {
|
|
7
8
|
const canvasModel = modelInstance.canvasModel;
|
|
9
|
+
const scaleMarginRecalcer = new ScaleAxisRecalcer(() => ScaleModel.getScaleLinear(options, data, canvasModel));
|
|
10
|
+
scaleMarginRecalcer.recalculateMargin(canvasModel, options.orientation, options.axis.key);
|
|
11
|
+
const scaleValueInfo = scaleMarginRecalcer.getScaleValue();
|
|
8
12
|
return {
|
|
9
13
|
legend: canvasModel.legendCanvas.getModel(),
|
|
10
14
|
title: options.title,
|
|
11
15
|
selectable: !!options.selectable,
|
|
12
16
|
orient: options.orientation,
|
|
13
17
|
scale: {
|
|
14
|
-
key: ScaleModel.getScaleKey(
|
|
15
|
-
value:
|
|
18
|
+
key: ScaleModel.getScaleKey(modelInstance.dataModel.getAllowableKeys(), options.orientation, canvasModel, options.charts, this.getChartsByType(options.charts, 'bar')),
|
|
19
|
+
value: scaleValueInfo.scale
|
|
16
20
|
},
|
|
17
21
|
axis: {
|
|
18
|
-
key: AxisModel.getKeyAxis(options, data, designerConfig.canvas.axisLabel, canvasModel, designerConfig.elementsOptions.tooltip),
|
|
22
|
+
key: AxisModel.getKeyAxis(options, data, designerConfig.canvas.axisLabel, canvasModel, designerConfig.elementsOptions.tooltip, () => scaleValueInfo.scaleFn(0)),
|
|
19
23
|
value: AxisModel.getValueAxis(options.orientation, options.axis.value, designerConfig.canvas.axisLabel, canvasModel)
|
|
20
24
|
},
|
|
21
25
|
type: options.type,
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
.legend-item {
|
|
59
59
|
cursor: default;
|
|
60
60
|
transition: opacity 0.1s;
|
|
61
|
+
line-height: 1;
|
|
61
62
|
/* will-change: opacity; */
|
|
62
63
|
}
|
|
63
64
|
.legend-block-column .legend-item:not(:first-of-type) {
|
|
@@ -200,12 +201,15 @@
|
|
|
200
201
|
line-height: 1;
|
|
201
202
|
}
|
|
202
203
|
.aggregator-value {
|
|
203
|
-
margin-top:
|
|
204
|
+
margin-top: 0.5em;
|
|
204
205
|
pointer-events: auto;
|
|
205
206
|
}
|
|
206
207
|
.aggregator-name {
|
|
207
|
-
margin-top:
|
|
208
|
+
margin-top: 0.5em;
|
|
208
209
|
pointer-events: auto;
|
|
210
|
+
max-width: 90%;
|
|
211
|
+
overflow: hidden;
|
|
212
|
+
text-overflow: ellipsis;
|
|
209
213
|
}
|
|
210
214
|
|
|
211
215
|
/* Grid */
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
.legend-item {
|
|
59
59
|
cursor: default;
|
|
60
60
|
transition: opacity 0.1s;
|
|
61
|
+
line-height: 1;
|
|
61
62
|
/* will-change: opacity; */
|
|
62
63
|
}
|
|
63
64
|
.legend-block-column .legend-item:not(:first-of-type) {
|
|
@@ -200,12 +201,15 @@
|
|
|
200
201
|
line-height: 1;
|
|
201
202
|
}
|
|
202
203
|
.aggregator-value {
|
|
203
|
-
margin-top:
|
|
204
|
+
margin-top: 0.5em;
|
|
204
205
|
pointer-events: auto;
|
|
205
206
|
}
|
|
206
207
|
.aggregator-name {
|
|
207
|
-
margin-top:
|
|
208
|
+
margin-top: 0.5em;
|
|
208
209
|
pointer-events: auto;
|
|
210
|
+
max-width: 90%;
|
|
211
|
+
overflow: hidden;
|
|
212
|
+
text-overflow: ellipsis;
|
|
209
213
|
}
|
|
210
214
|
|
|
211
215
|
/* Grid */
|