@visactor/vchart-extension 2.1.0-alpha.22 → 2.1.0-alpha.24
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/build/index.js +258 -159
- package/build/index.min.js +2 -2
- package/cjs/charts/axis-3d/index.js +2 -1
- package/cjs/charts/bar-3d/chart-spec-transformer.js +1 -1
- package/cjs/charts/bar-3d/chart.js +1 -1
- package/cjs/charts/bar-3d/constant.js +1 -2
- package/cjs/charts/bar-3d/index.js +1 -1
- package/cjs/charts/bar-3d/interface.js +1 -1
- package/cjs/charts/bar-3d/series-spec-transformer.js +1 -1
- package/cjs/charts/bar-3d/series.js +1 -1
- package/cjs/charts/bar-3d/theme.js +1 -1
- package/cjs/charts/candlestick/candlestick-transformer.js +1 -1
- package/cjs/charts/candlestick/candlestick.js +1 -1
- package/cjs/charts/candlestick/index.js +1 -1
- package/cjs/charts/candlestick/interface.js +1 -1
- package/cjs/charts/candlestick/util.js +1 -1
- package/cjs/charts/combination-candlestick/combination-candlestick-transformer.js +1 -1
- package/cjs/charts/combination-candlestick/combination-candlestick.js +1 -1
- package/cjs/charts/combination-candlestick/constant.js +1 -1
- package/cjs/charts/combination-candlestick/index.js +1 -1
- package/cjs/charts/combination-candlestick/interface.js +1 -1
- package/cjs/charts/conversion-funnel/arrow-data-transform.js +1 -1
- package/cjs/charts/conversion-funnel/constants.js +1 -1
- package/cjs/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
- package/cjs/charts/conversion-funnel/conversion-funnel.js +1 -1
- package/cjs/charts/conversion-funnel/index.js +1 -1
- package/cjs/charts/conversion-funnel/interface.js +1 -2
- package/cjs/charts/conversion-funnel/util.js +1 -1
- package/cjs/charts/funnel-3d/chart.js +1 -1
- package/cjs/charts/funnel-3d/constant.js +1 -1
- package/cjs/charts/funnel-3d/index.js +1 -1
- package/cjs/charts/funnel-3d/interface.js +1 -1
- package/cjs/charts/funnel-3d/series-spec-transformer.js +1 -1
- package/cjs/charts/funnel-3d/series.js +1 -2
- package/cjs/charts/funnel-3d/theme.js +1 -1
- package/cjs/charts/pictogram/element-highlight-by-graphic-name.js +1 -1
- package/cjs/charts/storyline/layouts/arc.js +104 -51
- package/cjs/charts/storyline/layouts/arc.js.map +1 -1
- package/cjs/charts/storyline/layouts/clock.js +17 -9
- package/cjs/charts/storyline/layouts/clock.js.map +1 -1
- package/cjs/charts/storyline/layouts/common.d.ts +4 -15
- package/cjs/charts/storyline/layouts/common.js +18 -20
- package/cjs/charts/storyline/layouts/common.js.map +1 -1
- package/cjs/charts/storyline/layouts/default.js +15 -8
- package/cjs/charts/storyline/layouts/default.js.map +1 -1
- package/cjs/charts/storyline/layouts/ladder.js +16 -9
- package/cjs/charts/storyline/layouts/ladder.js.map +1 -1
- package/cjs/charts/storyline/layouts/landscape.js +47 -29
- package/cjs/charts/storyline/layouts/landscape.js.map +1 -1
- package/cjs/charts/storyline/layouts/portrait.d.ts +1 -1
- package/cjs/charts/storyline/layouts/portrait.js +22 -16
- package/cjs/charts/storyline/layouts/portrait.js.map +1 -1
- package/cjs/charts/storyline/layouts/wing.js +16 -8
- package/cjs/charts/storyline/layouts/wing.js.map +1 -1
- package/cjs/charts/storyline/storyline-transformer.js +1 -1
- package/cjs/charts/storyline/storyline-transformer.js.map +1 -1
- package/cjs/components/bar-link/bar-link.js +1 -1
- package/cjs/components/bar-link/constant.js +1 -1
- package/cjs/components/bar-link/index.js +1 -1
- package/cjs/components/bar-link/type.js +1 -1
- package/cjs/components/bar-link/util.js +1 -1
- package/cjs/components/bar-regression-line/index.js +1 -1
- package/cjs/components/bar-regression-line/type.js +1 -1
- package/cjs/components/extension-mark-sync-state/extension-mark-sync-state.js +1 -1
- package/cjs/components/extension-mark-sync-state/index.js +1 -1
- package/cjs/components/extension-mark-sync-state/type.js +1 -1
- package/cjs/components/histogram-regression-line/index.js +1 -1
- package/cjs/components/histogram-regression-line/type.js +2 -1
- package/cjs/components/map-label/index.js +1 -1
- package/cjs/components/map-label/layout.js +1 -1
- package/cjs/components/map-label/map-label-transformer.js +1 -1
- package/cjs/components/map-label/map-label.js +1 -1
- package/cjs/components/map-label/theme.js +1 -1
- package/cjs/components/map-label/type.js +1 -1
- package/cjs/components/regression-line/index.js +1 -1
- package/cjs/components/regression-line/regression-line.js +1 -1
- package/cjs/components/regression-line/type.js +1 -1
- package/cjs/components/scatter-regression-line/index.js +1 -1
- package/cjs/components/scatter-regression-line/type.js +1 -1
- package/cjs/components/series-break/constant.js +1 -1
- package/cjs/components/series-break/index.js +1 -1
- package/cjs/components/series-break/series-break.js +1 -1
- package/cjs/components/series-break/type.js +1 -1
- package/cjs/components/series-break/util.js +2 -1
- package/cjs/components/series-label/constant.js +1 -1
- package/cjs/components/series-label/index.js +1 -1
- package/cjs/components/series-label/series-label.js +1 -1
- package/cjs/components/series-label/type.js +1 -1
- package/cjs/components/series-label/util.js +1 -1
- package/esm/charts/axis-3d/index.js +2 -1
- package/esm/charts/bar-3d/chart-spec-transformer.js +1 -1
- package/esm/charts/bar-3d/chart.js +1 -1
- package/esm/charts/bar-3d/constant.js +1 -2
- package/esm/charts/bar-3d/index.js +1 -1
- package/esm/charts/bar-3d/interface.js +1 -1
- package/esm/charts/bar-3d/series-spec-transformer.js +1 -1
- package/esm/charts/bar-3d/series.js +1 -1
- package/esm/charts/bar-3d/theme.js +1 -1
- package/esm/charts/candlestick/candlestick-transformer.js +1 -1
- package/esm/charts/candlestick/candlestick.js +1 -1
- package/esm/charts/candlestick/index.js +1 -1
- package/esm/charts/candlestick/interface.js +1 -1
- package/esm/charts/candlestick/util.js +1 -1
- package/esm/charts/combination-candlestick/combination-candlestick-transformer.js +1 -1
- package/esm/charts/combination-candlestick/combination-candlestick.js +1 -1
- package/esm/charts/combination-candlestick/constant.js +1 -1
- package/esm/charts/combination-candlestick/index.js +1 -1
- package/esm/charts/combination-candlestick/interface.js +1 -1
- package/esm/charts/conversion-funnel/arrow-data-transform.js +1 -1
- package/esm/charts/conversion-funnel/constants.js +1 -1
- package/esm/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
- package/esm/charts/conversion-funnel/conversion-funnel.js +1 -1
- package/esm/charts/conversion-funnel/index.js +1 -1
- package/esm/charts/conversion-funnel/interface.js +1 -2
- package/esm/charts/conversion-funnel/util.js +1 -1
- package/esm/charts/funnel-3d/chart.js +1 -1
- package/esm/charts/funnel-3d/constant.js +1 -1
- package/esm/charts/funnel-3d/index.js +1 -1
- package/esm/charts/funnel-3d/interface.js +1 -1
- package/esm/charts/funnel-3d/series-spec-transformer.js +1 -1
- package/esm/charts/funnel-3d/series.js +1 -2
- package/esm/charts/funnel-3d/theme.js +1 -1
- package/esm/charts/pictogram/element-highlight-by-graphic-name.js +1 -1
- package/esm/charts/storyline/layouts/arc.js +101 -50
- package/esm/charts/storyline/layouts/arc.js.map +1 -1
- package/esm/charts/storyline/layouts/clock.js +18 -10
- package/esm/charts/storyline/layouts/clock.js.map +1 -1
- package/esm/charts/storyline/layouts/common.d.ts +4 -15
- package/esm/charts/storyline/layouts/common.js +12 -17
- package/esm/charts/storyline/layouts/common.js.map +1 -1
- package/esm/charts/storyline/layouts/default.js +15 -9
- package/esm/charts/storyline/layouts/default.js.map +1 -1
- package/esm/charts/storyline/layouts/ladder.js +16 -10
- package/esm/charts/storyline/layouts/ladder.js.map +1 -1
- package/esm/charts/storyline/layouts/landscape.js +46 -30
- package/esm/charts/storyline/layouts/landscape.js.map +1 -1
- package/esm/charts/storyline/layouts/portrait.d.ts +1 -1
- package/esm/charts/storyline/layouts/portrait.js +21 -16
- package/esm/charts/storyline/layouts/portrait.js.map +1 -1
- package/esm/charts/storyline/layouts/wing.js +16 -9
- package/esm/charts/storyline/layouts/wing.js.map +1 -1
- package/esm/charts/storyline/storyline-transformer.js +1 -1
- package/esm/charts/storyline/storyline-transformer.js.map +1 -1
- package/esm/components/bar-link/bar-link.js +1 -1
- package/esm/components/bar-link/constant.js +1 -1
- package/esm/components/bar-link/index.js +1 -1
- package/esm/components/bar-link/type.js +1 -1
- package/esm/components/bar-link/util.js +1 -1
- package/esm/components/bar-regression-line/index.js +1 -1
- package/esm/components/bar-regression-line/type.js +1 -1
- package/esm/components/extension-mark-sync-state/extension-mark-sync-state.js +1 -1
- package/esm/components/extension-mark-sync-state/index.js +1 -1
- package/esm/components/extension-mark-sync-state/type.js +1 -1
- package/esm/components/histogram-regression-line/index.js +1 -1
- package/esm/components/histogram-regression-line/type.js +2 -1
- package/esm/components/map-label/index.js +1 -1
- package/esm/components/map-label/layout.js +1 -1
- package/esm/components/map-label/map-label-transformer.js +1 -1
- package/esm/components/map-label/map-label.js +1 -1
- package/esm/components/map-label/theme.js +1 -1
- package/esm/components/map-label/type.js +1 -1
- package/esm/components/regression-line/index.js +1 -1
- package/esm/components/regression-line/regression-line.js +1 -1
- package/esm/components/regression-line/type.js +1 -1
- package/esm/components/scatter-regression-line/index.js +1 -1
- package/esm/components/scatter-regression-line/type.js +1 -1
- package/esm/components/series-break/constant.js +1 -1
- package/esm/components/series-break/index.js +1 -1
- package/esm/components/series-break/series-break.js +1 -1
- package/esm/components/series-break/type.js +1 -1
- package/esm/components/series-break/util.js +2 -1
- package/esm/components/series-label/constant.js +1 -1
- package/esm/components/series-label/index.js +1 -1
- package/esm/components/series-label/series-label.js +1 -1
- package/esm/components/series-label/type.js +1 -1
- package/esm/components/series-label/util.js +1 -1
- package/package.json +2 -2
|
@@ -10,4 +10,5 @@ const layout_1 = require("../3d/layout"), plugin_1 = require("../3d/plugin"), ba
|
|
|
10
10
|
(0, symlog_axis_1.registerCartesianSymlogAxis3d)(), (0, log_axis_1.registerCartesianLogAxis3d)();
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
exports.registerAxis3dPlugin = registerAxis3dPlugin;
|
|
13
|
+
exports.registerAxis3dPlugin = registerAxis3dPlugin;
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -20,4 +20,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
20
20
|
}), __exportStar(require("./chart"), exports), __exportStar(require("./chart-spec-transformer"), exports),
|
|
21
21
|
__exportStar(require("./interface"), exports), __exportStar(require("./series"), exports),
|
|
22
22
|
__exportStar(require("./series-spec-transformer"), exports);
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -21,4 +21,4 @@ class CandlestickChartSpecTransformer extends vchart_1.CartesianChartSpecTransfo
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
exports.CandlestickChartSpecTransformer = CandlestickChartSpecTransformer;
|
|
24
|
-
//# sourceMappingURL=candlestick-transformer.js.map
|
|
24
|
+
//# sourceMappingURL=candlestick-transformer.js.map
|
|
@@ -20,4 +20,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
20
20
|
}), __exportStar(require("./candlestick"), exports), __exportStar(require("./interface"), exports),
|
|
21
21
|
__exportStar(require("./candlestick-transformer"), exports), __exportStar(require("./series/candlestick"), exports),
|
|
22
22
|
__exportStar(require("./util"), exports);
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -7,4 +7,4 @@ function transformCandlestickSeriesSpec(spec) {
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: !0
|
|
9
9
|
}), exports.transformCandlestickSeriesSpec = void 0, exports.transformCandlestickSeriesSpec = transformCandlestickSeriesSpec;
|
|
10
|
-
//# sourceMappingURL=util.js.map
|
|
10
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -201,4 +201,4 @@ class CombinationCandlestickChartSpecTransformer extends vchart_1.CartesianChart
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
exports.CombinationCandlestickChartSpecTransformer = CombinationCandlestickChartSpecTransformer;
|
|
204
|
-
//# sourceMappingURL=combination-candlestick-transformer.js.map
|
|
204
|
+
//# sourceMappingURL=combination-candlestick-transformer.js.map
|
|
@@ -19,4 +19,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
19
19
|
value: !0
|
|
20
20
|
}), __exportStar(require("./combination-candlestick"), exports), __exportStar(require("./interface"), exports),
|
|
21
21
|
__exportStar(require("./constant"), exports);
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -193,5 +193,5 @@ function addFunnelBackgroundMark(funnelBackground) {
|
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
exports.ConversionFunnelChartSpecTransformer = ConversionFunnelChartSpecTransformer;
|
|
197
196
|
//# sourceMappingURL=conversion-funnel-transformer.js.map
|
|
197
|
+
exports.ConversionFunnelChartSpecTransformer = ConversionFunnelChartSpecTransformer;
|
|
@@ -18,4 +18,4 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
20
|
}), __exportStar(require("./interface"), exports), __exportStar(require("./conversion-funnel"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -19,4 +19,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
19
19
|
value: !0
|
|
20
20
|
}), __exportStar(require("./chart"), exports), __exportStar(require("./series"), exports),
|
|
21
21
|
__exportStar(require("./series-spec-transformer"), exports), __exportStar(require("./interface"), exports);
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -13,4 +13,4 @@ class Funnel3dSeriesSpecTransformer extends vchart_1.FunnelSeriesSpecTransformer
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
exports.Funnel3dSeriesSpecTransformer = Funnel3dSeriesSpecTransformer;
|
|
16
|
-
//# sourceMappingURL=series-spec-transformer.js.map
|
|
16
|
+
//# sourceMappingURL=series-spec-transformer.js.map
|
|
@@ -79,5 +79,4 @@ const registerFunnel3dSeries = () => {
|
|
|
79
79
|
vchart_1.registerRuleMark)(), vchart_1.Factory.registerSeries(Funnel3dSeries.type, Funnel3dSeries);
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
-
exports.registerFunnel3dSeries = registerFunnel3dSeries;
|
|
83
|
-
//# sourceMappingURL=series.js.map
|
|
82
|
+
exports.registerFunnel3dSeries = registerFunnel3dSeries;
|
|
@@ -50,4 +50,4 @@ const registerElementHighlightByGraphicName = () => {
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
exports.registerElementHighlightByGraphicName = registerElementHighlightByGraphicName;
|
|
53
|
-
//# sourceMappingURL=element-highlight-by-graphic-name.js.map
|
|
53
|
+
//# sourceMappingURL=element-highlight-by-graphic-name.js.map
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.buildArcBlockMark = exports.buildArcTitleImageMark = exports.buildArcMark = void 0;
|
|
6
6
|
|
|
7
|
-
const vchart_1 = require("@visactor/vchart"), common_1 = require("./common"), ARC_BLOCK_IMAGE_SIZE = 240, ARC_BLOCK_IMAGE_BORDER = 3, ARC_BLOCK_IMAGE_HALO_PADDING = 6, ARC_TEXT_GAP_FROM_IMAGE = 10, ARC_TITLE_FONT_SIZE = 32, ARC_TITLE_LINE_HEIGHT = 34, ARC_CONTENT_LINE_HEIGHT =
|
|
7
|
+
const vchart_1 = require("@visactor/vchart"), common_1 = require("./common"), ARC_BLOCK_IMAGE_SIZE = 240, ARC_BLOCK_IMAGE_BORDER = 3, ARC_BLOCK_IMAGE_HALO_PADDING = 6, ARC_TEXT_GAP_FROM_IMAGE = 10, ARC_TITLE_FONT_SIZE = 32, ARC_TITLE_LINE_HEIGHT = 34, ARC_CONTENT_LINE_HEIGHT = 24, ARC_CONTENT_FONT_SIZE = 18, ARC_TEXT_BOX_HEIGHT = 240, ARC_TITLE_TO_CONTENT_GAP = 4, ARC_TEXT_PADDING = 20, ARC_TEXT_BOX_MIN_WIDTH = 96, ARC_TEXT_BOX_ABSOLUTE_MIN_WIDTH = 64, ARC_TEXT_BOX_MAX_WIDTH = 260, ARC_TITLE_IMAGE_WIDTH_RATIO = .68, ARC_TITLE_IMAGE_MAX_WIDTH = 900, ARC_TITLE_IMAGE_HEIGHT_RATIO = .34, ARC_GAP_FROM_TITLE_IMAGE = 200, ARC_FIT_MARGIN = 8, clamp = (value, min, max) => Math.max(min, Math.min(max, value)), isDownArc = spec => "down" === (0,
|
|
8
8
|
common_1.normalizeLayout)(spec.layout).direction, getArcTitleImageRect = (spec, ctx) => {
|
|
9
9
|
var _a, _b, _c, _e;
|
|
10
10
|
const {width: width, height: height, startX: startX, startY: startY} = (0, common_1.getRegionGeometry)(ctx), innerWidth = Math.max(width, 1), innerHeight = Math.max(height, 1), baseWidth = Math.min(.68 * innerWidth, 900), w = Math.max(null !== (_b = null === (_a = spec.titleImage) || void 0 === _a ? void 0 : _a.width) && void 0 !== _b ? _b : baseWidth, 80), h = Math.max(null !== (_e = null === (_c = spec.titleImage) || void 0 === _c ? void 0 : _c.height) && void 0 !== _e ? _e : .34 * w, 40);
|
|
@@ -14,7 +14,7 @@ common_1.normalizeLayout)(spec.layout).direction, getArcTitleImageRect = (spec,
|
|
|
14
14
|
width: w,
|
|
15
15
|
height: h
|
|
16
16
|
};
|
|
17
|
-
},
|
|
17
|
+
}, getBaseArcGeometry = (spec, ctx) => {
|
|
18
18
|
var _a, _b, _c;
|
|
19
19
|
const {width: width, startX: startX} = (0, common_1.getRegionGeometry)(ctx), innerWidth = Math.max(width, 1), blockWidth = (0,
|
|
20
20
|
common_1.resolveBlockWidth)(spec, width), layoutOpt = (0, common_1.normalizeLayout)(spec.layout), isDown = "down" === layoutOpt.direction, startAngle = null !== (_a = layoutOpt.startAngle) && void 0 !== _a ? _a : isDown ? 20 : 200, endAngle = null !== (_b = layoutOpt.endAngle) && void 0 !== _b ? _b : isDown ? 160 : 340, ratio = null !== (_c = layoutOpt.radiusRatio) && void 0 !== _c ? _c : .88, rx = Math.max((innerWidth - blockWidth) / 2, 1) * ratio, titleImageRect = getArcTitleImageRect(spec, ctx), centerTop = titleImageRect.y, centerBottom = titleImageRect.y + titleImageRect.height, sinStart = Math.sin(startAngle / 180 * Math.PI);
|
|
@@ -36,19 +36,59 @@ common_1.normalizeLayout)(spec.layout).direction, getArcTitleImageRect = (spec,
|
|
|
36
36
|
centerTop: centerTop,
|
|
37
37
|
centerBottom: centerBottom
|
|
38
38
|
};
|
|
39
|
-
},
|
|
40
|
-
var _a, _b
|
|
41
|
-
const
|
|
39
|
+
}, getArcBlockCenterByGeometry = (spec, arc, index, ctx) => {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
const count = null !== (_b = null === (_a = spec.data) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0;
|
|
42
42
|
if (count <= 0) return {
|
|
43
43
|
x: arc.cx,
|
|
44
44
|
y: arc.cy
|
|
45
45
|
};
|
|
46
|
-
const t = 1 === count ? .5 : index / (count - 1), angle = (arc.startAngle + (arc.endAngle - arc.startAngle) * t) / 180 * Math.PI, px = arc.cx + Math.cos(angle) * arc.rx, py = arc.cy + Math.sin(angle) * arc.ry, nxRaw = Math.cos(angle) / arc.rx, nyRaw = Math.sin(angle) / arc.ry, nLen = Math.hypot(nxRaw, nyRaw) || 1, nx = nxRaw / nLen, ny = nyRaw / nLen, offset = (
|
|
46
|
+
const t = 1 === count ? .5 : index / (count - 1), angle = (arc.startAngle + (arc.endAngle - arc.startAngle) * t) / 180 * Math.PI, px = arc.cx + Math.cos(angle) * arc.rx, py = arc.cy + Math.sin(angle) * arc.ry, nxRaw = Math.cos(angle) / arc.rx, nyRaw = Math.sin(angle) / arc.ry, nLen = Math.hypot(nxRaw, nyRaw) || 1, nx = nxRaw / nLen, ny = nyRaw / nLen, offset = getArcBlockMetrics(spec, index, ctx).imageBox.height / 2;
|
|
47
47
|
return {
|
|
48
48
|
x: px + nx * offset,
|
|
49
49
|
y: py + ny * offset
|
|
50
50
|
};
|
|
51
|
-
},
|
|
51
|
+
}, getArcBlockBounds = (spec, arc, index, ctx) => {
|
|
52
|
+
const center = getArcBlockCenterByGeometry(spec, arc, index, ctx), metrics = getArcBlockMetrics(spec, index, ctx), halo = (0,
|
|
53
|
+
common_1.shouldShowImageBackground)(spec) ? 9 : 0, minX = Math.min(metrics.imageBox.x - halo, metrics.textBox.x, metrics.contentBox.x), maxX = Math.max(metrics.imageBox.x + metrics.imageBox.width + halo, metrics.textBox.x + metrics.textBox.width, metrics.contentBox.x + metrics.contentBox.width), minY = Math.min(metrics.imageBox.y - halo, metrics.textBox.y, metrics.contentBox.y), maxY = Math.max(metrics.imageBox.y + metrics.imageBox.height + halo, metrics.textBox.y + metrics.textBox.height, metrics.contentBox.y + metrics.contentBox.height);
|
|
54
|
+
return {
|
|
55
|
+
left: center.x + minX,
|
|
56
|
+
right: center.x + maxX,
|
|
57
|
+
top: center.y + minY,
|
|
58
|
+
bottom: center.y + maxY
|
|
59
|
+
};
|
|
60
|
+
}, getArcBlocksBounds = (spec, arc, ctx) => {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
const count = null !== (_b = null === (_a = spec.data) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0;
|
|
63
|
+
return count ? Array.from({
|
|
64
|
+
length: count
|
|
65
|
+
}, ((_, index) => getArcBlockBounds(spec, arc, index, ctx))).reduce(((bounds, blockBounds) => ({
|
|
66
|
+
left: Math.min(bounds.left, blockBounds.left),
|
|
67
|
+
right: Math.max(bounds.right, blockBounds.right),
|
|
68
|
+
top: Math.min(bounds.top, blockBounds.top),
|
|
69
|
+
bottom: Math.max(bounds.bottom, blockBounds.bottom)
|
|
70
|
+
})), {
|
|
71
|
+
left: Number.POSITIVE_INFINITY,
|
|
72
|
+
right: Number.NEGATIVE_INFINITY,
|
|
73
|
+
top: Number.POSITIVE_INFINITY,
|
|
74
|
+
bottom: Number.NEGATIVE_INFINITY
|
|
75
|
+
}) : {
|
|
76
|
+
left: arc.cx,
|
|
77
|
+
right: arc.cx,
|
|
78
|
+
top: arc.cy,
|
|
79
|
+
bottom: arc.cy
|
|
80
|
+
};
|
|
81
|
+
}, getArcGeometry = (spec, ctx) => {
|
|
82
|
+
const arc = getBaseArcGeometry(spec, ctx), region = (0, common_1.getRegionGeometry)(ctx), bounds = getArcBlocksBounds(spec, arc, ctx), fit_left = region.startX + 8, fit_right = region.startX + region.width - 8, fit_top = region.startY + 8, fit_bottom = region.startY + region.height - 8;
|
|
83
|
+
let shiftX = 0, shiftY = 0;
|
|
84
|
+
const boundsWidth = bounds.right - bounds.left, boundsHeight = bounds.bottom - bounds.top, fitHeight = fit_bottom - fit_top;
|
|
85
|
+
return boundsWidth > fit_right - fit_left ? shiftX = (fit_left + fit_right - bounds.left - bounds.right) / 2 : bounds.left < fit_left ? shiftX = fit_left - bounds.left : bounds.right > fit_right && (shiftX = fit_right - bounds.right),
|
|
86
|
+
boundsHeight > fitHeight ? shiftY = (fit_top + fit_bottom - bounds.top - bounds.bottom) / 2 : bounds.top < fit_top ? shiftY = fit_top - bounds.top : bounds.bottom > fit_bottom && (shiftY = fit_bottom - bounds.bottom),
|
|
87
|
+
shiftX || shiftY ? Object.assign(Object.assign({}, arc), {
|
|
88
|
+
cx: arc.cx + shiftX,
|
|
89
|
+
cy: arc.cy + shiftY
|
|
90
|
+
}) : arc;
|
|
91
|
+
}, getArcBlockCenter = (spec, ctx, index) => getArcBlockCenterByGeometry(spec, getArcGeometry(spec, ctx), index, ctx), buildArcMark = spec => {
|
|
52
92
|
var _a;
|
|
53
93
|
if (!0 !== (null === (_a = spec.line) || void 0 === _a ? void 0 : _a.visible)) return null;
|
|
54
94
|
const themeColor = (0, common_1.getThemeColor)(spec);
|
|
@@ -109,20 +149,21 @@ const buildArcTitleImageMark = spec => {
|
|
|
109
149
|
|
|
110
150
|
exports.buildArcTitleImageMark = buildArcTitleImageMark;
|
|
111
151
|
|
|
112
|
-
const getArcBlockMetrics = (spec, index = 0) => {
|
|
113
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
114
|
-
const
|
|
115
|
-
common_1.resolveTitleFontSize)(spec,
|
|
116
|
-
common_1.resolveAdaptiveLineHeight)(titleFontSize, null === (_u = spec.title) || void 0 === _u ? void 0 : _u.style, 34),
|
|
152
|
+
const getArcBlockMetrics = (spec, index = 0, ctx) => {
|
|
153
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
154
|
+
const region = ctx ? (0, common_1.getRegionGeometry)(ctx, spec) : void 0, count = Math.max(null !== (_b = null === (_a = spec.data) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0, 1), regionWidth = Math.max(null !== (_c = null == region ? void 0 : region.width) && void 0 !== _c ? _c : Number(null !== (_e = spec.width) && void 0 !== _e ? _e : 240 * count), 1), regionHeight = Math.max(null !== (_f = null == region ? void 0 : region.height) && void 0 !== _f ? _f : Number(null !== (_g = spec.height) && void 0 !== _g ? _g : 240), 1), slotWidth = regionWidth / (count + 1), imageScale = clamp(Math.min(regionWidth / Math.max(240 * count * .92, 1), regionHeight / 620), .42, 1), textScale = clamp(Math.min(slotWidth / 180, imageScale), .48, 1), styleContent = null === (_h = spec.content) || void 0 === _h ? void 0 : _h.style, contentFontSize = Number(null !== (_j = null == styleContent ? void 0 : styleContent.fontSize) && void 0 !== _j ? _j : Math.round(18 * textScale)), contentLineHeight = Number(null !== (_k = null == styleContent ? void 0 : styleContent.lineHeight) && void 0 !== _k ? _k : Math.round(Math.max(1.35 * contentFontSize, 24 * textScale))), configuredImageDiameter = Math.max(null !== (_m = null === (_l = spec.image) || void 0 === _l ? void 0 : _l.width) && void 0 !== _m ? _m : 240, null !== (_p = null === (_o = spec.image) || void 0 === _o ? void 0 : _o.height) && void 0 !== _p ? _p : 240), imageDiameter = Math.round(clamp(configuredImageDiameter * imageScale, 64, configuredImageDiameter)), imageWidth = imageDiameter, imageHeight = imageDiameter, isDown = isDownArc(spec), configuredTextWidth = Number(null !== (_r = null === (_q = spec.block) || void 0 === _q ? void 0 : _q.width) && void 0 !== _r ? _r : 260), defaultTextWidth = Math.round(.96 * slotWidth), minTextWidth = Math.min(96, Math.max(Math.round(.72 * slotWidth), 64)), textBoxWidth = Math.round(clamp(Math.min(configuredTextWidth, defaultTextWidth), minTextWidth, 260)), titleFontSize = (0,
|
|
155
|
+
common_1.resolveTitleFontSize)(spec, ctx, null === (_t = null === (_s = spec.data) || void 0 === _s ? void 0 : _s[index]) || void 0 === _t ? void 0 : _t.title, textBoxWidth, Math.round(32 * textScale), [ 10, 40 ]), titleLineHeight = (0,
|
|
156
|
+
common_1.resolveAdaptiveLineHeight)(titleFontSize, null === (_u = spec.title) || void 0 === _u ? void 0 : _u.style, 34), titleHeight = (0,
|
|
157
|
+
common_1.getBlockTitleHeight)(titleLineHeight, null === (_w = null === (_v = spec.data) || void 0 === _v ? void 0 : _v[index]) || void 0 === _w ? void 0 : _w.title, textBoxWidth, titleFontSize), textHeight = Math.round(clamp(240 * textScale, 88, 240)), contentHeight = Math.max(textHeight - titleHeight - 4, contentLineHeight), isLeftSide = index < count / 2, textAlign = isLeftSide ? "right" : "left", imageBox = {
|
|
117
158
|
x: -imageWidth / 2,
|
|
118
159
|
y: -imageHeight / 2,
|
|
119
160
|
width: imageWidth,
|
|
120
161
|
height: imageHeight
|
|
121
|
-
}, textBox = {
|
|
122
|
-
x: isLeftSide ? -
|
|
123
|
-
y: isDown ? imageBox.y + imageHeight + 10 : imageBox.y - 10 -
|
|
162
|
+
}, textPadding = Math.round(20 * textScale), textBox = {
|
|
163
|
+
x: isLeftSide ? -textPadding - textBoxWidth : textPadding,
|
|
164
|
+
y: isDown ? imageBox.y + imageHeight + 10 : imageBox.y - 10 - textHeight,
|
|
124
165
|
width: textBoxWidth,
|
|
125
|
-
height:
|
|
166
|
+
height: textHeight
|
|
126
167
|
};
|
|
127
168
|
return {
|
|
128
169
|
titleFontSize: titleFontSize,
|
|
@@ -133,17 +174,26 @@ const getArcBlockMetrics = (spec, index = 0) => {
|
|
|
133
174
|
textBox: textBox,
|
|
134
175
|
contentBox: {
|
|
135
176
|
x: textBox.x,
|
|
136
|
-
y: textBox.y +
|
|
177
|
+
y: textBox.y + titleHeight + 4,
|
|
137
178
|
width: textBox.width,
|
|
138
179
|
height: contentHeight
|
|
139
180
|
},
|
|
140
181
|
isDown: isDown,
|
|
141
|
-
textAlign:
|
|
182
|
+
textAlign: textAlign,
|
|
183
|
+
textAnchorX: isLeftSide ? -textPadding : textPadding
|
|
142
184
|
};
|
|
143
185
|
}, buildArcBlockMark = (spec, block, index) => {
|
|
144
186
|
var _a, _b, _c, _e;
|
|
145
187
|
const hasImage = !!block.image, contentText = Array.isArray(block.content) ? block.content : block.content ? [ block.content ] : [], themeColor = (0,
|
|
146
|
-
common_1.getThemeColor)(spec),
|
|
188
|
+
common_1.getThemeColor)(spec), getMetrics = ctx => getArcBlockMetrics(spec, index, ctx), getConnectorBox = ctx => {
|
|
189
|
+
const metrics = getMetrics(ctx);
|
|
190
|
+
return {
|
|
191
|
+
x: -1,
|
|
192
|
+
y: metrics.isDown ? metrics.imageBox.y + metrics.imageBox.height : metrics.textBox.y,
|
|
193
|
+
width: 2,
|
|
194
|
+
height: metrics.isDown ? Math.max(metrics.textBox.y + metrics.textBox.height - (metrics.imageBox.y + metrics.imageBox.height), 0) : Math.max(metrics.imageBox.y - metrics.textBox.y, 0)
|
|
195
|
+
};
|
|
196
|
+
};
|
|
147
197
|
return {
|
|
148
198
|
type: "group",
|
|
149
199
|
id: `storyline-block-${null !== (_a = block.id) && void 0 !== _a ? _a : index}`,
|
|
@@ -159,10 +209,10 @@ const getArcBlockMetrics = (spec, index = 0) => {
|
|
|
159
209
|
interactive: !1,
|
|
160
210
|
zIndex: vchart_1.LayoutZIndex.Mark + 2,
|
|
161
211
|
style: {
|
|
162
|
-
x:
|
|
163
|
-
y:
|
|
164
|
-
width:
|
|
165
|
-
height:
|
|
212
|
+
x: (_d, ctx) => getConnectorBox(ctx).x,
|
|
213
|
+
y: (_d, ctx) => getConnectorBox(ctx).y,
|
|
214
|
+
width: (_d, ctx) => getConnectorBox(ctx).width,
|
|
215
|
+
height: (_d, ctx) => getConnectorBox(ctx).height,
|
|
166
216
|
fill: themeColor,
|
|
167
217
|
fillOpacity: .6
|
|
168
218
|
}
|
|
@@ -173,11 +223,11 @@ const getArcBlockMetrics = (spec, index = 0) => {
|
|
|
173
223
|
zIndex: vchart_1.LayoutZIndex.Mark + 3
|
|
174
224
|
}, (0, common_1.omitImageLayoutSpec)(spec.image)), {
|
|
175
225
|
style: Object.assign({
|
|
176
|
-
x:
|
|
177
|
-
y:
|
|
178
|
-
width:
|
|
179
|
-
height:
|
|
180
|
-
cornerRadius: Math.min(
|
|
226
|
+
x: (_d, ctx) => getMetrics(ctx).imageBox.x,
|
|
227
|
+
y: (_d, ctx) => getMetrics(ctx).imageBox.y,
|
|
228
|
+
width: (_d, ctx) => getMetrics(ctx).imageBox.width,
|
|
229
|
+
height: (_d, ctx) => getMetrics(ctx).imageBox.height,
|
|
230
|
+
cornerRadius: (_d, ctx) => Math.min(getMetrics(ctx).imageBox.width, getMetrics(ctx).imageBox.height) / 2,
|
|
181
231
|
image: block.image,
|
|
182
232
|
repeatX: "no-repeat",
|
|
183
233
|
repeatY: "no-repeat",
|
|
@@ -192,7 +242,7 @@ const getArcBlockMetrics = (spec, index = 0) => {
|
|
|
192
242
|
style: Object.assign({
|
|
193
243
|
x: 0,
|
|
194
244
|
y: 0,
|
|
195
|
-
size: Math.min(
|
|
245
|
+
size: (_d, ctx) => Math.min(getMetrics(ctx).imageBox.width, getMetrics(ctx).imageBox.height),
|
|
196
246
|
symbolType: "circle"
|
|
197
247
|
}, (0, common_1.getImageBackgroundStyle)(spec))
|
|
198
248
|
}, (0, common_1.shouldShowImageBackground)(spec) ? {
|
|
@@ -203,7 +253,7 @@ const getArcBlockMetrics = (spec, index = 0) => {
|
|
|
203
253
|
style: {
|
|
204
254
|
x: 0,
|
|
205
255
|
y: 0,
|
|
206
|
-
size: Math.min(
|
|
256
|
+
size: (_d, ctx) => Math.min(getMetrics(ctx).imageBox.width, getMetrics(ctx).imageBox.height) + 12,
|
|
207
257
|
symbolType: "circle",
|
|
208
258
|
fill: "transparent",
|
|
209
259
|
stroke: (0, common_1.withAlpha)(themeColor, .82),
|
|
@@ -216,19 +266,25 @@ const getArcBlockMetrics = (spec, index = 0) => {
|
|
|
216
266
|
zIndex: vchart_1.LayoutZIndex.Mark + 5
|
|
217
267
|
}, spec.title), {
|
|
218
268
|
style: Object.assign({
|
|
219
|
-
x:
|
|
220
|
-
y:
|
|
269
|
+
x: (_d, ctx) => getMetrics(ctx).textAnchorX,
|
|
270
|
+
y: (_d, ctx) => getMetrics(ctx).textBox.y,
|
|
221
271
|
text: block.title,
|
|
222
|
-
maxLineWidth:
|
|
223
|
-
|
|
224
|
-
|
|
272
|
+
maxLineWidth: (_d, ctx) => getMetrics(ctx).textBox.width,
|
|
273
|
+
height: (_d, ctx) => getMetrics(ctx).titleLineHeight * common_1.BLOCK_TITLE_MAX_LINES,
|
|
274
|
+
heightLimit: (_d, ctx) => getMetrics(ctx).titleLineHeight * common_1.BLOCK_TITLE_MAX_LINES,
|
|
275
|
+
lineClamp: common_1.BLOCK_TITLE_MAX_LINES,
|
|
276
|
+
fontSize: (_d, ctx) => getMetrics(ctx).titleFontSize,
|
|
277
|
+
lineHeight: (_d, ctx) => getMetrics(ctx).titleLineHeight,
|
|
225
278
|
fontWeight: "bold",
|
|
226
279
|
fill: "#1f2430",
|
|
227
280
|
stroke: "#fff",
|
|
228
281
|
lineWidth: 5,
|
|
229
282
|
lineJoin: "round",
|
|
230
|
-
textAlign:
|
|
231
|
-
textBaseline: "top"
|
|
283
|
+
textAlign: (_d, ctx) => getMetrics(ctx).textAlign,
|
|
284
|
+
textBaseline: "top",
|
|
285
|
+
whiteSpace: "normal",
|
|
286
|
+
wordBreak: "break-word",
|
|
287
|
+
ellipsis: "..."
|
|
232
288
|
}, null === (_c = spec.title) || void 0 === _c ? void 0 : _c.style)
|
|
233
289
|
}) : null, contentText.length ? Object.assign(Object.assign({
|
|
234
290
|
type: "text",
|
|
@@ -236,22 +292,19 @@ const getArcBlockMetrics = (spec, index = 0) => {
|
|
|
236
292
|
interactive: !1,
|
|
237
293
|
zIndex: vchart_1.LayoutZIndex.Mark + 4
|
|
238
294
|
}, spec.content), {
|
|
239
|
-
textType: "rich",
|
|
240
295
|
style: Object.assign({
|
|
241
|
-
x:
|
|
242
|
-
y:
|
|
243
|
-
width:
|
|
244
|
-
height:
|
|
245
|
-
maxLineWidth:
|
|
246
|
-
heightLimit:
|
|
247
|
-
text: (0, common_1.
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
align: metrics.textAlign
|
|
252
|
-
}),
|
|
253
|
-
textAlign: metrics.textAlign,
|
|
296
|
+
x: (_d, ctx) => getMetrics(ctx).textAnchorX,
|
|
297
|
+
y: (_d, ctx) => getMetrics(ctx).contentBox.y,
|
|
298
|
+
width: (_d, ctx) => getMetrics(ctx).contentBox.width,
|
|
299
|
+
height: (_d, ctx) => getMetrics(ctx).contentBox.height,
|
|
300
|
+
maxLineWidth: (_d, ctx) => getMetrics(ctx).contentBox.width,
|
|
301
|
+
heightLimit: (_d, ctx) => getMetrics(ctx).contentBox.height,
|
|
302
|
+
text: (0, common_1.buildPlainContent)(contentText),
|
|
303
|
+
fontSize: (_d, ctx) => getMetrics(ctx).contentFontSize,
|
|
304
|
+
lineHeight: (_d, ctx) => getMetrics(ctx).contentLineHeight,
|
|
305
|
+
textAlign: (_d, ctx) => getMetrics(ctx).textAlign,
|
|
254
306
|
textBaseline: "top",
|
|
307
|
+
whiteSpace: "normal",
|
|
255
308
|
wordBreak: "break-word",
|
|
256
309
|
ellipsis: "...",
|
|
257
310
|
fill: "#596173"
|