mdt-charts 1.33.2 → 1.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/config/config.d.ts +25 -4
- package/lib/engine/features/axis/axis.d.ts +1 -0
- package/lib/engine/features/axis/axis.js +6 -2
- package/lib/engine/features/axis/axisHelper.js +1 -3
- package/lib/engine/features/groupLabels/groupLabels.d.ts +17 -0
- package/lib/engine/features/groupLabels/groupLabels.js +61 -0
- package/lib/engine/features/scale/scale.d.ts +3 -2
- package/lib/engine/features/scale/scale.js +11 -1
- package/lib/engine/features/valueLabels/valueLabels.d.ts +3 -3
- package/lib/engine/features/valueLabels/valueLabels.js +1 -1
- package/lib/engine/filterManager/filterEventManager.d.ts +1 -1
- package/lib/engine/filterManager/filterEventManager.js +1 -1
- package/lib/engine/twoDimensionalNotation/twoDimensionalManager.d.ts +1 -0
- package/lib/engine/twoDimensionalNotation/twoDimensionalManager.js +8 -0
- package/lib/model/featuresModel/axis/axisModel.d.ts +10 -10
- package/lib/model/featuresModel/axis/axisModel.js +10 -3
- package/lib/model/featuresModel/axis/axisModelService.js +2 -2
- package/lib/model/featuresModel/grouping/groupingLabels/groupingLabelsCoordinateHandlers.d.ts +20 -0
- package/lib/model/featuresModel/grouping/groupingLabels/groupingLabelsCoordinateHandlers.js +36 -0
- package/lib/model/featuresModel/grouping/groupingLabels/groupingLabelsScaler.d.ts +22 -0
- package/lib/model/featuresModel/grouping/groupingLabels/groupingLabelsScaler.js +49 -0
- package/lib/model/featuresModel/legendModel/legendModel.d.ts +1 -1
- package/lib/model/featuresModel/legendModel/legendModel.js +4 -4
- package/lib/model/featuresModel/legendModel/polarMarginCalculator.js +1 -1
- package/lib/model/featuresModel/legendModel/twoDimLegendModel.d.ts +1 -1
- package/lib/model/featuresModel/legendModel/twoDimLegendModel.js +5 -3
- package/lib/model/featuresModel/otherComponents.js +1 -2
- package/lib/model/featuresModel/scaleModel/scaleModel.d.ts +6 -3
- package/lib/model/featuresModel/scaleModel/scaleModel.js +49 -7
- package/lib/model/featuresModel/scaleModel/scaleModelServices.js +3 -3
- package/lib/model/featuresModel/tooltipModel/tooltipContentModel.js +3 -3
- package/lib/model/featuresModel/valueLabelsModel/valueLabelsModel.d.ts +3 -3
- package/lib/model/{EventEmitter.d.ts → helpers/eventEmitter.d.ts} +1 -1
- package/lib/model/helpers/twoDimensionalModelHelper.d.ts +1 -1
- package/lib/model/margin/marginModel.js +4 -4
- package/lib/model/margin/twoDim/twoDimMarginModel.d.ts +1 -1
- package/lib/model/margin/twoDim/twoDimMarginModel.js +6 -3
- package/lib/model/model.d.ts +51 -8
- package/lib/model/modelBuilder.js +2 -1
- package/lib/model/modelInstance/canvasModel/legendCanvasModel.d.ts +5 -0
- package/lib/model/modelInstance/canvasModel/legendCanvasModel.js +13 -0
- package/lib/model/modelInstance/canvasModel/titleCanvas.d.ts +3 -3
- package/lib/model/modelInstance/canvasModel/titleCanvas.js +21 -2
- package/lib/model/modelInstance/configReader/baseConfigReader.d.ts +6 -0
- package/lib/model/modelInstance/configReader/baseConfigReader.js +9 -0
- package/lib/model/modelInstance/configReader/polarConfigReader/polarConfigReader.d.ts +7 -0
- package/lib/model/modelInstance/configReader/polarConfigReader/polarConfigReader.js +8 -0
- package/lib/model/modelInstance/configReader/twoDimConfigReader.ts/groupingConfigReader/groupingConfigReader.d.ts +29 -0
- package/lib/model/modelInstance/configReader/twoDimConfigReader.ts/groupingConfigReader/groupingConfigReader.js +102 -0
- package/lib/model/modelInstance/{configReader.d.ts → configReader/twoDimConfigReader.ts/twoDimConfigReader.d.ts} +6 -13
- package/lib/model/modelInstance/{configReader.js → configReader/twoDimConfigReader.ts/twoDimConfigReader.js} +8 -19
- package/lib/model/modelInstance/modelInstance.js +1 -1
- package/lib/model/modelInstance/titleConfigReader.d.ts +2 -2
- package/lib/model/notations/twoDimensionalModel.d.ts +1 -1
- package/lib/model/notations/twoDimensionalModel.js +47 -2
- package/lib/style/charts-main.css +1 -1
- package/lib/style/charts-main.less +1 -1
- package/package.json +1 -1
- package/lib/model/featuresModel/titleModel.d.ts +0 -5
- package/lib/model/featuresModel/titleModel.js +0 -16
- /package/lib/model/{EventEmitter.js → helpers/eventEmitter.js} +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { AxisModel } from "../../../../featuresModel/axis/axisModel";
|
|
2
|
+
export class GroupingConfigReader {
|
|
3
|
+
constructor(keyAxisOptions, chartOrientation, groupingOptions) {
|
|
4
|
+
this.keyAxisOptions = keyAxisOptions;
|
|
5
|
+
this.chartOrientation = chartOrientation;
|
|
6
|
+
this.groupingOptions = groupingOptions;
|
|
7
|
+
this.maxLabelSize = 60;
|
|
8
|
+
}
|
|
9
|
+
isEnabled() {
|
|
10
|
+
return Boolean(this.groupingOptions) && this.groupingOptions.items.length > 0;
|
|
11
|
+
}
|
|
12
|
+
getSlicesByOrients() {
|
|
13
|
+
var _a, _b, _c, _d;
|
|
14
|
+
const slices = [];
|
|
15
|
+
const slicesAmountFromKeyAxisSide = (_b = (_a = this.groupingOptions) === null || _a === void 0 ? void 0 : _a.items.filter((item) => { var _a; return this.getLabelPosition((_a = item.labels) === null || _a === void 0 ? void 0 : _a.position) === this.keyAxisOptions.position; }).length) !== null && _b !== void 0 ? _b : 0;
|
|
16
|
+
const slicesAmountOppositeToKeyAxisSide = (_d = (_c = this.groupingOptions) === null || _c === void 0 ? void 0 : _c.items.filter((item) => { var _a; return this.getLabelPosition((_a = item.labels) === null || _a === void 0 ? void 0 : _a.position) !== this.keyAxisOptions.position; }).length) !== null && _d !== void 0 ? _d : 0;
|
|
17
|
+
const pushIfAmountIsNotZero = (orient, amount) => {
|
|
18
|
+
if (amount > 0) {
|
|
19
|
+
slices.push({ orient, amount });
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
if (this.chartOrientation === "vertical") {
|
|
23
|
+
pushIfAmountIsNotZero("top", this.keyAxisOptions.position === "start"
|
|
24
|
+
? slicesAmountFromKeyAxisSide
|
|
25
|
+
: slicesAmountOppositeToKeyAxisSide);
|
|
26
|
+
pushIfAmountIsNotZero("bottom", this.keyAxisOptions.position === "start"
|
|
27
|
+
? slicesAmountOppositeToKeyAxisSide
|
|
28
|
+
: slicesAmountFromKeyAxisSide);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
pushIfAmountIsNotZero("left", this.keyAxisOptions.position === "start"
|
|
32
|
+
? slicesAmountFromKeyAxisSide
|
|
33
|
+
: slicesAmountOppositeToKeyAxisSide);
|
|
34
|
+
pushIfAmountIsNotZero("right", this.keyAxisOptions.position === "start"
|
|
35
|
+
? slicesAmountOppositeToKeyAxisSide
|
|
36
|
+
: slicesAmountFromKeyAxisSide);
|
|
37
|
+
}
|
|
38
|
+
return slices;
|
|
39
|
+
}
|
|
40
|
+
getSlicesSizesByOrients(dataRows) {
|
|
41
|
+
var _a;
|
|
42
|
+
const slices = [];
|
|
43
|
+
(_a = this.groupingOptions) === null || _a === void 0 ? void 0 : _a.items.forEach((item) => {
|
|
44
|
+
var _a;
|
|
45
|
+
const labelsTexts = this.getLabelValuesForItem(item, dataRows);
|
|
46
|
+
const labelSize = AxisModel.getLabelSize(this.maxLabelSize, labelsTexts);
|
|
47
|
+
slices.push({
|
|
48
|
+
orient: this.getLabelOrient((_a = item.labels) === null || _a === void 0 ? void 0 : _a.position),
|
|
49
|
+
size: this.chartOrientation === "vertical" ? labelSize.height : labelSize.width
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
return slices;
|
|
53
|
+
}
|
|
54
|
+
getPreparedOptions(scopedDatasourceRows) {
|
|
55
|
+
var _a, _b, _c, _d;
|
|
56
|
+
const groupingItemsValues = [];
|
|
57
|
+
let keyAxisSideIndex = 0;
|
|
58
|
+
let oppositeKeyAxisSideIndex = 0;
|
|
59
|
+
for (const item of (_b = (_a = this.groupingOptions) === null || _a === void 0 ? void 0 : _a.items) !== null && _b !== void 0 ? _b : []) {
|
|
60
|
+
const labelsPosition = (_d = (_c = item.labels) === null || _c === void 0 ? void 0 : _c.position) !== null && _d !== void 0 ? _d : this.keyAxisOptions.position;
|
|
61
|
+
let orient = this.getLabelOrient(labelsPosition);
|
|
62
|
+
let sideIndex;
|
|
63
|
+
if (labelsPosition === "start")
|
|
64
|
+
sideIndex = keyAxisSideIndex++;
|
|
65
|
+
else
|
|
66
|
+
sideIndex = oppositeKeyAxisSideIndex++;
|
|
67
|
+
const textAnchorByOrient = {
|
|
68
|
+
top: "middle",
|
|
69
|
+
bottom: "middle",
|
|
70
|
+
left: "start",
|
|
71
|
+
right: "end"
|
|
72
|
+
};
|
|
73
|
+
const dominantBaselineByOrient = {
|
|
74
|
+
top: "hanging",
|
|
75
|
+
bottom: "auto",
|
|
76
|
+
left: "middle",
|
|
77
|
+
right: "middle"
|
|
78
|
+
};
|
|
79
|
+
groupingItemsValues.push({
|
|
80
|
+
domain: this.getLabelValuesForItem(item, scopedDatasourceRows),
|
|
81
|
+
orient,
|
|
82
|
+
sideIndex,
|
|
83
|
+
field: item.data.field,
|
|
84
|
+
textAnchor: textAnchorByOrient[orient],
|
|
85
|
+
dominantBaseline: dominantBaselineByOrient[orient]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return groupingItemsValues;
|
|
89
|
+
}
|
|
90
|
+
getLabelValuesForItem(item, dataRows) {
|
|
91
|
+
const values = new Set(dataRows.map((row) => row[item.data.field.name]));
|
|
92
|
+
return Array.from(values);
|
|
93
|
+
}
|
|
94
|
+
getLabelOrient(labelsPosition) {
|
|
95
|
+
if (this.chartOrientation === "vertical")
|
|
96
|
+
return this.getLabelPosition(labelsPosition) === "start" ? "top" : "bottom";
|
|
97
|
+
return this.getLabelPosition(labelsPosition) === "start" ? "left" : "right";
|
|
98
|
+
}
|
|
99
|
+
getLabelPosition(labelsPosition) {
|
|
100
|
+
return labelsPosition !== null && labelsPosition !== void 0 ? labelsPosition : this.keyAxisOptions.position;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { AxisLabelFormatter, MdtChartsConfig, MdtChartsField, MdtChartsFieldName, MdtChartsTwoDimensionalOptions, TwoDimensionalChartType, TwoDimensionalValueGroup, ValueLabelsFormatter } from "
|
|
2
|
-
import { DesignerConfig } from "
|
|
3
|
-
import { ValueLabelsStyleModel } from "
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export declare function getConfigReader(config: MdtChartsConfig, designerConfig: DesignerConfig): BaseConfigReader;
|
|
1
|
+
import { AxisLabelFormatter, MdtChartsConfig, MdtChartsField, MdtChartsFieldName, MdtChartsTwoDimensionalOptions, TwoDimensionalChartType, TwoDimensionalValueGroup, ValueLabelsFormatter } from "../../../../config/config";
|
|
2
|
+
import { DesignerConfig } from "../../../../designer/designerConfig";
|
|
3
|
+
import { ValueLabelsStyleModel } from "../../../model";
|
|
4
|
+
import { BaseConfigReader } from "../baseConfigReader";
|
|
5
|
+
import { GroupingConfigReader } from "./groupingConfigReader/groupingConfigReader";
|
|
8
6
|
export declare class TwoDimConfigReader implements BaseConfigReader {
|
|
9
7
|
private designerConfig;
|
|
10
8
|
readonly options: MdtChartsTwoDimensionalOptions;
|
|
9
|
+
readonly grouping: GroupingConfigReader;
|
|
11
10
|
constructor(config: MdtChartsConfig, designerConfig: DesignerConfig);
|
|
12
11
|
getValueFields(): MdtChartsField[];
|
|
13
12
|
getFieldsBySegments(valueGroup: TwoDimensionalValueGroup): MdtChartsFieldName[][];
|
|
@@ -25,9 +24,3 @@ export declare class TwoDimConfigReader implements BaseConfigReader {
|
|
|
25
24
|
getValueLabelsStyleModel(): ValueLabelsStyleModel;
|
|
26
25
|
private calculateAxisLabelFormatter;
|
|
27
26
|
}
|
|
28
|
-
export declare class PolarConfigReader implements BaseConfigReader {
|
|
29
|
-
private options;
|
|
30
|
-
constructor(config: MdtChartsConfig);
|
|
31
|
-
getValueFields(): MdtChartsField[];
|
|
32
|
-
}
|
|
33
|
-
export {};
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
if (config.options.type === "2d")
|
|
3
|
-
return new TwoDimConfigReader(config, designerConfig);
|
|
4
|
-
if (config.options.type === "polar")
|
|
5
|
-
return new PolarConfigReader(config);
|
|
6
|
-
throw new Error(`Config reader for type "${config.options.type}" not exists`);
|
|
7
|
-
}
|
|
1
|
+
import { GroupingConfigReader } from "./groupingConfigReader/groupingConfigReader";
|
|
8
2
|
export class TwoDimConfigReader {
|
|
9
3
|
constructor(config, designerConfig) {
|
|
10
4
|
this.designerConfig = designerConfig;
|
|
11
5
|
this.options = config.options;
|
|
6
|
+
this.grouping = new GroupingConfigReader(this.options.axis.key, this.options.orientation, this.options.grouping);
|
|
12
7
|
}
|
|
13
8
|
getValueFields() {
|
|
14
9
|
const fields = [];
|
|
@@ -32,6 +27,8 @@ export class TwoDimConfigReader {
|
|
|
32
27
|
return this.calculateAxisLabelFormatter(this.options.axis.value);
|
|
33
28
|
}
|
|
34
29
|
getSecondaryAxisLabelFormatter() {
|
|
30
|
+
if (!this.options.axis.valueSecondary)
|
|
31
|
+
throw new Error("Secondary axis is not defined");
|
|
35
32
|
return this.calculateAxisLabelFormatter(this.options.axis.valueSecondary);
|
|
36
33
|
}
|
|
37
34
|
getLegendItemInfo() {
|
|
@@ -49,18 +46,18 @@ export class TwoDimConfigReader {
|
|
|
49
46
|
this.options.charts.some((chart) => chart.data.valueGroup === "secondary"));
|
|
50
47
|
}
|
|
51
48
|
getValueLabelFormatterForChart(chartIndex) {
|
|
52
|
-
var _a, _b, _c, _d;
|
|
49
|
+
var _a, _b, _c, _d, _e;
|
|
53
50
|
const chart = this.options.charts[chartIndex];
|
|
54
51
|
const axis = this.options.axis;
|
|
55
52
|
if ((_a = chart.valueLabels) === null || _a === void 0 ? void 0 : _a.format)
|
|
56
53
|
return chart.valueLabels.format;
|
|
57
54
|
if (chart.data.valueGroup === "secondary") {
|
|
58
|
-
if ((_b = axis.valueSecondary
|
|
55
|
+
if ((_c = (_b = axis.valueSecondary) === null || _b === void 0 ? void 0 : _b.labels) === null || _c === void 0 ? void 0 : _c.format)
|
|
59
56
|
return axis.valueSecondary.labels.format;
|
|
60
|
-
else if ((
|
|
57
|
+
else if ((_d = axis.value.labels) === null || _d === void 0 ? void 0 : _d.format)
|
|
61
58
|
return axis.value.labels.format;
|
|
62
59
|
}
|
|
63
|
-
else if ((
|
|
60
|
+
else if ((_e = axis.value.labels) === null || _e === void 0 ? void 0 : _e.format)
|
|
64
61
|
return axis.value.labels.format;
|
|
65
62
|
const valueFieldFormat = chart.data.valueFields[0].format;
|
|
66
63
|
return (v) => this.designerConfig.dataFormat.formatters(v, { type: valueFieldFormat });
|
|
@@ -90,11 +87,3 @@ export class TwoDimConfigReader {
|
|
|
90
87
|
return this.calculateDefaultAxisLabelFormatter();
|
|
91
88
|
}
|
|
92
89
|
}
|
|
93
|
-
export class PolarConfigReader {
|
|
94
|
-
constructor(config) {
|
|
95
|
-
this.options = config.options;
|
|
96
|
-
}
|
|
97
|
-
getValueFields() {
|
|
98
|
-
return [this.options.chart.data.valueField];
|
|
99
|
-
}
|
|
100
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CanvasModel } from "./canvasModel/canvasModel";
|
|
2
2
|
import { ChartBlockVersion } from "./chartBlockVersion/chartBlockVersion";
|
|
3
|
-
import { getConfigReader } from "./configReader";
|
|
3
|
+
import { getConfigReader } from "./configReader/baseConfigReader";
|
|
4
4
|
import { DataModelInstance } from "./dataModel/dataModel";
|
|
5
5
|
export class ModelInstance {
|
|
6
6
|
constructor(chartVersionNumber) {
|
|
@@ -4,8 +4,8 @@ export declare class TitleConfigReader {
|
|
|
4
4
|
private readonly config;
|
|
5
5
|
private readonly dataGetter;
|
|
6
6
|
private readonly defaultCssUnitReader;
|
|
7
|
-
static create(config: Title, modelInstance: ModelInstance): TitleConfigReader;
|
|
8
|
-
constructor(config: Title, dataGetter: () => MdtChartsDataRow[], defaultCssUnitReader: () => number);
|
|
7
|
+
static create(config: Title | undefined, modelInstance: ModelInstance): TitleConfigReader;
|
|
8
|
+
constructor(config: Title | undefined, dataGetter: () => MdtChartsDataRow[], defaultCssUnitReader: () => number);
|
|
9
9
|
getTextContent(): string;
|
|
10
10
|
getFontSize(): number;
|
|
11
11
|
private getResolvedTitle;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChartOrientation, MdtChartsTwoDimensionalChart } from "../../config/config";
|
|
2
2
|
import { ChartOptionsCanvas, DesignerConfig } from "../../designer/designerConfig";
|
|
3
3
|
import { TwoDimensionalOptionsModel, TwoDimChartElementsSettings } from "../model";
|
|
4
|
-
import { TwoDimConfigReader } from "../modelInstance/configReader";
|
|
4
|
+
import { TwoDimConfigReader } from "../modelInstance/configReader/twoDimConfigReader.ts/twoDimConfigReader";
|
|
5
5
|
import { ModelInstance } from "../modelInstance/modelInstance";
|
|
6
6
|
export declare class TwoDimensionalModel {
|
|
7
7
|
static getOptions(configReader: TwoDimConfigReader, designerConfig: DesignerConfig, modelInstance: ModelInstance): TwoDimensionalOptionsModel;
|
|
@@ -10,11 +10,13 @@ import { TitleConfigReader } from "../modelInstance/titleConfigReader";
|
|
|
10
10
|
import { createRecordOverflowModel } from "../featuresModel/recordOverflowModel/recordOverflowModel";
|
|
11
11
|
import { TwoDimTooltipContentGenerator } from "../featuresModel/tooltipModel/tooltipContentModel";
|
|
12
12
|
import { TwoDimInitialRowsProvider } from "../featuresModel/tooltipModel/contentByNotations/twoDimInitialRowsProvider";
|
|
13
|
+
import { GroupingLabelsCoordinateHandler } from "../featuresModel/grouping/groupingLabels/groupingLabelsCoordinateHandlers";
|
|
14
|
+
import { GroupingLabelsCoordinateScaler } from "../featuresModel/grouping/groupingLabels/groupingLabelsScaler";
|
|
13
15
|
export class TwoDimensionalModel {
|
|
14
16
|
static getOptions(configReader, designerConfig, modelInstance) {
|
|
15
17
|
const options = configReader.options;
|
|
16
18
|
const canvasModel = modelInstance.canvasModel;
|
|
17
|
-
const scaleModel = new ScaleModel(options, canvasModel);
|
|
19
|
+
const scaleModel = new ScaleModel(options, canvasModel, designerConfig.canvas.chartOptions.bar);
|
|
18
20
|
const scaleMarginRecalcer = new ScaleAxisRecalcer(() => scaleModel.getScaleLinear(modelInstance.dataModel.repository.getScopedRows(), configReader));
|
|
19
21
|
scaleMarginRecalcer.recalculateMargin(canvasModel, options.orientation, options.axis.key);
|
|
20
22
|
const scaleValueInfo = scaleMarginRecalcer.getScaleValue();
|
|
@@ -27,6 +29,7 @@ export class TwoDimensionalModel {
|
|
|
27
29
|
const keyAxis = AxisModel.getKeyAxis(options, modelInstance.dataModel.repository.getScopedFullSource(), designerConfig.canvas.axisLabel, canvasModel, designerConfig.elementsOptions.tooltip, () => scaleValueInfo.scaleFn(0));
|
|
28
30
|
const charts = this.getChartsModel(options.charts, configReader, options.orientation, designerConfig, modelInstance.dataModel.repository, keyAxis.orient, canvasModel, options.data.keyField.name, modelInstance);
|
|
29
31
|
const titleConfig = TitleConfigReader.create(options.title, modelInstance);
|
|
32
|
+
const keyScale = scaleModel.getScaleKey(modelInstance.dataModel.getAllowableKeys());
|
|
30
33
|
const isHorizontal = options.orientation === "horizontal";
|
|
31
34
|
return {
|
|
32
35
|
legend: canvasModel.legendCanvas.getModel(),
|
|
@@ -34,9 +37,51 @@ export class TwoDimensionalModel {
|
|
|
34
37
|
textContent: titleConfig.getTextContent(),
|
|
35
38
|
fontSize: titleConfig.getFontSize()
|
|
36
39
|
},
|
|
40
|
+
grouping: {
|
|
41
|
+
enabled: configReader.grouping.isEnabled(),
|
|
42
|
+
items: configReader.grouping
|
|
43
|
+
.getPreparedOptions(modelInstance.dataModel.repository.getScopedRows())
|
|
44
|
+
.map((prepared) => {
|
|
45
|
+
let keyScaleInfo;
|
|
46
|
+
if (keyScale.type === "band") {
|
|
47
|
+
keyScaleInfo = {
|
|
48
|
+
type: keyScale.type,
|
|
49
|
+
keyAxisOuterPadding: keyScale.sizes.paddingOuter,
|
|
50
|
+
keyAxisInnerPadding: keyScale.sizes.paddingInner
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
keyScaleInfo = { type: "point" };
|
|
55
|
+
}
|
|
56
|
+
const scaler = new GroupingLabelsCoordinateScaler({
|
|
57
|
+
dataRows: modelInstance.dataModel.repository.getScopedRows(),
|
|
58
|
+
field: prepared.field,
|
|
59
|
+
keyScaleInfo,
|
|
60
|
+
range: keyScale.range
|
|
61
|
+
});
|
|
62
|
+
const coordinateHandler = new GroupingLabelsCoordinateHandler(canvasModel, {
|
|
63
|
+
orient: prepared.orient,
|
|
64
|
+
sideIndex: prepared.sideIndex,
|
|
65
|
+
otherComponentSizes: {
|
|
66
|
+
titleTotalNeededSpace: canvasModel.titleCanvas.getAllNeededSpace(),
|
|
67
|
+
legendTotalNeededSpace: canvasModel.legendCanvas.getAllNeededSpace()
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
orient: prepared.orient,
|
|
72
|
+
domain: prepared.domain,
|
|
73
|
+
textAnchor: prepared.textAnchor,
|
|
74
|
+
dominantBaseline: prepared.dominantBaseline,
|
|
75
|
+
coordinate: {
|
|
76
|
+
handleX: (groupKey) => coordinateHandler.handleX(scaler.scaleForKey(groupKey)),
|
|
77
|
+
handleY: (groupKey) => coordinateHandler.handleY(scaler.scaleForKey(groupKey))
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
})
|
|
81
|
+
},
|
|
37
82
|
selectable: !!options.selectable,
|
|
38
83
|
orient: options.orientation,
|
|
39
|
-
scale: Object.assign({ key:
|
|
84
|
+
scale: Object.assign({ key: keyScale, value: scaleValueInfo.scale }, (configReader.containsSecondaryAxis() && { valueSecondary: secondaryScaleValueInfo.scale })),
|
|
40
85
|
axis: Object.assign({ key: keyAxis, value: AxisModel.getMainValueAxis(configReader.calculateDefaultAxisLabelFormatter(), options.orientation, options.axis.value.position, options.axis.value, designerConfig.canvas.axisLabel, canvasModel, scaleValueInfo.scale) }, (configReader.containsSecondaryAxis() && {
|
|
41
86
|
valueSecondary: AxisModel.getSecondaryValueAxis(configReader.calculateDefaultAxisLabelFormatter(), options.orientation, options.axis.value.position, options.axis.valueSecondary, designerConfig.canvas.axisLabel, canvasModel, secondaryScaleValueInfo.scale)
|
|
42
87
|
})),
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export class TitleModel {
|
|
2
|
-
static getTitleModel(titleConfig) {
|
|
3
|
-
const defaultPads = titleConfig.getFontSize();
|
|
4
|
-
const pad = titleConfig.getTextContent() ? defaultPads : 0;
|
|
5
|
-
return {
|
|
6
|
-
margin: {
|
|
7
|
-
bottom: 5,
|
|
8
|
-
left: 0,
|
|
9
|
-
right: 0,
|
|
10
|
-
top: 0
|
|
11
|
-
},
|
|
12
|
-
size: pad,
|
|
13
|
-
pad: 0
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
}
|
|
File without changes
|