mdt-charts 1.27.1 → 1.27.3
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/.prettierrc +6 -0
- package/lib/config/config.d.ts +13 -13
- package/lib/designer/designerConfig.d.ts +1 -1
- package/lib/engine/block/block.js +14 -14
- package/lib/engine/block/blockHelper.js +2 -2
- package/lib/engine/block/blockSvg.js +25 -28
- package/lib/engine/block/defs/LinearGradientDef.js +9 -8
- package/lib/engine/contentManager/contentManagerFactory.js +1 -1
- package/lib/engine/elementHighlighter/elementHighlighter.d.ts +3 -3
- package/lib/engine/elementHighlighter/elementHighlighter.js +52 -54
- package/lib/engine/elementHighlighter/selectHighlighter.js +7 -7
- package/lib/engine/engine.d.ts +4 -4
- package/lib/engine/engine.js +5 -5
- package/lib/engine/features/aggregator/aggregator.d.ts +1 -1
- package/lib/engine/features/aggregator/aggregator.js +43 -45
- package/lib/engine/features/axis/axis.d.ts +1 -1
- package/lib/engine/features/axis/axis.js +53 -48
- package/lib/engine/features/axis/axisDomHelper.d.ts +3 -3
- package/lib/engine/features/axis/axisDomHelper.js +6 -8
- package/lib/engine/features/axis/axisHelper.d.ts +2 -2
- package/lib/engine/features/axis/axisHelper.js +14 -21
- package/lib/engine/features/axis/axisLabelDomHelper.d.ts +3 -3
- package/lib/engine/features/axis/axisLabelDomHelper.js +74 -66
- package/lib/engine/features/axis/axisLabelsEventManager.js +11 -11
- package/lib/engine/features/embeddedLabels/embeddedLabels.d.ts +3 -3
- package/lib/engine/features/embeddedLabels/embeddedLabels.js +44 -44
- package/lib/engine/features/embeddedLabels/embeddedLabelsDomHelper.d.ts +1 -1
- package/lib/engine/features/embeddedLabels/embeddedLabelsDomHelper.js +3 -6
- package/lib/engine/features/embeddedLabels/embeddedLabelsHelper.d.ts +2 -2
- package/lib/engine/features/embeddedLabels/embeddedLabelsHelper.js +22 -20
- package/lib/engine/features/gridLine/gidLineHelper.d.ts +1 -1
- package/lib/engine/features/gridLine/gidLineHelper.js +5 -5
- package/lib/engine/features/gridLine/gridLine.js +14 -23
- package/lib/engine/features/legend/legend.js +27 -36
- package/lib/engine/features/legend/legendDomHelper.js +18 -9
- package/lib/engine/features/legend/legendEventsManager.js +18 -13
- package/lib/engine/features/legend/legendHelper.js +19 -19
- package/lib/engine/features/legend/legendHelperService.js +5 -5
- package/lib/engine/features/legend/legendMarkerCreator.js +23 -22
- package/lib/engine/features/legend/legendWidthCalculator.js +5 -7
- package/lib/engine/features/markDots/markDot.d.ts +2 -2
- package/lib/engine/features/markDots/markDot.js +35 -34
- package/lib/engine/features/markDots/markDotsHelper.js +6 -6
- package/lib/engine/features/recordOverflowAlert/recordOverflowAlertCore.js +11 -11
- package/lib/engine/features/scale/scale.d.ts +4 -5
- package/lib/engine/features/scale/scale.js +16 -25
- package/lib/engine/features/tipBox/tipBox.d.ts +2 -2
- package/lib/engine/features/tipBox/tipBox.js +13 -17
- package/lib/engine/features/tipBox/tipBoxHelper.js +5 -5
- package/lib/engine/features/title/title.d.ts +1 -1
- package/lib/engine/features/title/title.js +8 -11
- package/lib/engine/features/tolltip/newTooltip/newTooltip.d.ts +1 -1
- package/lib/engine/features/tolltip/newTooltip/newTooltip.js +6 -8
- package/lib/engine/features/tolltip/tooltip.d.ts +2 -2
- package/lib/engine/features/tolltip/tooltip.js +47 -42
- package/lib/engine/features/tolltip/tooltipComponentsManager.d.ts +2 -2
- package/lib/engine/features/tolltip/tooltipComponentsManager.js +49 -52
- package/lib/engine/features/tolltip/tooltipDomHelper.d.ts +1 -1
- package/lib/engine/features/tolltip/tooltipDomHelper.js +41 -33
- package/lib/engine/features/tolltip/tooltipHelper.js +15 -11
- package/lib/engine/features/valueLabels/valueLabels.d.ts +3 -2
- package/lib/engine/features/valueLabels/valueLabels.js +33 -44
- package/lib/engine/features/valueLabels/valueLabelsHelper.js +6 -6
- package/lib/engine/features/valueLabelsCollision/valueLabelsCollision.js +9 -10
- package/lib/engine/features/valueLabelsCollision/valueLabelsCollisionHelper.js +4 -4
- package/lib/engine/filterManager/filterEventManager.js +18 -15
- package/lib/engine/helpers/domHelper.d.ts +3 -4
- package/lib/engine/helpers/domHelper.js +9 -13
- package/lib/engine/helpers/fontResizer/fontResizer.js +2 -2
- package/lib/engine/helpers/helper.js +14 -9
- package/lib/engine/helpers/namesHelper.js +2 -2
- package/lib/engine/polarNotation/donut/DonutHelper.js +6 -8
- package/lib/engine/polarNotation/donut/donut.d.ts +3 -3
- package/lib/engine/polarNotation/donut/donut.js +47 -58
- package/lib/engine/polarNotation/extenders/polarRecordOverflowAlert.js +11 -11
- package/lib/engine/polarNotation/polarManager.js +3 -5
- package/lib/engine/transitionManager.js +4 -7
- package/lib/engine/twoDimensionalNotation/area/area.d.ts +1 -1
- package/lib/engine/twoDimensionalNotation/area/area.js +77 -62
- package/lib/engine/twoDimensionalNotation/area/areaGenerator.js +4 -10
- package/lib/engine/twoDimensionalNotation/area/areaHelper.d.ts +3 -3
- package/lib/engine/twoDimensionalNotation/area/areaHelper.js +21 -13
- package/lib/engine/twoDimensionalNotation/bar/bar.d.ts +2 -2
- package/lib/engine/twoDimensionalNotation/bar/bar.js +70 -67
- package/lib/engine/twoDimensionalNotation/bar/barHelper.js +40 -35
- package/lib/engine/twoDimensionalNotation/dot/dotChart.js +60 -42
- package/lib/engine/twoDimensionalNotation/extenders/twoDimRecordOverflowAlert.js +7 -7
- package/lib/engine/twoDimensionalNotation/line/line.d.ts +4 -4
- package/lib/engine/twoDimensionalNotation/line/line.js +45 -28
- package/lib/engine/twoDimensionalNotation/line/lineBuilder.js +18 -16
- package/lib/engine/twoDimensionalNotation/line/lineGenerator.js +2 -4
- package/lib/engine/twoDimensionalNotation/line/lineHelper.d.ts +6 -6
- package/lib/engine/twoDimensionalNotation/line/lineHelper.js +26 -17
- package/lib/engine/twoDimensionalNotation/lineLike/generatorMiddleware/lineLikeGeneratorDefineMiddleware.js +1 -1
- package/lib/engine/twoDimensionalNotation/twoDimensionalManager.js +25 -21
- package/lib/engine/valueFormatter.d.ts +1 -1
- package/lib/main.d.ts +1 -0
- package/lib/main.js +8 -7
- package/lib/model/chartStyleModel/chartStyleModel.js +5 -3
- package/lib/model/chartStyleModel/colorRange.js +1 -3
- package/lib/model/chartStyleModel/twoDimensionalChartStyleModel.js +9 -7
- package/lib/model/dataManagerModel/dataManagerModel.js +28 -16
- package/lib/model/featuresModel/axisModel.d.ts +6 -3
- package/lib/model/featuresModel/axisModel.js +59 -32
- package/lib/model/featuresModel/axisModelService.js +2 -2
- package/lib/model/featuresModel/legendModel/legendCanvasModel.d.ts +1 -1
- package/lib/model/featuresModel/legendModel/legendCanvasModel.js +12 -12
- package/lib/model/featuresModel/legendModel/legendModel.js +2 -2
- package/lib/model/featuresModel/legendModel/polarMarginCalculator.js +1 -1
- package/lib/model/featuresModel/legendModel/twoDimLegendModel.js +4 -5
- package/lib/model/featuresModel/scaleModel/scaleAxisRecalcer.d.ts +4 -5
- package/lib/model/featuresModel/scaleModel/scaleAxisRecalcer.js +3 -5
- package/lib/model/featuresModel/scaleModel/scaleDomainService.js +10 -12
- package/lib/model/featuresModel/scaleModel/scaleModel.d.ts +8 -4
- package/lib/model/featuresModel/scaleModel/scaleModel.js +20 -12
- package/lib/model/featuresModel/scaleModel/scaleModelServices.js +5 -5
- package/lib/model/featuresModel/tooltipModel.js +1 -1
- package/lib/model/featuresModel/valueLabelsModel/valueLabelsModel.js +5 -5
- package/lib/model/helpers/modelHelper.js +6 -4
- package/lib/model/helpers/twoDimensionalModelHelper.d.ts +1 -1
- package/lib/model/helpers/twoDimensionalModelHelper.js +23 -23
- package/lib/model/helpers/unitsReader.js +1 -1
- package/lib/model/margin/marginModel.js +1 -1
- package/lib/model/margin/twoDim/twoDimMarginModel.d.ts +1 -0
- package/lib/model/margin/twoDim/twoDimMarginModel.js +38 -28
- package/lib/model/model.d.ts +17 -4
- package/lib/model/modelBuilder.d.ts +4 -4
- package/lib/model/modelBuilder.js +19 -18
- package/lib/model/modelInstance/canvasModel/canvasSizesModel/marginModelService.js +1 -1
- package/lib/model/modelInstance/chartBlockVersion/chartBlockVersion.d.ts +5 -0
- package/lib/model/modelInstance/chartBlockVersion/chartBlockVersion.js +8 -0
- package/lib/model/modelInstance/configReader.js +11 -10
- package/lib/model/modelInstance/dataModel/dataRepository.js +5 -5
- package/lib/model/modelInstance/modelInstance.d.ts +4 -2
- package/lib/model/modelInstance/modelInstance.js +5 -3
- package/lib/model/modelInstance/titleConfigReader.js +5 -5
- package/lib/model/notations/polar/donut/donutModel.js +1 -1
- package/lib/model/notations/polar/polarModel.js +6 -6
- package/lib/model/notations/twoDimensional/styles.d.ts +2 -2
- package/lib/model/notations/twoDimensional/styles.js +8 -8
- package/lib/model/notations/twoDimensionalModel.d.ts +0 -1
- package/lib/model/notations/twoDimensionalModel.js +32 -29
- package/package.json +59 -59
- package/tsconfig.production.json +14 -24
- package/README.md +0 -2
|
@@ -6,44 +6,52 @@ export var ScaleType;
|
|
|
6
6
|
ScaleType[ScaleType["Value"] = 1] = "Value";
|
|
7
7
|
})(ScaleType || (ScaleType = {}));
|
|
8
8
|
export class ScaleModel {
|
|
9
|
-
|
|
9
|
+
constructor(options, canvasModel) {
|
|
10
|
+
this.options = options;
|
|
11
|
+
this.canvasModel = canvasModel;
|
|
12
|
+
}
|
|
13
|
+
getScaleKey(allowableKeys) {
|
|
14
|
+
const bandLikeCharts = this.getChartsByTypes(this.options.charts, ["bar", "dot"]);
|
|
10
15
|
return {
|
|
11
16
|
domain: allowableKeys,
|
|
12
17
|
range: {
|
|
13
18
|
start: 0,
|
|
14
|
-
end: getScaleKeyRangePeek(
|
|
19
|
+
end: getScaleKeyRangePeek(this.options.orientation, this.canvasModel)
|
|
15
20
|
},
|
|
16
|
-
type: this.getScaleKeyType(charts),
|
|
21
|
+
type: this.getScaleKeyType(this.options.charts),
|
|
17
22
|
elementsAmount: getElementsAmountForScale(bandLikeCharts)
|
|
18
23
|
};
|
|
19
24
|
}
|
|
20
|
-
getScaleLinear(
|
|
25
|
+
getScaleLinear(dataRows, configReader) {
|
|
21
26
|
var _a;
|
|
22
27
|
return {
|
|
23
|
-
domain: getScaleLinearDomain(options.axis.value.domain, dataRows, options),
|
|
28
|
+
domain: getScaleLinearDomain(this.options.axis.value.domain, dataRows, this.options),
|
|
24
29
|
range: {
|
|
25
30
|
start: 0,
|
|
26
|
-
end: getScaleValueRangePeek(options.orientation, canvasModel)
|
|
31
|
+
end: getScaleValueRangePeek(this.options.orientation, this.canvasModel)
|
|
27
32
|
},
|
|
28
33
|
type: "linear",
|
|
29
34
|
formatter: (_a = configReader === null || configReader === void 0 ? void 0 : configReader.getAxisLabelFormatter()) !== null && _a !== void 0 ? _a : null
|
|
30
35
|
};
|
|
31
36
|
}
|
|
32
|
-
getScaleSecondaryLinear(
|
|
37
|
+
getScaleSecondaryLinear(dataRows, configReader) {
|
|
33
38
|
var _a;
|
|
34
39
|
return {
|
|
35
|
-
domain: getScaleLinearDomain(options.axis.value.domain, dataRows, options,
|
|
40
|
+
domain: getScaleLinearDomain(this.options.axis.value.domain, dataRows, this.options, "secondary"),
|
|
36
41
|
range: {
|
|
37
42
|
start: 0,
|
|
38
|
-
end: getScaleValueRangePeek(options.orientation, canvasModel)
|
|
43
|
+
end: getScaleValueRangePeek(this.options.orientation, this.canvasModel)
|
|
39
44
|
},
|
|
40
45
|
type: "linear",
|
|
41
46
|
formatter: (_a = configReader === null || configReader === void 0 ? void 0 : configReader.getSecondaryAxisLabelFormatter()) !== null && _a !== void 0 ? _a : null
|
|
42
47
|
};
|
|
43
48
|
}
|
|
49
|
+
getChartsByTypes(charts, types) {
|
|
50
|
+
return charts.filter((chart) => types.includes(chart.type));
|
|
51
|
+
}
|
|
44
52
|
getScaleKeyType(charts) {
|
|
45
|
-
if (charts.some((chart) => chart.type ===
|
|
46
|
-
return
|
|
47
|
-
return
|
|
53
|
+
if (charts.some((chart) => chart.type === "bar" || chart.type === "dot"))
|
|
54
|
+
return "band";
|
|
55
|
+
return "point";
|
|
48
56
|
}
|
|
49
57
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export function getScaleKeyRangePeek(chartOrientation, canvasModel) {
|
|
2
|
-
if (chartOrientation ===
|
|
2
|
+
if (chartOrientation === "vertical")
|
|
3
3
|
return canvasModel.getChartBlockWidth();
|
|
4
4
|
return canvasModel.getChartBlockHeight();
|
|
5
5
|
}
|
|
6
6
|
export function getScaleValueRangePeek(chartOrientation, canvasModel) {
|
|
7
|
-
if (chartOrientation ===
|
|
7
|
+
if (chartOrientation === "vertical")
|
|
8
8
|
return canvasModel.getChartBlockHeight();
|
|
9
9
|
return canvasModel.getChartBlockWidth();
|
|
10
10
|
}
|
|
@@ -12,12 +12,12 @@ export function getElementsAmountForScale(bandLikeCharts) {
|
|
|
12
12
|
if (bandLikeCharts.length === 0)
|
|
13
13
|
return 1;
|
|
14
14
|
let barAmounts = {};
|
|
15
|
-
bandLikeCharts.forEach(chart => {
|
|
15
|
+
bandLikeCharts.forEach((chart) => {
|
|
16
16
|
if (!barAmounts[chart.type])
|
|
17
17
|
barAmounts[chart.type] = 0;
|
|
18
|
-
if (chart.type ===
|
|
18
|
+
if (chart.type === "dot")
|
|
19
19
|
barAmounts[chart.type] = 1;
|
|
20
|
-
if (chart.type ===
|
|
20
|
+
if (chart.type === "bar") {
|
|
21
21
|
if (chart.isSegmented)
|
|
22
22
|
barAmounts[chart.type] += 1;
|
|
23
23
|
else
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export class TooltipModel {
|
|
2
2
|
static getTooltipModel(options) {
|
|
3
3
|
return {
|
|
4
|
-
position: (options === null || options === void 0 ? void 0 : options.position) ||
|
|
4
|
+
position: (options === null || options === void 0 ? void 0 : options.position) || "followCursor"
|
|
5
5
|
};
|
|
6
6
|
}
|
|
7
7
|
}
|
|
@@ -8,9 +8,9 @@ export class ValueLabelCoordinateCalculator {
|
|
|
8
8
|
}
|
|
9
9
|
getValueLabelY(scaledValue) {
|
|
10
10
|
switch (this.keyAxisOrient) {
|
|
11
|
-
case
|
|
11
|
+
case "bottom":
|
|
12
12
|
return scaledValue - this.offsetSizePx + this.margin.top;
|
|
13
|
-
case
|
|
13
|
+
case "top":
|
|
14
14
|
return scaledValue + this.offsetSizePx + this.margin.top;
|
|
15
15
|
default:
|
|
16
16
|
return scaledValue + this.margin.top;
|
|
@@ -18,9 +18,9 @@ export class ValueLabelCoordinateCalculator {
|
|
|
18
18
|
}
|
|
19
19
|
getValueLabelX(scaledValue) {
|
|
20
20
|
switch (this.keyAxisOrient) {
|
|
21
|
-
case
|
|
21
|
+
case "right":
|
|
22
22
|
return scaledValue - this.offsetSizePx + this.margin.left;
|
|
23
|
-
case
|
|
23
|
+
case "left":
|
|
24
24
|
return scaledValue + this.offsetSizePx + this.margin.left;
|
|
25
25
|
default:
|
|
26
26
|
return scaledValue + this.margin.left;
|
|
@@ -30,7 +30,7 @@ export class ValueLabelCoordinateCalculator {
|
|
|
30
30
|
export function calculateValueLabelAlignment(keyAxisOrient, positionMode) {
|
|
31
31
|
if (!positionMode || positionMode === "after") {
|
|
32
32
|
switch (keyAxisOrient) {
|
|
33
|
-
case
|
|
33
|
+
case "top":
|
|
34
34
|
return { dominantBaseline: "hanging", textAnchor: "middle" };
|
|
35
35
|
case "bottom":
|
|
36
36
|
return { dominantBaseline: "auto", textAnchor: "middle" };
|
|
@@ -19,15 +19,17 @@ export class ModelHelper {
|
|
|
19
19
|
static getStringScore(word) {
|
|
20
20
|
// lower case letter width ~ 0.8 from upper case width.
|
|
21
21
|
// Number width == lower case letter width
|
|
22
|
-
const fontSize = this.getBaseFontSize(
|
|
22
|
+
const fontSize = this.getBaseFontSize("--chart-base-font-size");
|
|
23
23
|
let score = 0;
|
|
24
|
-
const upperLetterScore = fontSize /
|
|
25
|
-
const lowerLetterScore = fontSize /
|
|
24
|
+
const upperLetterScore = fontSize / 9;
|
|
25
|
+
const lowerLetterScore = fontSize / 13;
|
|
26
26
|
const digitScore = fontSize / 15;
|
|
27
27
|
const otherSymbolScore = fontSize / 23;
|
|
28
28
|
const specialSmallSymbols = [",", ".", " "];
|
|
29
29
|
for (let i = 0; i < word.length; i++) {
|
|
30
|
-
if (parseFloat(word[i]).toString() !== word[i] &&
|
|
30
|
+
if (parseFloat(word[i]).toString() !== word[i] &&
|
|
31
|
+
!specialSmallSymbols.includes(word[i]) &&
|
|
32
|
+
word[i].trim().length > 0) {
|
|
31
33
|
if (word[i].toUpperCase() === word[i])
|
|
32
34
|
score += upperLetterScore;
|
|
33
35
|
else
|
|
@@ -3,7 +3,7 @@ import { GradientDef, MarkDotDatumItem, Orient, TwoDimensionalChartModel, TwoDim
|
|
|
3
3
|
import { CanvasModel } from "../modelInstance/canvasModel/canvasModel";
|
|
4
4
|
export declare class TwoDimensionalModelHelper {
|
|
5
5
|
static shouldMarkerShow(chart: MdtChartsTwoDimensionalChart, dataRows: MdtChartsDataRow[], valueFieldName: string, currentRow: MarkDotDatumItem, keyFieldName: string): boolean;
|
|
6
|
-
static getGradientDefs(charts: TwoDimensionalChartModel[], keyAxisOrient: Orient, chartOrient: ChartOrientation): GradientDef[];
|
|
6
|
+
static getGradientDefs(charts: TwoDimensionalChartModel[], keyAxisOrient: Orient, chartOrient: ChartOrientation, chartBlockId: number): GradientDef[];
|
|
7
7
|
private static getGradientItems;
|
|
8
8
|
private static calculateOpacityItem;
|
|
9
9
|
private static getGradientItemColor;
|
|
@@ -4,33 +4,34 @@ export class TwoDimensionalModelHelper {
|
|
|
4
4
|
static shouldMarkerShow(chart, dataRows, valueFieldName, currentRow, keyFieldName) {
|
|
5
5
|
if (chart.markers.show || dataRows.length === 1)
|
|
6
6
|
return true;
|
|
7
|
-
const rowIndex = dataRows.findIndex(row => row[keyFieldName] === currentRow[keyFieldName]);
|
|
7
|
+
const rowIndex = dataRows.findIndex((row) => row[keyFieldName] === currentRow[keyFieldName]);
|
|
8
8
|
if (rowIndex === -1)
|
|
9
9
|
return false;
|
|
10
10
|
const isFirst = rowIndex === 0;
|
|
11
11
|
const isLast = rowIndex === dataRows.length - 1;
|
|
12
12
|
const previousRow = dataRows[rowIndex - 1];
|
|
13
13
|
const nextRow = dataRows[rowIndex + 1];
|
|
14
|
-
const hasNullNeighborsRows = !isFirst && !isLast &&
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const hasNullNeighborsRows = !isFirst && !isLast && (previousRow === null || previousRow === void 0 ? void 0 : previousRow[valueFieldName]) === null && (nextRow === null || nextRow === void 0 ? void 0 : nextRow[valueFieldName]) === null;
|
|
15
|
+
return ((isFirst && (nextRow === null || nextRow === void 0 ? void 0 : nextRow[valueFieldName]) === null) ||
|
|
16
|
+
(isLast && (previousRow === null || previousRow === void 0 ? void 0 : previousRow[valueFieldName]) === null) ||
|
|
17
|
+
hasNullNeighborsRows);
|
|
17
18
|
}
|
|
18
|
-
static getGradientDefs(charts, keyAxisOrient, chartOrient) {
|
|
19
|
+
static getGradientDefs(charts, keyAxisOrient, chartOrient, chartBlockId) {
|
|
19
20
|
let gradients = [];
|
|
20
21
|
charts.forEach((chart) => {
|
|
21
22
|
var _a;
|
|
22
|
-
if (chart.type ===
|
|
23
|
+
if (chart.type === "area" && chart.areaViewOptions.fill.type === "gradient") {
|
|
23
24
|
(_a = chart.style.elementColors) === null || _a === void 0 ? void 0 : _a.forEach((elementColor, subIndex) => {
|
|
24
|
-
const gradientId = getGradientId(chart.index, subIndex);
|
|
25
|
+
const gradientId = getGradientId(chart.index, subIndex, chartBlockId);
|
|
25
26
|
gradients.push({
|
|
26
27
|
id: gradientId,
|
|
27
28
|
position: {
|
|
28
29
|
x1: 0,
|
|
29
30
|
y1: 0,
|
|
30
|
-
x2: chartOrient ===
|
|
31
|
-
y2: chartOrient ===
|
|
31
|
+
x2: chartOrient === "horizontal" ? 1 : 0,
|
|
32
|
+
y2: chartOrient === "horizontal" ? 0 : 1
|
|
32
33
|
},
|
|
33
|
-
items: this.getGradientItems(gradientId, elementColor, keyAxisOrient)
|
|
34
|
+
items: this.getGradientItems(gradientId, elementColor, keyAxisOrient)
|
|
34
35
|
});
|
|
35
36
|
});
|
|
36
37
|
}
|
|
@@ -38,7 +39,7 @@ export class TwoDimensionalModelHelper {
|
|
|
38
39
|
return gradients;
|
|
39
40
|
}
|
|
40
41
|
static getGradientItems(gradientId, elementColor, keyAxisOrient) {
|
|
41
|
-
return [0, 1].map(itemIndex => ({
|
|
42
|
+
return [0, 1].map((itemIndex) => ({
|
|
42
43
|
id: gradientId + `-item-${itemIndex}`,
|
|
43
44
|
color: this.getGradientItemColor(itemIndex, keyAxisOrient, elementColor),
|
|
44
45
|
offset: itemIndex,
|
|
@@ -48,16 +49,15 @@ export class TwoDimensionalModelHelper {
|
|
|
48
49
|
static calculateOpacityItem(itemIndex, orientation) {
|
|
49
50
|
const maxOpacity = 0.3;
|
|
50
51
|
const minOpacity = 0;
|
|
51
|
-
if (orientation ===
|
|
52
|
+
if (orientation === "bottom" || orientation === "right")
|
|
52
53
|
return itemIndex === 0 ? maxOpacity : minOpacity;
|
|
53
54
|
else
|
|
54
55
|
return itemIndex === 0 ? minOpacity : maxOpacity;
|
|
55
56
|
}
|
|
56
|
-
;
|
|
57
57
|
static getGradientItemColor(itemIndex, orientation, elementColor) {
|
|
58
58
|
const maxColor = elementColor;
|
|
59
59
|
const minColor = "white";
|
|
60
|
-
if (orientation ===
|
|
60
|
+
if (orientation === "bottom" || orientation === "right")
|
|
61
61
|
return itemIndex === 0 ? maxColor : minColor;
|
|
62
62
|
else
|
|
63
63
|
return itemIndex === 0 ? minColor : maxColor;
|
|
@@ -68,36 +68,36 @@ export class TwoDimensionalModelHelper {
|
|
|
68
68
|
const chartBlockConfig = {
|
|
69
69
|
vertical: {
|
|
70
70
|
left: {
|
|
71
|
-
mode:
|
|
71
|
+
mode: "shift",
|
|
72
72
|
hasCollision: blockSidesOptions.hasCollisionLeft,
|
|
73
73
|
shiftCoordinate: blockSidesOptions.shiftRight
|
|
74
74
|
},
|
|
75
75
|
right: {
|
|
76
|
-
mode:
|
|
76
|
+
mode: "shift",
|
|
77
77
|
hasCollision: blockSidesOptions.hasCollisionRight,
|
|
78
78
|
shiftCoordinate: blockSidesOptions.shiftLeft
|
|
79
79
|
},
|
|
80
80
|
top: {
|
|
81
|
-
mode:
|
|
81
|
+
mode: "none"
|
|
82
82
|
},
|
|
83
83
|
bottom: {
|
|
84
|
-
mode:
|
|
84
|
+
mode: "none"
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
horizontal: {
|
|
88
88
|
left: {
|
|
89
|
-
mode:
|
|
89
|
+
mode: "none"
|
|
90
90
|
},
|
|
91
91
|
right: {
|
|
92
|
-
mode:
|
|
92
|
+
mode: "none"
|
|
93
93
|
},
|
|
94
94
|
top: {
|
|
95
|
-
mode:
|
|
95
|
+
mode: "shift",
|
|
96
96
|
hasCollision: blockSidesOptions.hasCollisionTop,
|
|
97
97
|
shiftCoordinate: blockSidesOptions.shiftBottom
|
|
98
98
|
},
|
|
99
99
|
bottom: {
|
|
100
|
-
mode:
|
|
100
|
+
mode: "shift",
|
|
101
101
|
hasCollision: blockSidesOptions.hasCollisionBottom,
|
|
102
102
|
shiftCoordinate: blockSidesOptions.shiftTop
|
|
103
103
|
}
|
|
@@ -106,7 +106,7 @@ export class TwoDimensionalModelHelper {
|
|
|
106
106
|
return {
|
|
107
107
|
collision: {
|
|
108
108
|
otherValueLables: (_b = (_a = valueLabels === null || valueLabels === void 0 ? void 0 : valueLabels.collision) === null || _a === void 0 ? void 0 : _a.otherValueLabels) !== null && _b !== void 0 ? _b : {
|
|
109
|
-
mode:
|
|
109
|
+
mode: "none"
|
|
110
110
|
},
|
|
111
111
|
chartBlock: chartBlockConfig[chartOrientation]
|
|
112
112
|
},
|
|
@@ -11,7 +11,7 @@ export class MarginModel {
|
|
|
11
11
|
const canvasModel = modelInstance.canvasModel;
|
|
12
12
|
canvasModel.initMargin(Object.assign({}, this.designerConfig.canvas.chartBlockMargin));
|
|
13
13
|
this.recalcMarginByTitle(canvasModel);
|
|
14
|
-
if (this.config.options.type ===
|
|
14
|
+
if (this.config.options.type === "2d") {
|
|
15
15
|
this.twoDimModel.recalcMargin(otherComponents, modelInstance);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { AxisModel } from "../../featuresModel/axisModel";
|
|
1
|
+
import { AxisModel, LABEL_ELEMENT_HEIGHT_PX } from "../../featuresModel/axisModel";
|
|
2
2
|
import { TwoDimLegendModel } from "../../featuresModel/legendModel/twoDimLegendModel";
|
|
3
3
|
import { keyAxisLabelHorizontalLog, keyAxisLabelVerticalLog } from "../../featuresModel/scaleModel/scaleAxisRecalcer";
|
|
4
4
|
import { AxisType } from "../../modelBuilder";
|
|
5
5
|
import { TwoDimensionalModel } from "../../notations/twoDimensionalModel";
|
|
6
6
|
import { OFFSET_SIZE_PX } from "../../featuresModel/valueLabelsModel/valueLabelsModel";
|
|
7
|
+
import { ScaleModel } from "../../featuresModel/scaleModel/scaleModel";
|
|
8
|
+
import { Scale } from "../../../engine/features/scale/scale";
|
|
7
9
|
export const AXIS_HORIZONTAL_LABEL_PADDING = 12;
|
|
8
10
|
export const AXIS_VERTICAL_LABEL_PADDING = 8;
|
|
9
11
|
export class TwoDimMarginModel {
|
|
@@ -15,12 +17,12 @@ export class TwoDimMarginModel {
|
|
|
15
17
|
recalcMargin(otherComponents, modelInstance) {
|
|
16
18
|
const canvasModel = modelInstance.canvasModel;
|
|
17
19
|
this.twoDimLegendModel.recalcMarginWith2DLegend(modelInstance, otherComponents.legendBlock, this.configReader.options.legend);
|
|
20
|
+
this.recalcVerticalMarginByAxisLabelHeight(LABEL_ELEMENT_HEIGHT_PX, canvasModel);
|
|
18
21
|
const labelSize = this.getMaxLabelSize(modelInstance);
|
|
19
|
-
this.recalcVerticalMarginByAxisLabelHeight(labelSize, canvasModel);
|
|
20
22
|
// Если встроенный лейбл показывает ключи, то лейблы оси ключей не показываются
|
|
21
23
|
// При этом все графики должны иметь: embeddedLabels = 'key'
|
|
22
|
-
// И все графики должны быть типа bar.
|
|
23
|
-
const showingFlag = this.configReader.options.type ===
|
|
24
|
+
// И все графики должны быть типа bar.
|
|
25
|
+
const showingFlag = this.configReader.options.type === "2d"
|
|
24
26
|
? !TwoDimensionalModel.getChartsEmbeddedLabelsFlag(this.configReader.options.charts, this.configReader.options.orientation)
|
|
25
27
|
: true;
|
|
26
28
|
this.recalcHorizontalMarginByAxisLabelWidth(labelSize, canvasModel, showingFlag);
|
|
@@ -28,17 +30,19 @@ export class TwoDimMarginModel {
|
|
|
28
30
|
const secondaryLabelSize = this.getMaxLabelSizeSecondary(modelInstance);
|
|
29
31
|
this.recalcMarginBySecondaryAxisLabelSize(secondaryLabelSize, canvasModel);
|
|
30
32
|
}
|
|
31
|
-
if (this.configReader.areValueLabelsOn() &&
|
|
33
|
+
if (this.configReader.areValueLabelsOn() &&
|
|
34
|
+
this.configReader.areValueLabelsNeedIncreaseMargin() &&
|
|
35
|
+
this.configReader.options.orientation === "vertical") {
|
|
32
36
|
this.recalcVerticalMarginWithValueLabelsOn(canvasModel);
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
39
|
recalcMarginByVerticalAxisLabel(modelInstance) {
|
|
36
|
-
if (this.configReader.options.orientation ===
|
|
40
|
+
if (this.configReader.options.orientation === "vertical") {
|
|
37
41
|
const dataModel = modelInstance.dataModel;
|
|
38
42
|
const axisLabelSize = AxisModel.getLabelSize(this.designerConfig.canvas.axisLabel.maxSize.main, dataModel.getAllowableKeys());
|
|
39
43
|
const axisConfig = AxisModel.getKeyAxisLabelPosition(modelInstance.canvasModel, dataModel.getAllowableKeys().length, this.configReader.options.axis.key);
|
|
40
|
-
const marginOrient = this.configReader.options.axis.key.position ===
|
|
41
|
-
if (axisConfig ===
|
|
44
|
+
const marginOrient = this.configReader.options.axis.key.position === "end" ? "bottom" : "top";
|
|
45
|
+
if (axisConfig === "rotated") {
|
|
42
46
|
modelInstance.canvasModel.decreaseMarginSide(marginOrient, axisLabelSize.height);
|
|
43
47
|
modelInstance.canvasModel.increaseMarginSide(marginOrient, axisLabelSize.width, keyAxisLabelVerticalLog);
|
|
44
48
|
}
|
|
@@ -47,44 +51,38 @@ export class TwoDimMarginModel {
|
|
|
47
51
|
getMaxLabelSize(modelInstance) {
|
|
48
52
|
const keyAxisOrient = AxisModel.getAxisOrient(AxisType.Key, this.configReader.options.orientation, this.configReader.options.axis.key.position);
|
|
49
53
|
let labelsTexts;
|
|
50
|
-
if (keyAxisOrient ===
|
|
54
|
+
if (keyAxisOrient === "left" || keyAxisOrient === "right") {
|
|
51
55
|
labelsTexts = modelInstance.dataModel.repository.getValuesByKeyField();
|
|
52
56
|
}
|
|
53
57
|
else {
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
const scaleModel = new ScaleModel(this.configReader.options, modelInstance.canvasModel).getScaleLinear(modelInstance.dataModel.repository.getRawRows(), this.configReader);
|
|
59
|
+
labelsTexts = this.getValueAxisLabels(scaleModel, modelInstance).map((v) => this.configReader.getAxisLabelFormatter()(v).toString());
|
|
56
60
|
}
|
|
57
61
|
return AxisModel.getLabelSize(this.designerConfig.canvas.axisLabel.maxSize.main, labelsTexts);
|
|
58
62
|
}
|
|
59
63
|
getMaxLabelSizeSecondary(modelInstance) {
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
if (keyAxisOrient === 'left' || keyAxisOrient === 'right') {
|
|
63
|
-
labelsTexts = modelInstance.dataModel.repository.getValuesByKeyField();
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
labelsTexts = this.configReader.getBiggestValueAndDecrementedSecondary(modelInstance.dataModel.repository)
|
|
67
|
-
.map(v => this.configReader.getSecondaryAxisLabelFormatter()(v).toString());
|
|
68
|
-
}
|
|
64
|
+
const scaleModel = new ScaleModel(this.configReader.options, modelInstance.canvasModel).getScaleSecondaryLinear(modelInstance.dataModel.repository.getRawRows(), this.configReader);
|
|
65
|
+
const labelsTexts = this.getValueAxisLabels(scaleModel, modelInstance).map((v) => this.configReader.getSecondaryAxisLabelFormatter()(v).toString());
|
|
69
66
|
return AxisModel.getLabelSize(this.designerConfig.canvas.axisLabel.maxSize.main, labelsTexts);
|
|
70
67
|
}
|
|
71
|
-
recalcVerticalMarginByAxisLabelHeight(
|
|
68
|
+
recalcVerticalMarginByAxisLabelHeight(labelHeight, canvasModel) {
|
|
72
69
|
const keyAxisOrient = AxisModel.getAxisOrient(AxisType.Key, this.configReader.options.orientation, this.configReader.options.axis.key.position);
|
|
73
70
|
const valueAxisOrient = AxisModel.getAxisOrient(AxisType.Value, this.configReader.options.orientation, this.configReader.options.axis.value.position);
|
|
74
|
-
if ((keyAxisOrient ===
|
|
75
|
-
|
|
76
|
-
canvasModel.increaseMarginSide(keyAxisOrient, labelSize.height + AXIS_HORIZONTAL_LABEL_PADDING, keyAxisLabelVerticalLog);
|
|
77
|
-
}
|
|
71
|
+
if ((keyAxisOrient === "bottom" || keyAxisOrient === "top") && this.configReader.options.axis.key.visibility)
|
|
72
|
+
canvasModel.increaseMarginSide(keyAxisOrient, labelHeight + AXIS_HORIZONTAL_LABEL_PADDING, keyAxisLabelVerticalLog);
|
|
78
73
|
else if (this.configReader.options.axis.value.visibility)
|
|
79
|
-
canvasModel.increaseMarginSide(valueAxisOrient,
|
|
74
|
+
canvasModel.increaseMarginSide(valueAxisOrient, labelHeight + AXIS_HORIZONTAL_LABEL_PADDING);
|
|
80
75
|
}
|
|
81
76
|
recalcHorizontalMarginByAxisLabelWidth(labelSize, canvasModel, isShow) {
|
|
82
77
|
const keyAxisOrient = AxisModel.getAxisOrient(AxisType.Key, this.configReader.options.orientation, this.configReader.options.axis.key.position);
|
|
83
78
|
const valueAxisOrient = AxisModel.getAxisOrient(AxisType.Value, this.configReader.options.orientation, this.configReader.options.axis.value.position);
|
|
84
|
-
if ((keyAxisOrient ===
|
|
79
|
+
if ((keyAxisOrient === "left" || keyAxisOrient === "right") &&
|
|
80
|
+
isShow &&
|
|
81
|
+
this.configReader.options.axis.key.visibility) {
|
|
85
82
|
canvasModel.increaseMarginSide(keyAxisOrient, labelSize.width + AXIS_VERTICAL_LABEL_PADDING, keyAxisLabelHorizontalLog);
|
|
86
83
|
}
|
|
87
|
-
else if ((valueAxisOrient ===
|
|
84
|
+
else if ((valueAxisOrient === "left" || valueAxisOrient === "right") &&
|
|
85
|
+
this.configReader.options.axis.value.visibility) {
|
|
88
86
|
canvasModel.increaseMarginSide(valueAxisOrient, labelSize.width + AXIS_VERTICAL_LABEL_PADDING);
|
|
89
87
|
}
|
|
90
88
|
}
|
|
@@ -114,4 +112,16 @@ export class TwoDimMarginModel {
|
|
|
114
112
|
};
|
|
115
113
|
canvasModel.increaseMarginSide(axisMarginMapping[keyAxisOrient], valueLabelFontSize + OFFSET_SIZE_PX);
|
|
116
114
|
}
|
|
115
|
+
getValueAxisLabels(scaleModel, modelInstance) {
|
|
116
|
+
const scale = Scale.getScaleValue(scaleModel);
|
|
117
|
+
const ticksPolicy = AxisModel.getTickAmountPolicy(this.configReader.options.orientation, this.configReader.options.axis.value, scaleModel);
|
|
118
|
+
let outputValues;
|
|
119
|
+
if (ticksPolicy.type === "constant")
|
|
120
|
+
outputValues = ticksPolicy.values;
|
|
121
|
+
else if (ticksPolicy.type === "amount")
|
|
122
|
+
outputValues = scale.ticks(ticksPolicy.amount);
|
|
123
|
+
else
|
|
124
|
+
outputValues = this.configReader.getBiggestValueAndDecremented(modelInstance.dataModel.repository);
|
|
125
|
+
return outputValues;
|
|
126
|
+
}
|
|
117
127
|
}
|
package/lib/model/model.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { BoundingRect } from "../engine/features/valueLabelsCollision/valueLabel
|
|
|
4
4
|
declare type AxisType = "key" | "value";
|
|
5
5
|
export declare type Orient = "top" | "bottom" | "left" | "right";
|
|
6
6
|
export declare type ScaleKeyType = "band" | "point";
|
|
7
|
-
export declare type ScaleValueType = "linear"
|
|
7
|
+
export declare type ScaleValueType = "linear";
|
|
8
8
|
export declare type LegendPosition = "off" | "top" | "bottom" | "left" | "right";
|
|
9
9
|
export declare type EmbeddedLabelTypeModel = "none" | "key" | "value";
|
|
10
10
|
export declare type DataOptions = {
|
|
@@ -162,7 +162,20 @@ export interface AxisLabelModel {
|
|
|
162
162
|
defaultTooltip: boolean;
|
|
163
163
|
showTick: ShowTickFn;
|
|
164
164
|
linearTickStep: number;
|
|
165
|
+
tickAmountSettings: TickAmountModel;
|
|
165
166
|
}
|
|
167
|
+
interface TickAmountModel {
|
|
168
|
+
policy: TickAmountPolicy;
|
|
169
|
+
}
|
|
170
|
+
export declare type TickAmountPolicy = {
|
|
171
|
+
type: "auto";
|
|
172
|
+
} | {
|
|
173
|
+
type: "amount";
|
|
174
|
+
amount: number;
|
|
175
|
+
} | {
|
|
176
|
+
type: "constant";
|
|
177
|
+
values: number[];
|
|
178
|
+
};
|
|
166
179
|
export interface AdditionalElementsOptions {
|
|
167
180
|
gridLine: GridLineOptions;
|
|
168
181
|
}
|
|
@@ -298,7 +311,7 @@ export interface TwoDimensionalChartLegendBarModel {
|
|
|
298
311
|
borderRadius: BarBorderRadius;
|
|
299
312
|
width: number;
|
|
300
313
|
}
|
|
301
|
-
export interface TwoDimensionalChartLegendLineModel extends Omit<TwoDimensionalLineLikeChartViewModel,
|
|
314
|
+
export interface TwoDimensionalChartLegendLineModel extends Omit<TwoDimensionalLineLikeChartViewModel, "renderForKey"> {
|
|
302
315
|
length: number;
|
|
303
316
|
}
|
|
304
317
|
interface TwoDimensionalLineLikeChartModel {
|
|
@@ -387,9 +400,9 @@ export interface MarkersOptions {
|
|
|
387
400
|
show: MarkersOptionsShow;
|
|
388
401
|
styles: MarkersStyleOptions;
|
|
389
402
|
}
|
|
390
|
-
export declare type MarkDotDatumItem = MdtChartsDataRow | {
|
|
403
|
+
export declare type MarkDotDatumItem = MdtChartsDataRow | ({
|
|
391
404
|
"1": any;
|
|
392
|
-
} & Array<number
|
|
405
|
+
} & Array<number>);
|
|
393
406
|
export declare type MarkersOptionsShow = (options: {
|
|
394
407
|
row: MarkDotDatumItem;
|
|
395
408
|
valueFieldName: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MdtChartsConfig, MdtChartsDataSource } from
|
|
2
|
-
import { Model } from
|
|
3
|
-
import { DesignerConfig } from
|
|
1
|
+
import { MdtChartsConfig, MdtChartsDataSource } from "../config/config";
|
|
2
|
+
import { Model } from "./model";
|
|
3
|
+
import { DesignerConfig } from "../designer/designerConfig";
|
|
4
4
|
export declare enum AxisType {
|
|
5
5
|
Key = 0,
|
|
6
6
|
Value = 1
|
|
@@ -23,5 +23,5 @@ export declare const styledElementValues: {
|
|
|
23
23
|
inlineDynamicItemWrapperMarginRightPx: number;
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
export declare function assembleModel(config: MdtChartsConfig, data: MdtChartsDataSource, designerConfig: DesignerConfig): Model;
|
|
26
|
+
export declare function assembleModel(config: MdtChartsConfig, data: MdtChartsDataSource, designerConfig: DesignerConfig, chartBlockVersion: number): Model;
|
|
27
27
|
export declare function getPreparedData(model: Model, data: MdtChartsDataSource, config: MdtChartsConfig): MdtChartsDataSource;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { MarginModel } from
|
|
2
|
-
import { TwoDimensionalModel } from
|
|
3
|
-
import { PolarModel } from
|
|
4
|
-
import { DataManagerModel } from
|
|
5
|
-
import { OtherComponentsModel } from
|
|
6
|
-
import { ConfigValidator } from
|
|
7
|
-
import { ModelInstance } from
|
|
8
|
-
import { TwoDimConfigReader } from
|
|
1
|
+
import { MarginModel } from "./margin/marginModel";
|
|
2
|
+
import { TwoDimensionalModel } from "./notations/twoDimensionalModel";
|
|
3
|
+
import { PolarModel } from "./notations/polar/polarModel";
|
|
4
|
+
import { DataManagerModel } from "./dataManagerModel/dataManagerModel";
|
|
5
|
+
import { OtherComponentsModel } from "./featuresModel/otherComponents";
|
|
6
|
+
import { ConfigValidator } from "./configsValidator/configValidator";
|
|
7
|
+
import { ModelInstance } from "./modelInstance/modelInstance";
|
|
8
|
+
import { TwoDimConfigReader } from "./modelInstance/configReader";
|
|
9
9
|
import { TitleConfigReader } from "./modelInstance/titleConfigReader";
|
|
10
10
|
export var AxisType;
|
|
11
11
|
(function (AxisType) {
|
|
@@ -13,10 +13,10 @@ export var AxisType;
|
|
|
13
13
|
AxisType[AxisType["Value"] = 1] = "Value";
|
|
14
14
|
})(AxisType || (AxisType = {}));
|
|
15
15
|
export const CLASSES = {
|
|
16
|
-
dataLabel:
|
|
17
|
-
legendLabel:
|
|
18
|
-
legendColor:
|
|
19
|
-
legendItem:
|
|
16
|
+
dataLabel: "data-label",
|
|
17
|
+
legendLabel: "legend-label",
|
|
18
|
+
legendColor: "legend-circle",
|
|
19
|
+
legendItem: "legend-item"
|
|
20
20
|
};
|
|
21
21
|
export const styledElementValues = {
|
|
22
22
|
defaultLegendMarkerSizes: {
|
|
@@ -32,7 +32,8 @@ export const styledElementValues = {
|
|
|
32
32
|
};
|
|
33
33
|
function getBlockCanvas(config, modelInstance) {
|
|
34
34
|
const emptyBlockParams = { width: 0, height: 0 };
|
|
35
|
-
const size = ConfigValidator.validateCanvasSize(modelInstance.canvasModel.getBlockSize())
|
|
35
|
+
const size = ConfigValidator.validateCanvasSize(modelInstance.canvasModel.getBlockSize())
|
|
36
|
+
? Object.assign({}, modelInstance.canvasModel.getBlockSize()) : emptyBlockParams;
|
|
36
37
|
return {
|
|
37
38
|
size,
|
|
38
39
|
cssClass: config.canvas.class
|
|
@@ -45,10 +46,10 @@ function getChartBlockModel(modelInstance) {
|
|
|
45
46
|
}
|
|
46
47
|
function getOptions(config, designerConfig, modelInstance) {
|
|
47
48
|
//TODO: migrate to polymorphism
|
|
48
|
-
if (config.options.type ===
|
|
49
|
+
if (config.options.type === "2d") {
|
|
49
50
|
return TwoDimensionalModel.getOptions(new TwoDimConfigReader(config, designerConfig), designerConfig, modelInstance);
|
|
50
51
|
}
|
|
51
|
-
else if (config.options.type ===
|
|
52
|
+
else if (config.options.type === "polar") {
|
|
52
53
|
return PolarModel.getOptions(config.options, designerConfig, modelInstance);
|
|
53
54
|
}
|
|
54
55
|
}
|
|
@@ -66,8 +67,8 @@ function getDataFormat(designerConfig) {
|
|
|
66
67
|
function getTransitions(designerConfig) {
|
|
67
68
|
return designerConfig.transitions;
|
|
68
69
|
}
|
|
69
|
-
export function assembleModel(config, data, designerConfig) {
|
|
70
|
-
const modelInstance = ModelInstance.create(config, data, designerConfig);
|
|
70
|
+
export function assembleModel(config, data, designerConfig, chartBlockVersion) {
|
|
71
|
+
const modelInstance = ModelInstance.create(config, data, designerConfig, chartBlockVersion);
|
|
71
72
|
if (!data || Object.keys(data).length === 0)
|
|
72
73
|
return {
|
|
73
74
|
blockCanvas: getBlockCanvas(config, modelInstance),
|
|
@@ -84,7 +85,7 @@ export function assembleModel(config, data, designerConfig) {
|
|
|
84
85
|
const marginModel = new MarginModel(designerConfig, config);
|
|
85
86
|
marginModel.initMargin(otherComponents, modelInstance);
|
|
86
87
|
DataManagerModel.initDataScope(config, data, designerConfig, otherComponents.legendBlock, modelInstance);
|
|
87
|
-
if (config.options.type ===
|
|
88
|
+
if (config.options.type === "2d" && config.options.axis.key.visibility)
|
|
88
89
|
marginModel.recalcMarginByVerticalAxisLabel(modelInstance);
|
|
89
90
|
const blockCanvas = getBlockCanvas(config, modelInstance);
|
|
90
91
|
const chartBlock = getChartBlockModel(modelInstance);
|