@visactor/vchart-extension 2.1.0-alpha.22 → 2.1.0-alpha.23
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 +143 -103
- package/build/index.min.js +1 -1
- package/cjs/charts/axis-3d/index.js +2 -1
- package/cjs/charts/axis-3d/linear-axis.js +1 -2
- 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 -1
- 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 -2
- 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 -1
- package/cjs/charts/conversion-funnel/util.js +1 -1
- package/cjs/charts/funnel-3d/chart.js +1 -2
- 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 -1
- package/cjs/charts/funnel-3d/theme.js +1 -1
- package/cjs/charts/histogram-3d/chart.js +1 -1
- package/cjs/charts/storyline/layouts/arc.js +61 -17
- package/cjs/charts/storyline/layouts/arc.js.map +1 -1
- package/cjs/charts/storyline/layouts/clock.js +16 -8
- package/cjs/charts/storyline/layouts/clock.js.map +1 -1
- package/cjs/charts/storyline/layouts/common.d.ts +3 -15
- package/cjs/charts/storyline/layouts/common.js +9 -21
- package/cjs/charts/storyline/layouts/common.js.map +1 -1
- package/cjs/charts/storyline/layouts/default.js +14 -8
- package/cjs/charts/storyline/layouts/default.js.map +1 -1
- package/cjs/charts/storyline/layouts/ladder.js +15 -9
- package/cjs/charts/storyline/layouts/ladder.js.map +1 -1
- package/cjs/charts/storyline/layouts/landscape.js +21 -15
- 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 +21 -16
- package/cjs/charts/storyline/layouts/portrait.js.map +1 -1
- package/cjs/charts/storyline/layouts/wing.js +15 -8
- package/cjs/charts/storyline/layouts/wing.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/axis-3d/linear-axis.js +1 -2
- 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 -1
- 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 -2
- 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 -1
- package/esm/charts/conversion-funnel/util.js +1 -1
- package/esm/charts/funnel-3d/chart.js +1 -2
- 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 -1
- package/esm/charts/funnel-3d/theme.js +1 -1
- package/esm/charts/histogram-3d/chart.js +1 -1
- package/esm/charts/storyline/layouts/arc.js +59 -17
- package/esm/charts/storyline/layouts/arc.js.map +1 -1
- package/esm/charts/storyline/layouts/clock.js +17 -9
- package/esm/charts/storyline/layouts/clock.js.map +1 -1
- package/esm/charts/storyline/layouts/common.d.ts +3 -15
- package/esm/charts/storyline/layouts/common.js +6 -18
- package/esm/charts/storyline/layouts/common.js.map +1 -1
- package/esm/charts/storyline/layouts/default.js +14 -9
- package/esm/charts/storyline/layouts/default.js.map +1 -1
- package/esm/charts/storyline/layouts/ladder.js +15 -10
- package/esm/charts/storyline/layouts/ladder.js.map +1 -1
- package/esm/charts/storyline/layouts/landscape.js +20 -16
- 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 +20 -16
- package/esm/charts/storyline/layouts/portrait.js.map +1 -1
- package/esm/charts/storyline/layouts/wing.js +15 -9
- package/esm/charts/storyline/layouts/wing.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 +4 -4
|
@@ -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("./map-label"), exports), __exportStar(require("./type"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -151,4 +151,4 @@ function candidatesByOrient(positions, anchor, rect, offset = 0) {
|
|
|
151
151
|
exports.bound = bound, exports.layoutByPosition = layoutByPosition, exports.layoutOuter = layoutOuter,
|
|
152
152
|
exports.layoutOuter2 = layoutOuter2, exports.placeRectByOrient = placeRectByOrient,
|
|
153
153
|
exports.candidatesByOrient = candidatesByOrient;
|
|
154
|
-
//# sourceMappingURL=layout.js.map
|
|
154
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -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("./regression-line"), exports), __exportStar(require("./type"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -100,4 +100,4 @@ function appendScatterRegressionLineConfig(chartSpec, spec) {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
exports.getScatterRegressionLineConfig = getScatterRegressionLineConfig, exports.appendScatterRegressionLineConfig = appendScatterRegressionLineConfig;
|
|
103
|
-
//# sourceMappingURL=index.js.map
|
|
103
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -46,4 +46,4 @@ Object.defineProperty(exports, "getSeriesBreakConfig", {
|
|
|
46
46
|
return util_1.appendSeriesBreakConfig;
|
|
47
47
|
}
|
|
48
48
|
}), __exportStar(require("./type"), exports), __exportStar(require("./constant"), exports);
|
|
49
|
-
//# sourceMappingURL=index.js.map
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -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
|
|
@@ -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
|
+
};
|
|
@@ -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
|
|
@@ -19,5 +19,4 @@ CandlestickChart.transformerConstructor = CandlestickChartSpecTransformer;
|
|
|
19
19
|
export const registerCandlestickChart = () => {
|
|
20
20
|
registerDimensionTooltipProcessor(), registerMarkTooltipProcessor(), registerDimensionEvents(),
|
|
21
21
|
registerDimensionHover(), registerCandlestickSeries(), Factory.registerChart(CandlestickChart.type, CandlestickChart);
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=candlestick.js.map
|
|
22
|
+
};
|
|
@@ -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,2 @@
|
|
|
1
1
|
export { };
|
|
2
|
-
//# sourceMappingURL=interface.js.map
|
|
2
|
+
//# sourceMappingURL=interface.js.map
|
|
@@ -21,5 +21,4 @@ Funnel3dChart.transformerConstructor = FunnelChartSpecTransformer;
|
|
|
21
21
|
export const registerFunnel3dChart = () => {
|
|
22
22
|
registerMarkTooltipProcessor(), register3DPlugin(), registerLayout3d(), registerFunnel3dSeries(),
|
|
23
23
|
Factory.registerChart(Funnel3dChart.type, Funnel3dChart);
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=chart.js.map
|
|
24
|
+
};
|
|
@@ -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
|
|
@@ -81,4 +81,4 @@ Funnel3dSeries.builtInTheme = {
|
|
|
81
81
|
export const registerFunnel3dSeries = () => {
|
|
82
82
|
registerPyramid3dMark(), registerTextMark(), registerRuleMark(), Factory.registerSeries(Funnel3dSeries.type, Funnel3dSeries);
|
|
83
83
|
};
|
|
84
|
-
//# sourceMappingURL=series.js.map
|
|
84
|
+
//# sourceMappingURL=series.js.map
|
|
@@ -27,4 +27,4 @@ export const registerHistogram3dChart = () => {
|
|
|
27
27
|
registerDimensionEvents(), registerDimensionHover(), register3DPlugin(), registerLayout3d(),
|
|
28
28
|
registerBar3dSeries(), Factory.registerChart(Histogram3dChart.type, Histogram3dChart);
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=chart.js.map
|
|
30
|
+
//# sourceMappingURL=chart.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 = 240, 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, 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,9 +32,9 @@ 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
|
-
},
|
|
35
|
+
}, getArcBlockCenterByGeometry = (spec, arc, index) => {
|
|
36
36
|
var _a, _b, _c, _e;
|
|
37
|
-
const
|
|
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
|
|
@@ -44,7 +44,46 @@ const ARC_BLOCK_IMAGE_SIZE = 240, ARC_BLOCK_IMAGE_BORDER = 3, ARC_BLOCK_IMAGE_HA
|
|
|
44
44
|
x: px + nx * offset,
|
|
45
45
|
y: py + ny * offset
|
|
46
46
|
};
|
|
47
|
-
}
|
|
47
|
+
}, getArcBlockBounds = (spec, arc, index) => {
|
|
48
|
+
const center = getArcBlockCenterByGeometry(spec, arc, index), metrics = getArcBlockMetrics(spec, index), 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) => {
|
|
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))).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), 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);
|
|
48
87
|
|
|
49
88
|
export const buildArcMark = spec => {
|
|
50
89
|
var _a;
|
|
@@ -104,8 +143,8 @@ export const buildArcTitleImageMark = spec => {
|
|
|
104
143
|
};
|
|
105
144
|
|
|
106
145
|
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 contentFontSize = Number(null !== (_c = null === (_b = null === (_a = spec.content) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.fontSize) && void 0 !== _c ? _c :
|
|
146
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
147
|
+
const contentFontSize = Number(null !== (_c = null === (_b = null === (_a = spec.content) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.fontSize) && void 0 !== _c ? _c : 18), contentLineHeight = Number(null !== (_g = null === (_f = null === (_e = spec.content) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.lineHeight) && void 0 !== _g ? _g : 24), imageDiameter = Math.max(null !== (_j = null === (_h = spec.image) || void 0 === _h ? void 0 : _h.width) && void 0 !== _j ? _j : 240, null !== (_l = null === (_k = spec.image) || void 0 === _k ? void 0 : _k.height) && void 0 !== _l ? _l : 240), imageWidth = imageDiameter, imageHeight = imageDiameter, isDown = isDownArc(spec), count = Math.max(null !== (_o = null === (_m = spec.data) || void 0 === _m ? void 0 : _m.length) && void 0 !== _o ? _o : 0, 1), canvasWidth = Number(null !== (_p = spec.width) && void 0 !== _p ? _p : imageWidth * count), defaultTextWidth = Math.round(canvasWidth / (count + 1)), textBoxWidth = Math.max(Number(null !== (_r = null === (_q = spec.block) || void 0 === _q ? void 0 : _q.width) && void 0 !== _r ? _r : defaultTextWidth), 240), titleFontSize = resolveTitleFontSize(spec, void 0, null === (_t = null === (_s = spec.data) || void 0 === _s ? void 0 : _s[index]) || void 0 === _t ? void 0 : _t.title, textBoxWidth, 32, [ 8, 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), contentHeight = Math.max(240 - titleHeight - 4, contentLineHeight), isLeftSide = index < count / 2, imageBox = {
|
|
109
148
|
x: -imageWidth / 2,
|
|
110
149
|
y: -imageHeight / 2,
|
|
111
150
|
width: imageWidth,
|
|
@@ -125,7 +164,7 @@ 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
|
},
|
|
@@ -213,6 +252,9 @@ export const buildArcBlockMark = (spec, block, index) => {
|
|
|
213
252
|
y: metrics.textBox.y,
|
|
214
253
|
text: block.title,
|
|
215
254
|
maxLineWidth: metrics.textBox.width,
|
|
255
|
+
height: metrics.titleLineHeight * BLOCK_TITLE_MAX_LINES,
|
|
256
|
+
heightLimit: metrics.titleLineHeight * BLOCK_TITLE_MAX_LINES,
|
|
257
|
+
lineClamp: BLOCK_TITLE_MAX_LINES,
|
|
216
258
|
fontSize: metrics.titleFontSize,
|
|
217
259
|
lineHeight: metrics.titleLineHeight,
|
|
218
260
|
fontWeight: "bold",
|
|
@@ -221,7 +263,10 @@ export const buildArcBlockMark = (spec, block, index) => {
|
|
|
221
263
|
lineWidth: 5,
|
|
222
264
|
lineJoin: "round",
|
|
223
265
|
textAlign: metrics.textAlign,
|
|
224
|
-
textBaseline: "top"
|
|
266
|
+
textBaseline: "top",
|
|
267
|
+
whiteSpace: "normal",
|
|
268
|
+
wordBreak: "break-word",
|
|
269
|
+
ellipsis: "..."
|
|
225
270
|
}, null === (_c = spec.title) || void 0 === _c ? void 0 : _c.style)
|
|
226
271
|
}) : null, contentText.length ? Object.assign(Object.assign({
|
|
227
272
|
type: "text",
|
|
@@ -229,7 +274,6 @@ export const buildArcBlockMark = (spec, block, index) => {
|
|
|
229
274
|
interactive: !1,
|
|
230
275
|
zIndex: LayoutZIndex.Mark + 4
|
|
231
276
|
}, spec.content), {
|
|
232
|
-
textType: "rich",
|
|
233
277
|
style: Object.assign({
|
|
234
278
|
x: metrics.contentBox.x,
|
|
235
279
|
y: metrics.contentBox.y,
|
|
@@ -237,14 +281,12 @@ export const buildArcBlockMark = (spec, block, index) => {
|
|
|
237
281
|
height: metrics.contentBox.height,
|
|
238
282
|
maxLineWidth: metrics.contentBox.width,
|
|
239
283
|
heightLimit: metrics.contentBox.height,
|
|
240
|
-
text:
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
fill: "#596173",
|
|
244
|
-
align: metrics.textAlign
|
|
245
|
-
}),
|
|
284
|
+
text: buildPlainContent(contentText),
|
|
285
|
+
fontSize: metrics.contentFontSize,
|
|
286
|
+
lineHeight: metrics.contentLineHeight,
|
|
246
287
|
textAlign: metrics.textAlign,
|
|
247
288
|
textBaseline: "top",
|
|
289
|
+
whiteSpace: "normal",
|
|
248
290
|
wordBreak: "break-word",
|
|
249
291
|
ellipsis: "...",
|
|
250
292
|
fill: "#596173"
|