@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
|
@@ -149,4 +149,4 @@ function appendSeriesLabelConfig(rawSpec, seriesLabelSpec) {
|
|
|
149
149
|
|
|
150
150
|
exports.dodge = dodge, exports.dodgeHorizontal = dodgeHorizontal, exports.getSeriesLabelConfig = getSeriesLabelConfig,
|
|
151
151
|
exports.appendSeriesLabelConfig = appendSeriesLabelConfig;
|
|
152
|
-
//# sourceMappingURL=util.js.map
|
|
152
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -15,4 +15,5 @@ import { registerCartesianTimeAxis3d } from "./time-axis";
|
|
|
15
15
|
export const registerAxis3dPlugin = () => {
|
|
16
16
|
register3DPlugin(), registerLayout3d(), registerCartesianBandAxis3d(), registerCartesianLinearAxis3d(),
|
|
17
17
|
registerCartesianTimeAxis3d(), registerCartesianSymlogAxis3d(), registerCartesianLogAxis3d();
|
|
18
|
-
};
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -22,4 +22,4 @@ Bar3dChart.type = "bar3d", Bar3dChart.seriesType = SeriesType3dEnum.bar3d, Bar3d
|
|
|
22
22
|
export const registerBar3dChart = () => {
|
|
23
23
|
register3DPlugin(), registerLayout3d(), registerBar3dSeries(), Factory.registerChart(Bar3dChart.type, Bar3dChart);
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=chart.js.map
|
|
25
|
+
//# sourceMappingURL=chart.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { };
|
|
2
|
-
//# sourceMappingURL=interface.js.map
|
|
2
|
+
//# sourceMappingURL=interface.js.map
|
|
@@ -27,4 +27,4 @@ export const registerBar3dSeries = () => {
|
|
|
27
27
|
registerBar3dAnimation(), registerRect3dMark(), registerCartesianBandAxis(), registerCartesianLinearAxis(),
|
|
28
28
|
Factory.registerSeries(Bar3dSeries.type, Bar3dSeries);
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=series.js.map
|
|
30
|
+
//# sourceMappingURL=series.js.map
|
|
@@ -20,4 +20,4 @@ export const registerCandlestickChart = () => {
|
|
|
20
20
|
registerDimensionTooltipProcessor(), registerMarkTooltipProcessor(), registerDimensionEvents(),
|
|
21
21
|
registerDimensionHover(), registerCandlestickSeries(), Factory.registerChart(CandlestickChart.type, CandlestickChart);
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=candlestick.js.map
|
|
23
|
+
//# sourceMappingURL=candlestick.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { };
|
|
2
|
-
//# sourceMappingURL=interface.js.map
|
|
2
|
+
//# sourceMappingURL=interface.js.map
|
|
@@ -26,4 +26,4 @@ mixin(CombinationCandlestickChart, StackChartMixin);
|
|
|
26
26
|
export const registerCombinationCandlestickChart = () => {
|
|
27
27
|
registerCandlestickSeries(), Factory.registerChart(CombinationCandlestickChart.type, CombinationCandlestickChart);
|
|
28
28
|
};
|
|
29
|
-
//# sourceMappingURL=combination-candlestick.js.map
|
|
29
|
+
//# sourceMappingURL=combination-candlestick.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const CombinationCandlestickChart_TYPE = "combinationCandlestick";
|
|
2
|
-
//# sourceMappingURL=constant.js.map
|
|
2
|
+
//# sourceMappingURL=constant.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { };
|
|
2
|
-
//# sourceMappingURL=interface.js.map
|
|
2
|
+
//# sourceMappingURL=interface.js.map
|
|
@@ -54,4 +54,4 @@ export const registerConversionFunnelChart = option => {
|
|
|
54
54
|
const vchartConstructor = (null == option ? void 0 : option.VChart) || VChart;
|
|
55
55
|
vchartConstructor && (vchartConstructor.useChart([ ConversionFunnelChart ]), vchartConstructor.useSeries([ ConversionFunnelSeries ]));
|
|
56
56
|
};
|
|
57
|
-
//# sourceMappingURL=conversion-funnel.js.map
|
|
57
|
+
//# sourceMappingURL=conversion-funnel.js.map
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { };
|
|
2
|
-
//# sourceMappingURL=interface.js.map
|
|
1
|
+
export { };
|
|
@@ -22,4 +22,4 @@ export const registerFunnel3dChart = () => {
|
|
|
22
22
|
registerMarkTooltipProcessor(), register3DPlugin(), registerLayout3d(), registerFunnel3dSeries(),
|
|
23
23
|
Factory.registerChart(Funnel3dChart.type, Funnel3dChart);
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=chart.js.map
|
|
25
|
+
//# sourceMappingURL=chart.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { };
|
|
2
|
-
//# sourceMappingURL=interface.js.map
|
|
2
|
+
//# sourceMappingURL=interface.js.map
|
|
@@ -5,4 +5,4 @@ export class Funnel3dSeriesSpecTransformer extends FunnelSeriesSpecTransformer {
|
|
|
5
5
|
this._addMarkLabelSpec(spec, "funnel3d"), spec.isTransform && this._addMarkLabelSpec(spec, "transform3d", "transformLabel");
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
//# sourceMappingURL=series-spec-transformer.js.map
|
|
8
|
+
//# sourceMappingURL=series-spec-transformer.js.map
|
|
@@ -46,4 +46,4 @@ ElementHighlightByGraphicName.type = type;
|
|
|
46
46
|
export const registerElementHighlightByGraphicName = () => {
|
|
47
47
|
Factory.registerInteractionTrigger(ElementHighlightByGraphicName.type, ElementHighlightByGraphicName);
|
|
48
48
|
};
|
|
49
|
-
//# sourceMappingURL=element-highlight-by-graphic-name.js.map
|
|
49
|
+
//# sourceMappingURL=element-highlight-by-graphic-name.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LayoutZIndex } from "@visactor/vchart";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { BLOCK_TITLE_MAX_LINES, buildPlainContent, getBlockTitleHeight, getImageBackgroundStyle, getRegionGeometry, getThemeColor, normalizeLayout, omitImageLayoutSpec, resolveAdaptiveLineHeight, resolveBlockWidth, resolveTitleFontSize, shouldShowImageBackground, withAlpha } from "./common";
|
|
4
4
|
|
|
5
|
-
const 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 =
|
|
5
|
+
const 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" === normalizeLayout(spec.layout).direction, getArcTitleImageRect = (spec, ctx) => {
|
|
6
6
|
var _a, _b, _c, _e;
|
|
7
7
|
const {width: width, height: height, startX: startX, startY: startY} = 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);
|
|
8
8
|
return {
|
|
@@ -11,7 +11,7 @@ const ARC_BLOCK_IMAGE_SIZE = 240, ARC_BLOCK_IMAGE_BORDER = 3, ARC_BLOCK_IMAGE_HA
|
|
|
11
11
|
width: w,
|
|
12
12
|
height: h
|
|
13
13
|
};
|
|
14
|
-
},
|
|
14
|
+
}, getBaseArcGeometry = (spec, ctx) => {
|
|
15
15
|
var _a, _b, _c;
|
|
16
16
|
const {width: width, startX: startX} = getRegionGeometry(ctx), innerWidth = Math.max(width, 1), blockWidth = resolveBlockWidth(spec, width), layoutOpt = 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);
|
|
17
17
|
let cy, ry;
|
|
@@ -32,19 +32,58 @@ const ARC_BLOCK_IMAGE_SIZE = 240, ARC_BLOCK_IMAGE_BORDER = 3, ARC_BLOCK_IMAGE_HA
|
|
|
32
32
|
centerTop: centerTop,
|
|
33
33
|
centerBottom: centerBottom
|
|
34
34
|
};
|
|
35
|
-
},
|
|
36
|
-
var _a, _b
|
|
37
|
-
const
|
|
35
|
+
}, getArcBlockCenterByGeometry = (spec, arc, index, ctx) => {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
const count = null !== (_b = null === (_a = spec.data) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0;
|
|
38
38
|
if (count <= 0) return {
|
|
39
39
|
x: arc.cx,
|
|
40
40
|
y: arc.cy
|
|
41
41
|
};
|
|
42
|
-
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 = (
|
|
42
|
+
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;
|
|
43
43
|
return {
|
|
44
44
|
x: px + nx * offset,
|
|
45
45
|
y: py + ny * offset
|
|
46
46
|
};
|
|
47
|
-
}
|
|
47
|
+
}, getArcBlockBounds = (spec, arc, index, ctx) => {
|
|
48
|
+
const center = getArcBlockCenterByGeometry(spec, arc, index, ctx), metrics = getArcBlockMetrics(spec, index, ctx), halo = 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);
|
|
49
|
+
return {
|
|
50
|
+
left: center.x + minX,
|
|
51
|
+
right: center.x + maxX,
|
|
52
|
+
top: center.y + minY,
|
|
53
|
+
bottom: center.y + maxY
|
|
54
|
+
};
|
|
55
|
+
}, getArcBlocksBounds = (spec, arc, ctx) => {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
const count = null !== (_b = null === (_a = spec.data) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0;
|
|
58
|
+
return count ? Array.from({
|
|
59
|
+
length: count
|
|
60
|
+
}, ((_, index) => getArcBlockBounds(spec, arc, index, ctx))).reduce(((bounds, blockBounds) => ({
|
|
61
|
+
left: Math.min(bounds.left, blockBounds.left),
|
|
62
|
+
right: Math.max(bounds.right, blockBounds.right),
|
|
63
|
+
top: Math.min(bounds.top, blockBounds.top),
|
|
64
|
+
bottom: Math.max(bounds.bottom, blockBounds.bottom)
|
|
65
|
+
})), {
|
|
66
|
+
left: Number.POSITIVE_INFINITY,
|
|
67
|
+
right: Number.NEGATIVE_INFINITY,
|
|
68
|
+
top: Number.POSITIVE_INFINITY,
|
|
69
|
+
bottom: Number.NEGATIVE_INFINITY
|
|
70
|
+
}) : {
|
|
71
|
+
left: arc.cx,
|
|
72
|
+
right: arc.cx,
|
|
73
|
+
top: arc.cy,
|
|
74
|
+
bottom: arc.cy
|
|
75
|
+
};
|
|
76
|
+
}, getArcGeometry = (spec, ctx) => {
|
|
77
|
+
const arc = getBaseArcGeometry(spec, ctx), region = 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;
|
|
78
|
+
let shiftX = 0, shiftY = 0;
|
|
79
|
+
const boundsWidth = bounds.right - bounds.left, boundsHeight = bounds.bottom - bounds.top, fitHeight = fit_bottom - fit_top;
|
|
80
|
+
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),
|
|
81
|
+
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),
|
|
82
|
+
shiftX || shiftY ? Object.assign(Object.assign({}, arc), {
|
|
83
|
+
cx: arc.cx + shiftX,
|
|
84
|
+
cy: arc.cy + shiftY
|
|
85
|
+
}) : arc;
|
|
86
|
+
}, getArcBlockCenter = (spec, ctx, index) => getArcBlockCenterByGeometry(spec, getArcGeometry(spec, ctx), index, ctx);
|
|
48
87
|
|
|
49
88
|
export const buildArcMark = spec => {
|
|
50
89
|
var _a;
|
|
@@ -103,18 +142,18 @@ export const buildArcTitleImageMark = spec => {
|
|
|
103
142
|
} : null;
|
|
104
143
|
};
|
|
105
144
|
|
|
106
|
-
const getArcBlockMetrics = (spec, index = 0) => {
|
|
107
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
108
|
-
const
|
|
145
|
+
const getArcBlockMetrics = (spec, index = 0, ctx) => {
|
|
146
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
147
|
+
const region = ctx ? 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 = 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 = resolveAdaptiveLineHeight(titleFontSize, null === (_u = spec.title) || void 0 === _u ? void 0 : _u.style, 34), titleHeight = 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 = {
|
|
109
148
|
x: -imageWidth / 2,
|
|
110
149
|
y: -imageHeight / 2,
|
|
111
150
|
width: imageWidth,
|
|
112
151
|
height: imageHeight
|
|
113
|
-
}, textBox = {
|
|
114
|
-
x: isLeftSide ? -
|
|
115
|
-
y: isDown ? imageBox.y + imageHeight + 10 : imageBox.y - 10 -
|
|
152
|
+
}, textPadding = Math.round(20 * textScale), textBox = {
|
|
153
|
+
x: isLeftSide ? -textPadding - textBoxWidth : textPadding,
|
|
154
|
+
y: isDown ? imageBox.y + imageHeight + 10 : imageBox.y - 10 - textHeight,
|
|
116
155
|
width: textBoxWidth,
|
|
117
|
-
height:
|
|
156
|
+
height: textHeight
|
|
118
157
|
};
|
|
119
158
|
return {
|
|
120
159
|
titleFontSize: titleFontSize,
|
|
@@ -125,18 +164,27 @@ const getArcBlockMetrics = (spec, index = 0) => {
|
|
|
125
164
|
textBox: textBox,
|
|
126
165
|
contentBox: {
|
|
127
166
|
x: textBox.x,
|
|
128
|
-
y: textBox.y +
|
|
167
|
+
y: textBox.y + titleHeight + 4,
|
|
129
168
|
width: textBox.width,
|
|
130
169
|
height: contentHeight
|
|
131
170
|
},
|
|
132
171
|
isDown: isDown,
|
|
133
|
-
textAlign:
|
|
172
|
+
textAlign: textAlign,
|
|
173
|
+
textAnchorX: isLeftSide ? -textPadding : textPadding
|
|
134
174
|
};
|
|
135
175
|
};
|
|
136
176
|
|
|
137
177
|
export const buildArcBlockMark = (spec, block, index) => {
|
|
138
178
|
var _a, _b, _c, _e;
|
|
139
|
-
const hasImage = !!block.image, contentText = Array.isArray(block.content) ? block.content : block.content ? [ block.content ] : [], themeColor = getThemeColor(spec),
|
|
179
|
+
const hasImage = !!block.image, contentText = Array.isArray(block.content) ? block.content : block.content ? [ block.content ] : [], themeColor = getThemeColor(spec), getMetrics = ctx => getArcBlockMetrics(spec, index, ctx), getConnectorBox = ctx => {
|
|
180
|
+
const metrics = getMetrics(ctx);
|
|
181
|
+
return {
|
|
182
|
+
x: -1,
|
|
183
|
+
y: metrics.isDown ? metrics.imageBox.y + metrics.imageBox.height : metrics.textBox.y,
|
|
184
|
+
width: 2,
|
|
185
|
+
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)
|
|
186
|
+
};
|
|
187
|
+
};
|
|
140
188
|
return {
|
|
141
189
|
type: "group",
|
|
142
190
|
id: `storyline-block-${null !== (_a = block.id) && void 0 !== _a ? _a : index}`,
|
|
@@ -152,10 +200,10 @@ export const buildArcBlockMark = (spec, block, index) => {
|
|
|
152
200
|
interactive: !1,
|
|
153
201
|
zIndex: LayoutZIndex.Mark + 2,
|
|
154
202
|
style: {
|
|
155
|
-
x:
|
|
156
|
-
y:
|
|
157
|
-
width:
|
|
158
|
-
height:
|
|
203
|
+
x: (_d, ctx) => getConnectorBox(ctx).x,
|
|
204
|
+
y: (_d, ctx) => getConnectorBox(ctx).y,
|
|
205
|
+
width: (_d, ctx) => getConnectorBox(ctx).width,
|
|
206
|
+
height: (_d, ctx) => getConnectorBox(ctx).height,
|
|
159
207
|
fill: themeColor,
|
|
160
208
|
fillOpacity: .6
|
|
161
209
|
}
|
|
@@ -166,11 +214,11 @@ export const buildArcBlockMark = (spec, block, index) => {
|
|
|
166
214
|
zIndex: LayoutZIndex.Mark + 3
|
|
167
215
|
}, omitImageLayoutSpec(spec.image)), {
|
|
168
216
|
style: Object.assign({
|
|
169
|
-
x:
|
|
170
|
-
y:
|
|
171
|
-
width:
|
|
172
|
-
height:
|
|
173
|
-
cornerRadius: Math.min(
|
|
217
|
+
x: (_d, ctx) => getMetrics(ctx).imageBox.x,
|
|
218
|
+
y: (_d, ctx) => getMetrics(ctx).imageBox.y,
|
|
219
|
+
width: (_d, ctx) => getMetrics(ctx).imageBox.width,
|
|
220
|
+
height: (_d, ctx) => getMetrics(ctx).imageBox.height,
|
|
221
|
+
cornerRadius: (_d, ctx) => Math.min(getMetrics(ctx).imageBox.width, getMetrics(ctx).imageBox.height) / 2,
|
|
174
222
|
image: block.image,
|
|
175
223
|
repeatX: "no-repeat",
|
|
176
224
|
repeatY: "no-repeat",
|
|
@@ -185,7 +233,7 @@ export const buildArcBlockMark = (spec, block, index) => {
|
|
|
185
233
|
style: Object.assign({
|
|
186
234
|
x: 0,
|
|
187
235
|
y: 0,
|
|
188
|
-
size: Math.min(
|
|
236
|
+
size: (_d, ctx) => Math.min(getMetrics(ctx).imageBox.width, getMetrics(ctx).imageBox.height),
|
|
189
237
|
symbolType: "circle"
|
|
190
238
|
}, getImageBackgroundStyle(spec))
|
|
191
239
|
}, shouldShowImageBackground(spec) ? {
|
|
@@ -196,7 +244,7 @@ export const buildArcBlockMark = (spec, block, index) => {
|
|
|
196
244
|
style: {
|
|
197
245
|
x: 0,
|
|
198
246
|
y: 0,
|
|
199
|
-
size: Math.min(
|
|
247
|
+
size: (_d, ctx) => Math.min(getMetrics(ctx).imageBox.width, getMetrics(ctx).imageBox.height) + 12,
|
|
200
248
|
symbolType: "circle",
|
|
201
249
|
fill: "transparent",
|
|
202
250
|
stroke: withAlpha(themeColor, .82),
|
|
@@ -209,19 +257,25 @@ export const buildArcBlockMark = (spec, block, index) => {
|
|
|
209
257
|
zIndex: LayoutZIndex.Mark + 5
|
|
210
258
|
}, spec.title), {
|
|
211
259
|
style: Object.assign({
|
|
212
|
-
x:
|
|
213
|
-
y:
|
|
260
|
+
x: (_d, ctx) => getMetrics(ctx).textAnchorX,
|
|
261
|
+
y: (_d, ctx) => getMetrics(ctx).textBox.y,
|
|
214
262
|
text: block.title,
|
|
215
|
-
maxLineWidth:
|
|
216
|
-
|
|
217
|
-
|
|
263
|
+
maxLineWidth: (_d, ctx) => getMetrics(ctx).textBox.width,
|
|
264
|
+
height: (_d, ctx) => getMetrics(ctx).titleLineHeight * BLOCK_TITLE_MAX_LINES,
|
|
265
|
+
heightLimit: (_d, ctx) => getMetrics(ctx).titleLineHeight * BLOCK_TITLE_MAX_LINES,
|
|
266
|
+
lineClamp: BLOCK_TITLE_MAX_LINES,
|
|
267
|
+
fontSize: (_d, ctx) => getMetrics(ctx).titleFontSize,
|
|
268
|
+
lineHeight: (_d, ctx) => getMetrics(ctx).titleLineHeight,
|
|
218
269
|
fontWeight: "bold",
|
|
219
270
|
fill: "#1f2430",
|
|
220
271
|
stroke: "#fff",
|
|
221
272
|
lineWidth: 5,
|
|
222
273
|
lineJoin: "round",
|
|
223
|
-
textAlign:
|
|
224
|
-
textBaseline: "top"
|
|
274
|
+
textAlign: (_d, ctx) => getMetrics(ctx).textAlign,
|
|
275
|
+
textBaseline: "top",
|
|
276
|
+
whiteSpace: "normal",
|
|
277
|
+
wordBreak: "break-word",
|
|
278
|
+
ellipsis: "..."
|
|
225
279
|
}, null === (_c = spec.title) || void 0 === _c ? void 0 : _c.style)
|
|
226
280
|
}) : null, contentText.length ? Object.assign(Object.assign({
|
|
227
281
|
type: "text",
|
|
@@ -229,22 +283,19 @@ export const buildArcBlockMark = (spec, block, index) => {
|
|
|
229
283
|
interactive: !1,
|
|
230
284
|
zIndex: LayoutZIndex.Mark + 4
|
|
231
285
|
}, spec.content), {
|
|
232
|
-
textType: "rich",
|
|
233
286
|
style: Object.assign({
|
|
234
|
-
x:
|
|
235
|
-
y:
|
|
236
|
-
width:
|
|
237
|
-
height:
|
|
238
|
-
maxLineWidth:
|
|
239
|
-
heightLimit:
|
|
240
|
-
text:
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
align: metrics.textAlign
|
|
245
|
-
}),
|
|
246
|
-
textAlign: metrics.textAlign,
|
|
287
|
+
x: (_d, ctx) => getMetrics(ctx).textAnchorX,
|
|
288
|
+
y: (_d, ctx) => getMetrics(ctx).contentBox.y,
|
|
289
|
+
width: (_d, ctx) => getMetrics(ctx).contentBox.width,
|
|
290
|
+
height: (_d, ctx) => getMetrics(ctx).contentBox.height,
|
|
291
|
+
maxLineWidth: (_d, ctx) => getMetrics(ctx).contentBox.width,
|
|
292
|
+
heightLimit: (_d, ctx) => getMetrics(ctx).contentBox.height,
|
|
293
|
+
text: buildPlainContent(contentText),
|
|
294
|
+
fontSize: (_d, ctx) => getMetrics(ctx).contentFontSize,
|
|
295
|
+
lineHeight: (_d, ctx) => getMetrics(ctx).contentLineHeight,
|
|
296
|
+
textAlign: (_d, ctx) => getMetrics(ctx).textAlign,
|
|
247
297
|
textBaseline: "top",
|
|
298
|
+
whiteSpace: "normal",
|
|
248
299
|
wordBreak: "break-word",
|
|
249
300
|
ellipsis: "...",
|
|
250
301
|
fill: "#596173"
|