mdt-charts 1.34.0 → 1.35.1
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 +1 -1
- package/lib/designer/designerConfig.d.ts +1 -1
- package/lib/model/featuresModel/legendModel/legendModel.js +1 -1
- package/lib/model/margin/marginModel.d.ts +3 -2
- package/lib/model/margin/marginModel.js +4 -3
- package/lib/model/modelInstance/configReader/baseConfigReader.d.ts +2 -0
- package/lib/model/modelInstance/configReader/baseConfigReader.js +1 -1
- package/lib/model/modelInstance/configReader/polarConfigReader/polarConfigReader.d.ts +5 -1
- package/lib/model/modelInstance/configReader/polarConfigReader/polarConfigReader.js +11 -1
- package/lib/model/modelInstance/configReader/twoDimConfigReader.ts/groupingConfigReader/groupingConfigReader.d.ts +2 -2
- package/lib/model/modelInstance/configReader/twoDimConfigReader.ts/twoDimConfigReader.d.ts +2 -1
- package/lib/model/modelInstance/configReader/twoDimConfigReader.ts/twoDimConfigReader.js +9 -0
- package/package.json +1 -1
package/lib/config/config.d.ts
CHANGED
|
@@ -239,7 +239,7 @@ export interface TwoDimGroupingItem {
|
|
|
239
239
|
labels?: TwoDimGroupingItemLabels;
|
|
240
240
|
}
|
|
241
241
|
interface TwoDimGroupingItemData {
|
|
242
|
-
field:
|
|
242
|
+
field: MdtChartsBaseField;
|
|
243
243
|
}
|
|
244
244
|
interface TwoDimGroupingItemLabels {
|
|
245
245
|
position?: ItemPositionByOrientation;
|
|
@@ -3,9 +3,10 @@ import { DesignerConfig } from "../../designer/designerConfig";
|
|
|
3
3
|
import { OtherCommonComponents } from "../model";
|
|
4
4
|
import { ModelInstance } from "../modelInstance/modelInstance";
|
|
5
5
|
export declare class MarginModel {
|
|
6
|
-
private designerConfig;
|
|
7
|
-
private config;
|
|
6
|
+
private readonly designerConfig;
|
|
7
|
+
private readonly config;
|
|
8
8
|
private twoDimModel;
|
|
9
|
+
private readonly configReader;
|
|
9
10
|
constructor(designerConfig: DesignerConfig, config: MdtChartsConfig);
|
|
10
11
|
initMargin(otherComponents: OtherCommonComponents, modelInstance: ModelInstance): void;
|
|
11
12
|
recalcMarginByVerticalAxisLabel(modelInstance: ModelInstance): void;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { TwoDimMarginModel } from "./twoDim/twoDimMarginModel";
|
|
2
|
-
import {
|
|
2
|
+
import { getConfigReader } from "../modelInstance/configReader/baseConfigReader";
|
|
3
3
|
export class MarginModel {
|
|
4
4
|
constructor(designerConfig, config) {
|
|
5
5
|
this.designerConfig = designerConfig;
|
|
6
6
|
this.config = config;
|
|
7
|
+
this.configReader = getConfigReader(this.config, this.designerConfig);
|
|
7
8
|
}
|
|
8
9
|
initMargin(otherComponents, modelInstance) {
|
|
9
10
|
const canvasModel = modelInstance.canvasModel;
|
|
10
|
-
canvasModel.initMargin(
|
|
11
|
+
canvasModel.initMargin(this.configReader.getChartBlockMargin());
|
|
11
12
|
this.recalcMarginByTitle(canvasModel);
|
|
12
13
|
if (this.config.options.type === "2d") {
|
|
13
|
-
this.twoDimModel = new TwoDimMarginModel(this.designerConfig,
|
|
14
|
+
this.twoDimModel = new TwoDimMarginModel(this.designerConfig, this.configReader);
|
|
14
15
|
this.twoDimModel.recalcMargin(otherComponents, modelInstance);
|
|
15
16
|
}
|
|
16
17
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { MdtChartsConfig, MdtChartsField } from "../../../config/config";
|
|
2
2
|
import { DesignerConfig } from "../../../designer/designerConfig";
|
|
3
|
+
import { BlockMargin } from "../../model";
|
|
3
4
|
export interface BaseConfigReader {
|
|
4
5
|
getValueFields(): MdtChartsField[];
|
|
6
|
+
getChartBlockMargin(): BlockMargin;
|
|
5
7
|
}
|
|
6
8
|
export declare function getConfigReader(config: MdtChartsConfig, designerConfig: DesignerConfig): BaseConfigReader;
|
|
@@ -4,6 +4,6 @@ export function getConfigReader(config, designerConfig) {
|
|
|
4
4
|
if (config.options.type === "2d")
|
|
5
5
|
return new TwoDimConfigReader(config, designerConfig);
|
|
6
6
|
if (config.options.type === "polar")
|
|
7
|
-
return new PolarConfigReader(config);
|
|
7
|
+
return new PolarConfigReader(config, designerConfig);
|
|
8
8
|
throw new Error(`Config reader for type "${config.options.type}" not exists`);
|
|
9
9
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { MdtChartsConfig, MdtChartsField } from "../../../../config/config";
|
|
2
|
+
import { DesignerConfig } from "../../../../designer/designerConfig";
|
|
3
|
+
import { BlockMargin } from "../../../model";
|
|
2
4
|
import { BaseConfigReader } from "../baseConfigReader";
|
|
3
5
|
export declare class PolarConfigReader implements BaseConfigReader {
|
|
6
|
+
private readonly designerConfig;
|
|
4
7
|
private options;
|
|
5
|
-
constructor(config: MdtChartsConfig);
|
|
8
|
+
constructor(config: MdtChartsConfig, designerConfig: DesignerConfig);
|
|
6
9
|
getValueFields(): MdtChartsField[];
|
|
10
|
+
getChartBlockMargin(): BlockMargin;
|
|
7
11
|
}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
export class PolarConfigReader {
|
|
2
|
-
constructor(config) {
|
|
2
|
+
constructor(config, designerConfig) {
|
|
3
|
+
this.designerConfig = designerConfig;
|
|
3
4
|
this.options = config.options;
|
|
4
5
|
}
|
|
5
6
|
getValueFields() {
|
|
6
7
|
return [this.options.chart.data.valueField];
|
|
7
8
|
}
|
|
9
|
+
getChartBlockMargin() {
|
|
10
|
+
const defaultBlockMargin = {
|
|
11
|
+
top: 5,
|
|
12
|
+
bottom: 5,
|
|
13
|
+
left: 5,
|
|
14
|
+
right: 5
|
|
15
|
+
};
|
|
16
|
+
return Object.assign(Object.assign({}, defaultBlockMargin), this.designerConfig.canvas.chartBlockMargin);
|
|
17
|
+
}
|
|
8
18
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChartOrientation, DiscreteAxisOptions,
|
|
1
|
+
import { ChartOrientation, DiscreteAxisOptions, MdtChartsBaseField, MdtChartsDataRow, TwoDimGroupingOptions } from "../../../../../config/config";
|
|
2
2
|
import { DominantBaseline, Orient, TextAnchor } from "../../../../model";
|
|
3
3
|
export declare class GroupingConfigReader {
|
|
4
4
|
private readonly keyAxisOptions;
|
|
@@ -19,7 +19,7 @@ export declare class GroupingConfigReader {
|
|
|
19
19
|
domain: string[];
|
|
20
20
|
orient: Orient;
|
|
21
21
|
sideIndex: number;
|
|
22
|
-
field:
|
|
22
|
+
field: MdtChartsBaseField;
|
|
23
23
|
textAnchor: TextAnchor;
|
|
24
24
|
dominantBaseline: DominantBaseline;
|
|
25
25
|
}[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxisLabelFormatter, MdtChartsConfig, MdtChartsField, MdtChartsFieldName, MdtChartsTwoDimensionalOptions, TwoDimensionalChartType, TwoDimensionalValueGroup, ValueLabelsFormatter } from "../../../../config/config";
|
|
2
2
|
import { DesignerConfig } from "../../../../designer/designerConfig";
|
|
3
|
-
import { ValueLabelsStyleModel } from "../../../model";
|
|
3
|
+
import { BlockMargin, ValueLabelsStyleModel } from "../../../model";
|
|
4
4
|
import { BaseConfigReader } from "../baseConfigReader";
|
|
5
5
|
import { GroupingConfigReader } from "./groupingConfigReader/groupingConfigReader";
|
|
6
6
|
export declare class TwoDimConfigReader implements BaseConfigReader {
|
|
@@ -8,6 +8,7 @@ export declare class TwoDimConfigReader implements BaseConfigReader {
|
|
|
8
8
|
readonly options: MdtChartsTwoDimensionalOptions;
|
|
9
9
|
readonly grouping: GroupingConfigReader;
|
|
10
10
|
constructor(config: MdtChartsConfig, designerConfig: DesignerConfig);
|
|
11
|
+
getChartBlockMargin(): BlockMargin;
|
|
11
12
|
getValueFields(): MdtChartsField[];
|
|
12
13
|
getFieldsBySegments(valueGroup: TwoDimensionalValueGroup): MdtChartsFieldName[][];
|
|
13
14
|
getAxisLabelFormatter(): AxisLabelFormatter;
|
|
@@ -5,6 +5,15 @@ export class TwoDimConfigReader {
|
|
|
5
5
|
this.options = config.options;
|
|
6
6
|
this.grouping = new GroupingConfigReader(this.options.axis.key, this.options.orientation, this.options.grouping);
|
|
7
7
|
}
|
|
8
|
+
getChartBlockMargin() {
|
|
9
|
+
const defaultBlockMargin = {
|
|
10
|
+
top: 5,
|
|
11
|
+
bottom: 0,
|
|
12
|
+
left: 0,
|
|
13
|
+
right: 0
|
|
14
|
+
};
|
|
15
|
+
return Object.assign(Object.assign({}, defaultBlockMargin), this.designerConfig.canvas.chartBlockMargin);
|
|
16
|
+
}
|
|
8
17
|
getValueFields() {
|
|
9
18
|
const fields = [];
|
|
10
19
|
this.options.charts.forEach((chart) => {
|