@visactor/vchart-extension 2.1.0-alpha.25 → 2.1.0-alpha.26
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 +118 -17
- package/build/index.min.js +1 -1
- package/cjs/charts/3d/plugin.js +1 -1
- package/cjs/charts/3d/pyramid-3d.js +1 -1
- package/cjs/charts/3d/rect-3d.js +1 -1
- package/cjs/charts/3d/util.js +1 -1
- package/cjs/charts/axis-3d/axis-3d-mixin.js +1 -1
- package/cjs/charts/axis-3d/band-axis.js +1 -1
- package/cjs/charts/axis-3d/index.js +1 -1
- package/cjs/charts/axis-3d/linear-axis.js +1 -2
- package/cjs/charts/axis-3d/log-axis.js +1 -1
- package/cjs/charts/axis-3d/symlog-axis.js +1 -1
- package/cjs/charts/axis-3d/theme.js +1 -1
- package/cjs/charts/axis-3d/time-axis.js +1 -1
- package/cjs/charts/axis-3d/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 -1
- 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/histogram-3d/chart.js +1 -2
- package/cjs/charts/histogram-3d/index.js +1 -1
- package/cjs/charts/histogram-3d/interface.js +1 -1
- package/cjs/charts/storyline/layouts/wing.js +92 -19
- package/cjs/charts/storyline/layouts/wing.js.map +1 -1
- package/cjs/charts/storyline/storyline-transformer.js +7 -3
- 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 +2 -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 +1 -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 +1 -1
- package/cjs/components/series-label/constant.js +1 -1
- package/cjs/components/series-label/index.js +2 -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/3d/plugin.js +1 -1
- package/esm/charts/3d/pyramid-3d.js +1 -1
- package/esm/charts/3d/rect-3d.js +1 -1
- package/esm/charts/3d/util.js +1 -1
- package/esm/charts/axis-3d/axis-3d-mixin.js +1 -1
- package/esm/charts/axis-3d/band-axis.js +1 -1
- package/esm/charts/axis-3d/index.js +1 -1
- package/esm/charts/axis-3d/linear-axis.js +1 -2
- package/esm/charts/axis-3d/log-axis.js +1 -1
- package/esm/charts/axis-3d/symlog-axis.js +1 -1
- package/esm/charts/axis-3d/theme.js +1 -1
- package/esm/charts/axis-3d/time-axis.js +1 -1
- package/esm/charts/axis-3d/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 -1
- 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/histogram-3d/chart.js +1 -2
- package/esm/charts/histogram-3d/index.js +1 -1
- package/esm/charts/histogram-3d/interface.js +1 -1
- package/esm/charts/storyline/layouts/wing.js +92 -19
- package/esm/charts/storyline/layouts/wing.js.map +1 -1
- package/esm/charts/storyline/storyline-transformer.js +5 -3
- 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 +2 -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 +1 -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 +1 -1
- package/esm/components/series-label/constant.js +1 -1
- package/esm/components/series-label/index.js +2 -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 +4 -4
package/esm/charts/3d/plugin.js
CHANGED
|
@@ -21,4 +21,4 @@ export const registerPyramid3dMark = () => {
|
|
|
21
21
|
Factory.registerMark(Pyramid3dMark.type, Pyramid3dMark), registerShadowRoot(), registerPyramid3d(),
|
|
22
22
|
registerPolygonAnimation(), Factory.registerGraphicComponent("pyramid3d", createPyramid3d);
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=pyramid-3d.js.map
|
|
24
|
+
//# sourceMappingURL=pyramid-3d.js.map
|
package/esm/charts/3d/rect-3d.js
CHANGED
|
@@ -27,4 +27,4 @@ export const registerRect3dMark = () => {
|
|
|
27
27
|
Factory.registerMark(Rect3dMark.type, Rect3dMark), registerShadowRoot(), registerRect3d(),
|
|
28
28
|
registerRectAnimation(), Factory.registerGraphicComponent("rect3d", createRect3d);
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=rect-3d.js.map
|
|
30
|
+
//# sourceMappingURL=rect-3d.js.map
|
package/esm/charts/3d/util.js
CHANGED
|
@@ -16,4 +16,4 @@ export const registerAxis3dPlugin = () => {
|
|
|
16
16
|
register3DPlugin(), registerLayout3d(), registerCartesianBandAxis3d(), registerCartesianLinearAxis3d(),
|
|
17
17
|
registerCartesianTimeAxis3d(), registerCartesianSymlogAxis3d(), registerCartesianLogAxis3d();
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -12,5 +12,4 @@ export const registerCartesianLinearAxis3d = () => {
|
|
|
12
12
|
AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), {
|
|
13
13
|
axisZ: Object.assign(Object.assign({}, CartesianLinearAxis.builtInTheme.axisX), axisZ)
|
|
14
14
|
}), mixin(AxisCls, Axis3dMixin);
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=linear-axis.js.map
|
|
15
|
+
};
|
|
@@ -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,2 @@
|
|
|
1
1
|
export { };
|
|
2
|
-
//# sourceMappingURL=interface.js.map
|
|
2
|
+
//# sourceMappingURL=interface.js.map
|
|
@@ -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
|
|
@@ -26,5 +26,4 @@ export const registerHistogram3dChart = () => {
|
|
|
26
26
|
registerGroupTooltipProcessor(), registerDimensionTooltipProcessor(), registerMarkTooltipProcessor(),
|
|
27
27
|
registerDimensionEvents(), registerDimensionHover(), register3DPlugin(), registerLayout3d(),
|
|
28
28
|
registerBar3dSeries(), Factory.registerChart(Histogram3dChart.type, Histogram3dChart);
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=chart.js.map
|
|
29
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { };
|
|
2
|
-
//# sourceMappingURL=interface.js.map
|
|
2
|
+
//# sourceMappingURL=interface.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { LayoutZIndex } from "@visactor/vchart";
|
|
1
|
+
import { LayoutZIndex, measureText } from "@visactor/vchart";
|
|
2
2
|
|
|
3
|
-
import { BLOCK_TITLE_MAX_LINES, buildPlainContent,
|
|
3
|
+
import { BLOCK_TITLE_MAX_LINES, buildPlainContent, getImageBackgroundStyle, getChartGeometry, getRegionGeometry, getThemeColor, getTitleImageSize, normalizeLayout, omitImageLayoutSpec, resolveAdaptiveLineHeight, shouldShowImageBackground } from "./common";
|
|
4
4
|
|
|
5
|
-
const WING_BLOCK_IMAGE_SIZE = 160, WING_TEXT_GAP_FROM_IMAGE = 14, WING_TITLE_LINE_HEIGHT = 30, WING_TITLE_FONT_SIZE = 22, WING_CONTENT_LINE_HEIGHT = 17, WING_CONTENT_FONT_SIZE = 12, WING_TEXT_BOX_WIDTH = 240, WING_TEXT_BOX_HEIGHT = 110, WING_TITLE_TO_CONTENT_GAP = 4, WING_TITLE_IMAGE_WIDTH_RATIO = .6, WING_TITLE_IMAGE_MAX_WIDTH = 820, WING_DEFAULT_PATH_END_WIDTH = 350, WING_IMAGE_MIN_SCALE = .52, WING_IMAGE_MAX_SCALE = 1.2, WING_BOTTOM_TEXT_IMAGE_GAP_RATIO = 1.35, clamp = (value, min, max) => Math.max(min, Math.min(max, value)), getWingDirection = spec => "right" === normalizeLayout(spec.layout).direction ? "right" : "left", getWingPathWidthRange = spec => {
|
|
5
|
+
const WING_BLOCK_IMAGE_SIZE = 160, WING_TEXT_GAP_FROM_IMAGE = 14, WING_TITLE_LINE_HEIGHT = 30, WING_TITLE_FONT_SIZE = 22, WING_TITLE_MIN_FONT_SIZE = 14, WING_TITLE_MAX_FONT_SIZE = 30, WING_CONTENT_LINE_HEIGHT = 17, WING_CONTENT_FONT_SIZE = 12, WING_TEXT_BOX_WIDTH = 240, WING_TEXT_BOX_MIN_WIDTH = 240, WING_TEXT_BOX_MAX_WIDTH = 360, WING_TEXT_BOX_WIDTH_RATIO = .24, WING_TEXT_BOX_HEIGHT = 110, WING_TITLE_TO_CONTENT_GAP = 4, WING_TITLE_IMAGE_WIDTH_RATIO = .6, WING_TITLE_IMAGE_MAX_WIDTH = 820, WING_DEFAULT_PATH_END_WIDTH = 350, WING_IMAGE_MIN_SCALE = .52, WING_IMAGE_MAX_SCALE = 1.2, WING_BOTTOM_TEXT_IMAGE_GAP_RATIO = 1.35, WING_PATH_EDGE_GAP = 8, clamp = (value, min, max) => Math.max(min, Math.min(max, value)), getWingDirection = spec => "right" === normalizeLayout(spec.layout).direction ? "right" : "left", getWingPathWidthRange = spec => {
|
|
6
6
|
var _a, _b, _c, _e, _f;
|
|
7
7
|
const lineStyle = null !== (_b = null === (_a = spec.line) || void 0 === _a ? void 0 : _a.style) && void 0 !== _b ? _b : {}, startWidth = Math.max(Number(null !== (_c = lineStyle.startWidth) && void 0 !== _c ? _c : 50), .5);
|
|
8
8
|
return {
|
|
@@ -16,14 +16,46 @@ const WING_BLOCK_IMAGE_SIZE = 160, WING_TEXT_GAP_FROM_IMAGE = 14, WING_TITLE_LIN
|
|
|
16
16
|
}, getWingBlockImageScale = (spec, index) => {
|
|
17
17
|
const {startWidth: startWidth, endWidth: endWidth} = getWingPathWidthRange(spec), startScale = clamp(startWidth / 350, .52, 1.2);
|
|
18
18
|
return startScale + (clamp(endWidth / 350, .52, 1.2) - startScale) * getWingBlockPathRatio(spec, index);
|
|
19
|
+
}, getConfiguredTextBoxWidth = spec => {
|
|
20
|
+
var _a, _b, _c;
|
|
21
|
+
const style = null === (_a = spec.title) || void 0 === _a ? void 0 : _a.style, width = Number(null !== (_c = null !== (_b = null == style ? void 0 : style.width) && void 0 !== _b ? _b : null == style ? void 0 : style.maxLineWidth) && void 0 !== _c ? _c : 240);
|
|
22
|
+
return Number.isFinite(width) && width > 0 ? width : 240;
|
|
23
|
+
}, getWingTextBoxWidth = (spec, ctx) => {
|
|
24
|
+
const {width: width} = getRegionGeometry(ctx, spec), configuredWidth = getConfiguredTextBoxWidth(spec), adaptiveWidth = Math.max(configuredWidth, Math.round(.24 * width));
|
|
25
|
+
return clamp(adaptiveWidth, 240, 360);
|
|
26
|
+
}, estimateTextWidth = (text, fontSize) => Array.from(text).reduce(((sum, char) => 0 === char.trim().length ? sum + .32 * fontSize : sum + fontSize * (char.charCodeAt(0) > 255 ? 1.05 : .62)), 0), measureWingTitleWidth = (title, fontSize, style) => {
|
|
27
|
+
var _a;
|
|
28
|
+
if (!title) return 0;
|
|
29
|
+
try {
|
|
30
|
+
const size = measureText(title, {
|
|
31
|
+
fontSize: fontSize,
|
|
32
|
+
fontFamily: style.fontFamily,
|
|
33
|
+
fontWeight: null !== (_a = style.fontWeight) && void 0 !== _a ? _a : "bold"
|
|
34
|
+
});
|
|
35
|
+
return Number.isFinite(size.width) && size.width > 0 ? size.width : estimateTextWidth(title, fontSize);
|
|
36
|
+
} catch (_err) {
|
|
37
|
+
return estimateTextWidth(title, fontSize);
|
|
38
|
+
}
|
|
39
|
+
}, getMeasuredTitleLineCount = (title, fontSize, textWidth, style) => {
|
|
40
|
+
if (!title) return 0;
|
|
41
|
+
const measuredWidth = measureWingTitleWidth(title, fontSize, style);
|
|
42
|
+
return Math.max(1, Math.min(BLOCK_TITLE_MAX_LINES, Math.ceil(measuredWidth / Math.max(.96 * textWidth, 1))));
|
|
43
|
+
}, resolveWingTitleFontSize = (spec, index, textWidth) => {
|
|
44
|
+
var _a, _b, _c, _e;
|
|
45
|
+
const style = null !== (_b = null === (_a = spec.title) || void 0 === _a ? void 0 : _a.style) && void 0 !== _b ? _b : {}, configuredFontSize = style.fontSize;
|
|
46
|
+
if (null != configuredFontSize) return Number(configuredFontSize);
|
|
47
|
+
const title = null === (_e = null === (_c = spec.data) || void 0 === _c ? void 0 : _c[index]) || void 0 === _e ? void 0 : _e.title, measuredWidth = measureWingTitleWidth(title, 22, style);
|
|
48
|
+
if (!measuredWidth) return 22;
|
|
49
|
+
const widthLimit = textWidth * BLOCK_TITLE_MAX_LINES * .96, measuredPerFont = measuredWidth / 22, fittedFontSize = Math.floor(widthLimit / Math.max(measuredPerFont, 1));
|
|
50
|
+
return clamp(fittedFontSize, 14, 30);
|
|
19
51
|
}, getWingArcGeometry = (spec, ctx) => {
|
|
20
52
|
var _a, _b, _c;
|
|
21
|
-
const {width: width, height: height, startX: startX, startY: startY} = getRegionGeometry(ctx), innerWidth = Math.max(width, 1), innerHeight = Math.max(height, 1), layoutOpt = normalizeLayout(spec.layout), direction = getWingDirection(spec), defaultStart = "right" === direction ? 110 : -70, defaultEnd = "right" === direction ? 250 : 70, startAngle = null !== (_a = layoutOpt.startAngle) && void 0 !== _a ? _a : defaultStart, endAngle = null !== (_b = layoutOpt.endAngle) && void 0 !== _b ? _b : defaultEnd, ratio = null !== (_c = layoutOpt.radiusRatio) && void 0 !== _c ? _c : .92, rx = .6 * innerWidth * ratio;
|
|
53
|
+
const {width: width, height: height, startX: startX, startY: startY} = getRegionGeometry(ctx), innerWidth = Math.max(width, 1), innerHeight = Math.max(height, 1), layoutOpt = normalizeLayout(spec.layout), direction = getWingDirection(spec), defaultStart = "right" === direction ? 110 : -70, defaultEnd = "right" === direction ? 250 : 70, startAngle = null !== (_a = layoutOpt.startAngle) && void 0 !== _a ? _a : defaultStart, endAngle = null !== (_b = layoutOpt.endAngle) && void 0 !== _b ? _b : defaultEnd, ratio = null !== (_c = layoutOpt.radiusRatio) && void 0 !== _c ? _c : .92, {startWidth: startWidth, endWidth: endWidth} = getWingPathWidthRange(spec), topPathWidth = "right" === direction ? endWidth : startWidth, pathTopInset = Math.min(Math.max(innerHeight / 2 - 1, 0), Math.ceil(topPathWidth / 2 + 8)), ry = Math.max(innerHeight - pathTopInset, 1) / 2 * ratio, rx = .6 * innerWidth * ratio;
|
|
22
54
|
return {
|
|
23
55
|
cx: "right" === direction ? startX + innerWidth - .1 * rx : startX + .1 * rx,
|
|
24
|
-
cy: startY +
|
|
56
|
+
cy: startY + pathTopInset - Math.min(Math.sin(startAngle / 180 * Math.PI), Math.sin(endAngle / 180 * Math.PI), 0) * ry,
|
|
25
57
|
rx: rx,
|
|
26
|
-
ry:
|
|
58
|
+
ry: ry,
|
|
27
59
|
startAngle: startAngle,
|
|
28
60
|
endAngle: endAngle
|
|
29
61
|
};
|
|
@@ -103,11 +135,50 @@ export const buildWingTitleImageMark = spec => {
|
|
|
103
135
|
name: "storyline-wing-title-image",
|
|
104
136
|
zIndex: LayoutZIndex.Mark + 8,
|
|
105
137
|
children: [ Object.assign(Object.assign({
|
|
138
|
+
type: "rect",
|
|
139
|
+
name: "storyline-wing-title-image-node",
|
|
140
|
+
interactive: !1
|
|
141
|
+
}, spec.titleImage), {
|
|
142
|
+
_debug_bounds: !0,
|
|
143
|
+
style: Object.assign({
|
|
144
|
+
_debug_bounds: !0,
|
|
145
|
+
x: (_d, ctx) => {
|
|
146
|
+
const {width: width, height: height, startX: startX} = getChartGeometry(ctx, spec), size = getTitleImageSize(spec, width, height, {
|
|
147
|
+
widthRatio: .6,
|
|
148
|
+
maxWidth: 820
|
|
149
|
+
});
|
|
150
|
+
return "right" === getWingDirection(spec) ? startX : startX + width - size.width;
|
|
151
|
+
},
|
|
152
|
+
fill: "red",
|
|
153
|
+
y: (_d, ctx) => getChartGeometry(ctx, spec).startY + 12,
|
|
154
|
+
width: (_d, ctx) => {
|
|
155
|
+
const {width: width, height: height} = getChartGeometry(ctx, spec);
|
|
156
|
+
return getTitleImageSize(spec, width, height, {
|
|
157
|
+
widthRatio: .6,
|
|
158
|
+
maxWidth: 820
|
|
159
|
+
}).width;
|
|
160
|
+
},
|
|
161
|
+
height: (_d, ctx) => {
|
|
162
|
+
const {width: width, height: height} = getChartGeometry(ctx, spec);
|
|
163
|
+
return getTitleImageSize(spec, width, height, {
|
|
164
|
+
widthRatio: .6,
|
|
165
|
+
maxWidth: 820
|
|
166
|
+
}).height;
|
|
167
|
+
},
|
|
168
|
+
image: spec.titleImage.image,
|
|
169
|
+
repeatX: "no-repeat",
|
|
170
|
+
repeatY: "no-repeat",
|
|
171
|
+
imageMode: "contain",
|
|
172
|
+
imagePosition: "center"
|
|
173
|
+
}, spec.titleImage.style)
|
|
174
|
+
}), Object.assign(Object.assign({
|
|
106
175
|
type: "image",
|
|
107
176
|
name: "storyline-wing-title-image-node",
|
|
108
177
|
interactive: !1
|
|
109
178
|
}, spec.titleImage), {
|
|
179
|
+
_debug_bounds: !0,
|
|
110
180
|
style: Object.assign({
|
|
181
|
+
_debug_bounds: !0,
|
|
111
182
|
x: (_d, ctx) => {
|
|
112
183
|
const {width: width, height: height, startX: startX} = getChartGeometry(ctx, spec), size = getTitleImageSize(spec, width, height, {
|
|
113
184
|
widthRatio: .6,
|
|
@@ -141,25 +212,25 @@ export const buildWingTitleImageMark = spec => {
|
|
|
141
212
|
};
|
|
142
213
|
|
|
143
214
|
const WING_TEXT_IMAGE_GAP = 120, getWingBlockMetrics = (spec, ctx, index) => {
|
|
144
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s
|
|
145
|
-
const
|
|
215
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
216
|
+
const textWidth = getWingTextBoxWidth(spec, ctx), titleStyle = null !== (_b = null === (_a = spec.title) || void 0 === _a ? void 0 : _a.style) && void 0 !== _b ? _b : {}, titleFontSize = resolveWingTitleFontSize(spec, index, textWidth), titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, titleStyle, 30, 1.3), titleHeight = titleLineHeight * getMeasuredTitleLineCount(null === (_e = null === (_c = spec.data) || void 0 === _c ? void 0 : _c[index]) || void 0 === _e ? void 0 : _e.title, titleFontSize, textWidth, titleStyle), contentFontSize = Number(null !== (_h = null === (_g = null === (_f = spec.content) || void 0 === _f ? void 0 : _f.style) || void 0 === _g ? void 0 : _g.fontSize) && void 0 !== _h ? _h : 12), contentLineHeight = Number(null !== (_l = null === (_k = null === (_j = spec.content) || void 0 === _j ? void 0 : _j.style) || void 0 === _k ? void 0 : _k.lineHeight) && void 0 !== _l ? _l : 17), imageScale = getWingBlockImageScale(spec, index), imageWidth = Math.round(Number(null !== (_o = null === (_m = spec.image) || void 0 === _m ? void 0 : _m.width) && void 0 !== _o ? _o : 160) * imageScale), imageHeight = Math.round(Number(null !== (_q = null === (_p = spec.image) || void 0 === _p ? void 0 : _p.height) && void 0 !== _q ? _q : 160) * imageScale), imageBox = {
|
|
146
217
|
x: -imageWidth / 2,
|
|
147
218
|
y: -imageHeight / 2,
|
|
148
219
|
width: imageWidth,
|
|
149
220
|
height: imageHeight
|
|
150
|
-
}, direction = getWingDirection(spec), count = null !== (
|
|
221
|
+
}, direction = getWingDirection(spec), count = null !== (_s = null === (_r = spec.data) || void 0 === _r ? void 0 : _r.length) && void 0 !== _s ? _s : 0, isSpecialBelow = "right" === direction && count > 0 && index === count - 1 || "left" === direction && 0 === index, isBottomAbove = isWingBottomBlock(spec, ctx, index), isVerticalLayout = isBottomAbove || isSpecialBelow;
|
|
151
222
|
let textBox, contentBox, connectorBox, onLeft, verticalAlign;
|
|
152
223
|
if (isBottomAbove) {
|
|
153
|
-
const bottomTextImageGap = Math.round(162), textX = -
|
|
224
|
+
const bottomTextImageGap = Math.round(162), textX = -textWidth / 2, textY = -imageHeight / 2 - bottomTextImageGap - 110;
|
|
154
225
|
textBox = {
|
|
155
226
|
x: textX,
|
|
156
227
|
y: textY,
|
|
157
|
-
width:
|
|
228
|
+
width: textWidth,
|
|
158
229
|
height: 110
|
|
159
230
|
}, contentBox = {
|
|
160
231
|
x: textX,
|
|
161
232
|
y: textY + titleHeight + 4,
|
|
162
|
-
width:
|
|
233
|
+
width: textWidth,
|
|
163
234
|
height: 1e5
|
|
164
235
|
}, connectorBox = {
|
|
165
236
|
x: -1,
|
|
@@ -168,16 +239,16 @@ const WING_TEXT_IMAGE_GAP = 120, getWingBlockMetrics = (spec, ctx, index) => {
|
|
|
168
239
|
height: bottomTextImageGap
|
|
169
240
|
}, onLeft = !1, verticalAlign = "above";
|
|
170
241
|
} else if (isVerticalLayout) {
|
|
171
|
-
const textX = -
|
|
242
|
+
const textX = -textWidth / 2, textY = imageHeight / 2 + 120;
|
|
172
243
|
textBox = {
|
|
173
244
|
x: textX,
|
|
174
245
|
y: textY,
|
|
175
|
-
width:
|
|
246
|
+
width: textWidth,
|
|
176
247
|
height: 110
|
|
177
248
|
}, contentBox = {
|
|
178
249
|
x: textX,
|
|
179
250
|
y: textY + titleHeight + 4,
|
|
180
|
-
width:
|
|
251
|
+
width: textWidth,
|
|
181
252
|
height: 1e5
|
|
182
253
|
}, connectorBox = {
|
|
183
254
|
x: -1,
|
|
@@ -186,19 +257,19 @@ const WING_TEXT_IMAGE_GAP = 120, getWingBlockMetrics = (spec, ctx, index) => {
|
|
|
186
257
|
height: 120
|
|
187
258
|
}, onLeft = !1, verticalAlign = "below";
|
|
188
259
|
} else {
|
|
189
|
-
const textOnLeft = "right" === direction, textX = textOnLeft ? -imageWidth / 2 - 120 -
|
|
260
|
+
const textOnLeft = "right" === direction, textX = textOnLeft ? -imageWidth / 2 - 120 - textWidth : imageWidth / 2 + 120, textY = -55;
|
|
190
261
|
textBox = {
|
|
191
262
|
x: textX,
|
|
192
263
|
y: textY,
|
|
193
|
-
width:
|
|
264
|
+
width: textWidth,
|
|
194
265
|
height: 110
|
|
195
266
|
}, contentBox = {
|
|
196
267
|
x: textX,
|
|
197
268
|
y: textY + titleHeight + 4,
|
|
198
|
-
width:
|
|
269
|
+
width: textWidth,
|
|
199
270
|
height: 1e5
|
|
200
271
|
};
|
|
201
|
-
const imageEdgeX = textOnLeft ? -imageWidth / 2 : imageWidth / 2, textEdgeX = textOnLeft ? textX +
|
|
272
|
+
const imageEdgeX = textOnLeft ? -imageWidth / 2 : imageWidth / 2, textEdgeX = textOnLeft ? textX + textWidth : textX;
|
|
202
273
|
connectorBox = {
|
|
203
274
|
x: Math.min(imageEdgeX, textEdgeX),
|
|
204
275
|
y: 0,
|
|
@@ -298,6 +369,8 @@ export const buildWingBlockMark = (spec, block, index) => {
|
|
|
298
369
|
return m.verticalAlign ? m.textBox.x + m.textBox.width / 2 : m.onLeft ? m.textBox.x + m.textBox.width : m.textBox.x;
|
|
299
370
|
},
|
|
300
371
|
y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.y,
|
|
372
|
+
width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.width,
|
|
373
|
+
maxLineWidth: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.width,
|
|
301
374
|
text: block.title,
|
|
302
375
|
height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleHeight,
|
|
303
376
|
heightLimit: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleLineHeight * BLOCK_TITLE_MAX_LINES,
|