@visactor/vchart-extension 2.1.0-alpha.24 → 2.1.0-alpha.25
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 +99 -308
- 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 -1
- 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/bar-3d/constant.js +2 -1
- package/cjs/charts/candlestick/candlestick.js +1 -2
- 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 +2 -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/funnel-3d/series.js +2 -1
- 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/interface.d.ts +2 -4
- package/cjs/charts/storyline/interface.js.map +1 -1
- package/cjs/charts/storyline/layout.d.ts +0 -1
- package/cjs/charts/storyline/layout.js +4 -27
- package/cjs/charts/storyline/layout.js.map +1 -1
- package/cjs/charts/storyline/layouts/arc.js +0 -1
- package/cjs/charts/storyline/layouts/arc.js.map +1 -1
- package/cjs/charts/storyline/layouts/clock.js +0 -1
- package/cjs/charts/storyline/layouts/clock.js.map +1 -1
- package/cjs/charts/storyline/layouts/common.d.ts +0 -2
- package/cjs/charts/storyline/layouts/common.js +6 -11
- package/cjs/charts/storyline/layouts/common.js.map +1 -1
- package/cjs/charts/storyline/layouts/default.js +0 -1
- package/cjs/charts/storyline/layouts/default.js.map +1 -1
- package/cjs/charts/storyline/layouts/landscape.js +4 -5
- package/cjs/charts/storyline/layouts/landscape.js.map +1 -1
- package/cjs/charts/storyline/layouts/portrait.js +0 -1
- package/cjs/charts/storyline/layouts/portrait.js.map +1 -1
- package/cjs/charts/storyline/layouts/wing.js +51 -10
- package/cjs/charts/storyline/layouts/wing.js.map +1 -1
- package/cjs/charts/storyline/storyline-transformer.js +6 -22
- 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 -2
- 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 +1 -2
- 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 -1
- 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/bar-3d/constant.js +2 -1
- package/esm/charts/candlestick/candlestick.js +1 -2
- 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 +2 -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/funnel-3d/series.js +2 -1
- 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/interface.d.ts +2 -4
- package/esm/charts/storyline/interface.js.map +1 -1
- package/esm/charts/storyline/layout.d.ts +0 -1
- package/esm/charts/storyline/layout.js +4 -27
- package/esm/charts/storyline/layout.js.map +1 -1
- package/esm/charts/storyline/layouts/arc.js +0 -1
- package/esm/charts/storyline/layouts/arc.js.map +1 -1
- package/esm/charts/storyline/layouts/clock.js +0 -1
- package/esm/charts/storyline/layouts/clock.js.map +1 -1
- package/esm/charts/storyline/layouts/common.d.ts +0 -2
- package/esm/charts/storyline/layouts/common.js +3 -8
- package/esm/charts/storyline/layouts/common.js.map +1 -1
- package/esm/charts/storyline/layouts/default.js +0 -1
- package/esm/charts/storyline/layouts/default.js.map +1 -1
- package/esm/charts/storyline/layouts/landscape.js +4 -5
- package/esm/charts/storyline/layouts/landscape.js.map +1 -1
- package/esm/charts/storyline/layouts/portrait.js +0 -1
- package/esm/charts/storyline/layouts/portrait.js.map +1 -1
- package/esm/charts/storyline/layouts/wing.js +50 -9
- package/esm/charts/storyline/layouts/wing.js.map +1 -1
- package/esm/charts/storyline/storyline-transformer.js +6 -21
- 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 -2
- 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 +1 -2
- 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
- package/cjs/charts/storyline/layouts/ladder.d.ts +0 -5
- package/cjs/charts/storyline/layouts/ladder.js +0 -230
- package/cjs/charts/storyline/layouts/ladder.js.map +0 -1
- package/esm/charts/storyline/layouts/ladder.d.ts +0 -5
- package/esm/charts/storyline/layouts/ladder.js +0 -217
- package/esm/charts/storyline/layouts/ladder.js.map +0 -1
package/build/index.js
CHANGED
|
@@ -5855,12 +5855,11 @@
|
|
|
5855
5855
|
return layout;
|
|
5856
5856
|
};
|
|
5857
5857
|
const computeStorylineLayout = (data, options) => {
|
|
5858
|
-
var _a, _b
|
|
5858
|
+
var _a, _b;
|
|
5859
5859
|
const layout = normalizeLayout(options.layout);
|
|
5860
5860
|
const padding = normalizePadding((_a = layout.padding) !== null && _a !== void 0 ? _a : options.padding);
|
|
5861
|
-
const
|
|
5862
|
-
const
|
|
5863
|
-
const blocks = computeBlockPositions(data, layout, options.viewBox, options.block, padding, gap);
|
|
5861
|
+
const lineDistance = (_b = options.lineDistance) !== null && _b !== void 0 ? _b : 8;
|
|
5862
|
+
const blocks = computeBlockPositions(data, layout, options.viewBox, options.block, padding);
|
|
5864
5863
|
const circleGuide = layout.type === 'clock' ? computeClockCircleGuide(options.viewBox, options.block, padding, layout) : undefined;
|
|
5865
5864
|
return {
|
|
5866
5865
|
blocks,
|
|
@@ -5868,7 +5867,7 @@
|
|
|
5868
5867
|
circleGuide
|
|
5869
5868
|
};
|
|
5870
5869
|
};
|
|
5871
|
-
const computeBlockPositions = (data, layout, viewBox, block, padding
|
|
5870
|
+
const computeBlockPositions = (data, layout, viewBox, block, padding) => {
|
|
5872
5871
|
const count = data.length;
|
|
5873
5872
|
if (!count) {
|
|
5874
5873
|
return [];
|
|
@@ -5888,34 +5887,6 @@
|
|
|
5888
5887
|
case 'portrait':
|
|
5889
5888
|
centers = lineCenters(count, center.x, inner.y + block.height / 2, center.x, inner.y + inner.height - block.height / 2);
|
|
5890
5889
|
break;
|
|
5891
|
-
case 'ladder': {
|
|
5892
|
-
const isDown = layout.direction === 'down';
|
|
5893
|
-
const x0 = inner.x + block.width / 2;
|
|
5894
|
-
const x1 = inner.x + inner.width - block.width / 2;
|
|
5895
|
-
const yTop = inner.y + block.height / 2;
|
|
5896
|
-
const yBot = inner.y + inner.height - block.height / 2;
|
|
5897
|
-
const y0 = isDown ? yTop : yBot;
|
|
5898
|
-
const y1 = isDown ? yBot : yTop;
|
|
5899
|
-
const anchors = lineCenters(count, x0, y0, x1, y1);
|
|
5900
|
-
const dx = x1 - x0;
|
|
5901
|
-
const dy = y1 - y0;
|
|
5902
|
-
const len = Math.hypot(dx, dy) || 1;
|
|
5903
|
-
const nx = -dy / len;
|
|
5904
|
-
const ny = dx / len;
|
|
5905
|
-
const headlineFontSize = Math.max(80, Math.min(240, Math.round(inner.height * 0.42)));
|
|
5906
|
-
const offset = headlineFontSize * 1.2;
|
|
5907
|
-
centers = anchors.map((p, i) => {
|
|
5908
|
-
const sign = i % 2 === 0 ? 1 : -1;
|
|
5909
|
-
return {
|
|
5910
|
-
x: p.x + nx * offset * sign,
|
|
5911
|
-
y: p.y + ny * offset * sign
|
|
5912
|
-
};
|
|
5913
|
-
});
|
|
5914
|
-
break;
|
|
5915
|
-
}
|
|
5916
|
-
case 'spiral':
|
|
5917
|
-
centers = alternatingVerticalCenters(count, inner, block, gap);
|
|
5918
|
-
break;
|
|
5919
5890
|
case 'clock':
|
|
5920
5891
|
centers = circularCenters(count, viewBox, block, padding, layout);
|
|
5921
5892
|
break;
|
|
@@ -5962,15 +5933,6 @@
|
|
|
5962
5933
|
};
|
|
5963
5934
|
});
|
|
5964
5935
|
};
|
|
5965
|
-
const alternatingVerticalCenters = (count, inner, block, gap) => {
|
|
5966
|
-
const baseX = inner.x + inner.width / 2;
|
|
5967
|
-
const offset = Math.min(Math.max(block.width * 0.65 + gap / 2, 0), Math.max((inner.width - block.width) / 2, 0));
|
|
5968
|
-
const points = lineCenters(count, baseX, inner.y + block.height / 2, baseX, inner.y + inner.height - block.height / 2);
|
|
5969
|
-
return points.map((point, index) => ({
|
|
5970
|
-
x: point.x + (index % 2 === 0 ? -offset : offset),
|
|
5971
|
-
y: point.y
|
|
5972
|
-
}));
|
|
5973
|
-
};
|
|
5974
5936
|
const circularCenters = (count, viewBox, block, padding, layout) => {
|
|
5975
5937
|
var _a;
|
|
5976
5938
|
const guide = computeClockCircleGuide(viewBox, block, padding, layout);
|
|
@@ -6073,7 +6035,6 @@
|
|
|
6073
6035
|
const DEFAULT_BLOCK_WIDTH = 180;
|
|
6074
6036
|
const DEFAULT_BLOCK_HEIGHT = 400;
|
|
6075
6037
|
const DEFAULT_BLOCK_WIDTH_RATIO = 0.24;
|
|
6076
|
-
const DEFAULT_BLOCK_GAP = 36;
|
|
6077
6038
|
const DEFAULT_IMAGE_WIDTH = 48;
|
|
6078
6039
|
const DEFAULT_IMAGE_HEIGHT = 48;
|
|
6079
6040
|
const DEFAULT_IMAGE_GAP = 10;
|
|
@@ -6089,12 +6050,11 @@
|
|
|
6089
6050
|
const isClock = (spec) => normalizeLayout(spec.layout).type === 'clock';
|
|
6090
6051
|
const isArc = (spec) => normalizeLayout(spec.layout).type === 'arc';
|
|
6091
6052
|
const isWing = (spec) => normalizeLayout(spec.layout).type === 'wing';
|
|
6092
|
-
const isLadder = (spec) => normalizeLayout(spec.layout).type === 'ladder';
|
|
6093
6053
|
const getThemeColor = (spec) => { var _a; return (_a = spec.themeColor) !== null && _a !== void 0 ? _a : DEFAULT_THEME_COLOR; };
|
|
6094
6054
|
const shouldShowImageBackground = (spec) => { var _a, _b; return (_b = (_a = spec.image) === null || _a === void 0 ? void 0 : _a.showBackground) !== null && _b !== void 0 ? _b : !(isPortrait(spec) || isLandscape(spec)); };
|
|
6095
6055
|
const TITLE_FONT_SCALE_ID = 'storylineTitleFontSize';
|
|
6096
6056
|
const MARKER_FONT_SCALE_ID = 'storylineMarkerFontSize';
|
|
6097
|
-
const clamp$
|
|
6057
|
+
const clamp$2 = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
6098
6058
|
const getTextWeight = (text) => {
|
|
6099
6059
|
if (!text) {
|
|
6100
6060
|
return 4;
|
|
@@ -6143,7 +6103,7 @@
|
|
|
6143
6103
|
? ((options.boxWidth * BLOCK_TITLE_MAX_LINES) / textWeight) * 0.96
|
|
6144
6104
|
: Number.POSITIVE_INFINITY;
|
|
6145
6105
|
const boxHeightLimit = options.boxHeight && options.boxHeight > 0 ? options.boxHeight / Math.max(textWeight, 1) : Number.POSITIVE_INFINITY;
|
|
6146
|
-
return Math.floor(clamp$
|
|
6106
|
+
return Math.floor(clamp$2(Math.min(adaptiveSize, boxWidthLimit, boxHeightLimit), minFontSize, maxFontSize));
|
|
6147
6107
|
};
|
|
6148
6108
|
const resolveAdaptiveLineHeight = (fontSize, style, fallback, ratio = 1.35) => { var _a; return Number((_a = style === null || style === void 0 ? void 0 : style.lineHeight) !== null && _a !== void 0 ? _a : Math.round((Number.isFinite(fontSize) ? fontSize : fallback) * ratio)); };
|
|
6149
6109
|
const resolveTitleFontSize = (spec, ctx, title, boxWidth, fallback, range = [16, 34]) => {
|
|
@@ -6285,7 +6245,7 @@
|
|
|
6285
6245
|
};
|
|
6286
6246
|
};
|
|
6287
6247
|
const getLayout = (spec, ctx) => {
|
|
6288
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p
|
|
6248
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
6289
6249
|
const { width, height, startX, startY } = getRegionGeometry(ctx, spec);
|
|
6290
6250
|
let blockWidth = resolveBlockWidth(spec, width);
|
|
6291
6251
|
let blockHeight = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : (isLandscape(spec) ? 320 : DEFAULT_BLOCK_HEIGHT);
|
|
@@ -6317,9 +6277,8 @@
|
|
|
6317
6277
|
width: blockWidth,
|
|
6318
6278
|
height: blockHeight
|
|
6319
6279
|
},
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
lineDistance: (_r = spec.line) === null || _r === void 0 ? void 0 : _r.distance
|
|
6280
|
+
padding: (_o = spec.block) === null || _o === void 0 ? void 0 : _o.padding,
|
|
6281
|
+
lineDistance: (_p = spec.line) === null || _p === void 0 ? void 0 : _p.distance
|
|
6323
6282
|
});
|
|
6324
6283
|
if (!startX && !startY) {
|
|
6325
6284
|
return result;
|
|
@@ -6584,7 +6543,7 @@
|
|
|
6584
6543
|
}
|
|
6585
6544
|
},
|
|
6586
6545
|
block.title
|
|
6587
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-clock-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getClockTextRect(spec, ctx, index).x, y: (_d, ctx) => getClockTextRect(spec, ctx, index).anchorY - getTitleHeight(ctx), text: block.title,
|
|
6546
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-clock-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getClockTextRect(spec, ctx, index).x, y: (_d, ctx) => getClockTextRect(spec, ctx, index).anchorY - getTitleHeight(ctx), text: block.title, height: (_d, ctx) => getTitleHeight(ctx), heightLimit: (_d, ctx) => getTitleLineHeight(ctx) * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_d, ctx) => getTitleFontSize(ctx), lineHeight: (_d, ctx) => getTitleLineHeight(ctx), fontWeight: 'bold', fill: themeColor, stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_b = spec.title) === null || _b === void 0 ? void 0 : _b.style) })
|
|
6588
6547
|
: null,
|
|
6589
6548
|
contentText.length
|
|
6590
6549
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-clock-content-${index}`, interactive: false }, spec.content), { style: Object.assign({ x: (_d, ctx) => getClockTextRect(spec, ctx, index).x, y: (_d, ctx) => getClockTextRect(spec, ctx, index).anchorY + 4, width: (_d, ctx) => getClockTextRect(spec, ctx, index).width, height: CLOCK_CONTENT_LINE_HEIGHT * CLOCK_CONTENT_LINES, maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width, heightLimit: CLOCK_CONTENT_LINE_HEIGHT * CLOCK_CONTENT_LINES, text: buildPlainContent(contentText), fontSize: CLOCK_CONTENT_FONT_SIZE, lineHeight: CLOCK_CONTENT_LINE_HEIGHT, fill: '#3a3f4d', textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word' }, (_c = spec.content) === null || _c === void 0 ? void 0 : _c.style) })
|
|
@@ -6690,7 +6649,7 @@
|
|
|
6690
6649
|
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.y, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.height, image: block.image }, (_e = spec.image) === null || _e === void 0 ? void 0 : _e.style) })
|
|
6691
6650
|
: null,
|
|
6692
6651
|
block.title
|
|
6693
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.y, text: block.title,
|
|
6652
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.y, text: block.title, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleHeight, heightLimit: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleFontSize, lineHeight: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_f = spec.title) === null || _f === void 0 ? void 0 : _f.style) })
|
|
6694
6653
|
: null,
|
|
6695
6654
|
contentText.length
|
|
6696
6655
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.y, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.height, text: buildPlainContent(contentText), maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.height, fontSize: 16, lineHeight: 23, textAlign: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) })
|
|
@@ -6740,7 +6699,6 @@
|
|
|
6740
6699
|
|
|
6741
6700
|
const LANDSCAPE_IMAGE_HEIGHT_RATIO = 0.42;
|
|
6742
6701
|
const LANDSCAPE_CONNECTOR_GAP = 8;
|
|
6743
|
-
const LANDSCAPE_CONNECTOR_ARROW_SIZE = 9;
|
|
6744
6702
|
const LANDSCAPE_CONNECTOR_X_RATIO = 0.2;
|
|
6745
6703
|
const LANDSCAPE_TEXT_GAP_FROM_CONNECTOR = 12;
|
|
6746
6704
|
const LANDSCAPE_TITLE_LINE_HEIGHT = 34;
|
|
@@ -6975,23 +6933,18 @@
|
|
|
6975
6933
|
stroke: connectorStroke,
|
|
6976
6934
|
lineWidth: connectorLineWidth,
|
|
6977
6935
|
lineDash: connectorDash,
|
|
6978
|
-
fill:
|
|
6936
|
+
fill: false,
|
|
6979
6937
|
path: (_d, ctx) => {
|
|
6980
6938
|
const m = getMetrics(ctx);
|
|
6981
|
-
const tipSize = LANDSCAPE_CONNECTOR_ARROW_SIZE;
|
|
6982
6939
|
const x = m.connector.x1;
|
|
6983
6940
|
const y0 = m.connector.y1;
|
|
6984
6941
|
const y1 = m.connector.y2;
|
|
6985
|
-
|
|
6986
|
-
const baseY = y1 - tipDir * tipSize;
|
|
6987
|
-
const dashLine = `M ${x} ${y0} L ${x} ${baseY}`;
|
|
6988
|
-
const triangle = `M ${x - tipSize / 2} ${baseY} L ${x + tipSize / 2} ${baseY} L ${x} ${y1} Z`;
|
|
6989
|
-
return `${dashLine} ${triangle}`;
|
|
6942
|
+
return `M ${x} ${y0} L ${x} ${y1}`;
|
|
6990
6943
|
}
|
|
6991
6944
|
}
|
|
6992
6945
|
},
|
|
6993
6946
|
block.title
|
|
6994
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textBox.x, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title,
|
|
6947
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textBox.x, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title, height: (_d, ctx) => getMetrics(ctx).titleHeight, heightLimit: (_d, ctx) => getMetrics(ctx).titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_d, ctx) => getMetrics(ctx).titleFontSize, lineHeight: (_d, ctx) => getMetrics(ctx).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_l = spec.title) === null || _l === void 0 ? void 0 : _l.style) })
|
|
6995
6948
|
: null,
|
|
6996
6949
|
contentText.length
|
|
6997
6950
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).contentBox.x, y: (_d, ctx) => getMetrics(ctx).contentBox.y, width: (_d, ctx) => getMetrics(ctx).contentBox.width, height: (_d, ctx) => getMetrics(ctx).contentBox.height, maxLineWidth: (_d, ctx) => getMetrics(ctx).contentBox.width, heightLimit: (_d, ctx) => getMetrics(ctx).contentBox.height, text: buildPlainContent(contentText), fontSize: (_d, ctx) => getMetrics(ctx).contentFontSize, lineHeight: (_d, ctx) => getMetrics(ctx).contentLineHeight, textAlign: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_m = spec.content) === null || _m === void 0 ? void 0 : _m.style) })
|
|
@@ -7234,7 +7187,7 @@
|
|
|
7234
7187
|
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, (_e = spec.image) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7235
7188
|
: null,
|
|
7236
7189
|
block.title
|
|
7237
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textBox.x, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title,
|
|
7190
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textBox.x, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title, height: (_d, ctx) => getMetrics(ctx).titleHeight, heightLimit: (_d, ctx) => getMetrics(ctx).titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_d, ctx) => getMetrics(ctx).titleFontSize, lineHeight: (_d, ctx) => getMetrics(ctx).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_f = spec.title) === null || _f === void 0 ? void 0 : _f.style) })
|
|
7238
7191
|
: null,
|
|
7239
7192
|
contentText.length
|
|
7240
7193
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).contentBox.x, y: (_d, ctx) => getMetrics(ctx).contentBox.y, width: (_d, ctx) => getMetrics(ctx).contentBox.width, height: (_d, ctx) => getMetrics(ctx).contentBox.height, maxLineWidth: (_d, ctx) => getMetrics(ctx).contentBox.width, heightLimit: (_d, ctx) => getMetrics(ctx).contentBox.height, text: buildPlainContent(contentText), fontSize: PORTRAIT_CONTENT_FONT_SIZE, lineHeight: PORTRAIT_CONTENT_LINE_HEIGHT, textAlign: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) })
|
|
@@ -7262,7 +7215,7 @@
|
|
|
7262
7215
|
const ARC_TITLE_IMAGE_HEIGHT_RATIO = 0.34;
|
|
7263
7216
|
const ARC_GAP_FROM_TITLE_IMAGE = 200;
|
|
7264
7217
|
const ARC_FIT_MARGIN = 8;
|
|
7265
|
-
const clamp = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
7218
|
+
const clamp$1 = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
7266
7219
|
const isDownArc = (spec) => normalizeLayout(spec.layout).direction === 'down';
|
|
7267
7220
|
const getArcTitleImageRect = (spec, ctx) => {
|
|
7268
7221
|
var _a, _b, _c, _e;
|
|
@@ -7473,25 +7426,25 @@
|
|
|
7473
7426
|
const regionWidth = Math.max((_c = region === null || region === void 0 ? void 0 : region.width) !== null && _c !== void 0 ? _c : Number((_e = spec.width) !== null && _e !== void 0 ? _e : ARC_BLOCK_IMAGE_SIZE * count), 1);
|
|
7474
7427
|
const regionHeight = Math.max((_f = region === null || region === void 0 ? void 0 : region.height) !== null && _f !== void 0 ? _f : Number((_g = spec.height) !== null && _g !== void 0 ? _g : ARC_TEXT_BOX_HEIGHT), 1);
|
|
7475
7428
|
const slotWidth = regionWidth / (count + 1);
|
|
7476
|
-
const imageScale = clamp(Math.min(regionWidth / Math.max(count * ARC_BLOCK_IMAGE_SIZE * 0.92, 1), regionHeight / 620), 0.42, 1);
|
|
7477
|
-
const textScale = clamp(Math.min(slotWidth / 180, imageScale), 0.48, 1);
|
|
7429
|
+
const imageScale = clamp$1(Math.min(regionWidth / Math.max(count * ARC_BLOCK_IMAGE_SIZE * 0.92, 1), regionHeight / 620), 0.42, 1);
|
|
7430
|
+
const textScale = clamp$1(Math.min(slotWidth / 180, imageScale), 0.48, 1);
|
|
7478
7431
|
const styleContent = (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style;
|
|
7479
7432
|
const contentFontSize = Number((_j = styleContent === null || styleContent === void 0 ? void 0 : styleContent.fontSize) !== null && _j !== void 0 ? _j : Math.round(ARC_CONTENT_FONT_SIZE * textScale));
|
|
7480
7433
|
const contentLineHeight = Number((_k = styleContent === null || styleContent === void 0 ? void 0 : styleContent.lineHeight) !== null && _k !== void 0 ? _k : Math.round(Math.max(contentFontSize * 1.35, ARC_CONTENT_LINE_HEIGHT * textScale)));
|
|
7481
7434
|
const titleToContentGap = ARC_TITLE_TO_CONTENT_GAP;
|
|
7482
7435
|
const configuredImageDiameter = Math.max((_m = (_l = spec.image) === null || _l === void 0 ? void 0 : _l.width) !== null && _m !== void 0 ? _m : ARC_BLOCK_IMAGE_SIZE, (_p = (_o = spec.image) === null || _o === void 0 ? void 0 : _o.height) !== null && _p !== void 0 ? _p : ARC_BLOCK_IMAGE_SIZE);
|
|
7483
|
-
const imageDiameter = Math.round(clamp(configuredImageDiameter * imageScale, 64, configuredImageDiameter));
|
|
7436
|
+
const imageDiameter = Math.round(clamp$1(configuredImageDiameter * imageScale, 64, configuredImageDiameter));
|
|
7484
7437
|
const imageWidth = imageDiameter;
|
|
7485
7438
|
const imageHeight = imageDiameter;
|
|
7486
7439
|
const isDown = isDownArc(spec);
|
|
7487
7440
|
const configuredTextWidth = Number((_r = (_q = spec.block) === null || _q === void 0 ? void 0 : _q.width) !== null && _r !== void 0 ? _r : ARC_TEXT_BOX_MAX_WIDTH);
|
|
7488
7441
|
const defaultTextWidth = Math.round(slotWidth * 0.96);
|
|
7489
7442
|
const minTextWidth = Math.min(ARC_TEXT_BOX_MIN_WIDTH, Math.max(Math.round(slotWidth * 0.72), ARC_TEXT_BOX_ABSOLUTE_MIN_WIDTH));
|
|
7490
|
-
const textBoxWidth = Math.round(clamp(Math.min(configuredTextWidth, defaultTextWidth), minTextWidth, ARC_TEXT_BOX_MAX_WIDTH));
|
|
7443
|
+
const textBoxWidth = Math.round(clamp$1(Math.min(configuredTextWidth, defaultTextWidth), minTextWidth, ARC_TEXT_BOX_MAX_WIDTH));
|
|
7491
7444
|
const titleFontSize = resolveTitleFontSize(spec, ctx, (_t = (_s = spec.data) === null || _s === void 0 ? void 0 : _s[index]) === null || _t === void 0 ? void 0 : _t.title, textBoxWidth, Math.round(ARC_TITLE_FONT_SIZE * textScale), [10, 40]);
|
|
7492
7445
|
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_u = spec.title) === null || _u === void 0 ? void 0 : _u.style, ARC_TITLE_LINE_HEIGHT);
|
|
7493
7446
|
const titleHeight = getBlockTitleHeight(titleLineHeight, (_w = (_v = spec.data) === null || _v === void 0 ? void 0 : _v[index]) === null || _w === void 0 ? void 0 : _w.title, textBoxWidth, titleFontSize);
|
|
7494
|
-
const textHeight = Math.round(clamp(ARC_TEXT_BOX_HEIGHT * textScale, 88, ARC_TEXT_BOX_HEIGHT));
|
|
7447
|
+
const textHeight = Math.round(clamp$1(ARC_TEXT_BOX_HEIGHT * textScale, 88, ARC_TEXT_BOX_HEIGHT));
|
|
7495
7448
|
const contentHeight = Math.max(textHeight - titleHeight - titleToContentGap, contentLineHeight);
|
|
7496
7449
|
const isLeftSide = index < count / 2;
|
|
7497
7450
|
const textAlign = isLeftSide ? 'right' : 'left';
|
|
@@ -7598,7 +7551,7 @@
|
|
|
7598
7551
|
}
|
|
7599
7552
|
: null,
|
|
7600
7553
|
block.title
|
|
7601
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 5 }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textAnchorX, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title,
|
|
7554
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 5 }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textAnchorX, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title, height: (_d, ctx) => getMetrics(ctx).titleLineHeight * BLOCK_TITLE_MAX_LINES, heightLimit: (_d, ctx) => getMetrics(ctx).titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_d, ctx) => getMetrics(ctx).titleFontSize, lineHeight: (_d, ctx) => getMetrics(ctx).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: (_d, ctx) => getMetrics(ctx).textAlign, textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7602
7555
|
: null,
|
|
7603
7556
|
contentText.length
|
|
7604
7557
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 4 }, spec.content), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textAnchorX, y: (_d, ctx) => getMetrics(ctx).contentBox.y, width: (_d, ctx) => getMetrics(ctx).contentBox.width, height: (_d, ctx) => getMetrics(ctx).contentBox.height, maxLineWidth: (_d, ctx) => getMetrics(ctx).contentBox.width, heightLimit: (_d, ctx) => getMetrics(ctx).contentBox.height, text: buildPlainContent(contentText), fontSize: (_d, ctx) => getMetrics(ctx).contentFontSize, lineHeight: (_d, ctx) => getMetrics(ctx).contentLineHeight, textAlign: (_d, ctx) => getMetrics(ctx).textAlign, textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) })
|
|
@@ -7617,9 +7570,35 @@
|
|
|
7617
7570
|
const WING_TITLE_TO_CONTENT_GAP = 4;
|
|
7618
7571
|
const WING_TITLE_IMAGE_WIDTH_RATIO = 0.6;
|
|
7619
7572
|
const WING_TITLE_IMAGE_MAX_WIDTH = 820;
|
|
7573
|
+
const WING_DEFAULT_PATH_END_WIDTH = 350;
|
|
7574
|
+
const WING_IMAGE_MIN_SCALE = 0.52;
|
|
7575
|
+
const WING_IMAGE_MAX_SCALE = 1.2;
|
|
7576
|
+
const WING_BOTTOM_TEXT_IMAGE_GAP_RATIO = 1.35;
|
|
7577
|
+
const clamp = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
7620
7578
|
const getWingDirection = (spec) => {
|
|
7621
7579
|
return normalizeLayout(spec.layout).direction === 'right' ? 'right' : 'left';
|
|
7622
7580
|
};
|
|
7581
|
+
const getWingPathWidthRange = (spec) => {
|
|
7582
|
+
var _a, _b, _c, _e, _f;
|
|
7583
|
+
const lineStyle = ((_b = (_a = spec.line) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {});
|
|
7584
|
+
const startWidth = Math.max(Number((_c = lineStyle.startWidth) !== null && _c !== void 0 ? _c : 50), 0.5);
|
|
7585
|
+
const endWidth = Math.max(Number((_f = (_e = lineStyle.endWidth) !== null && _e !== void 0 ? _e : lineStyle.lineWidth) !== null && _f !== void 0 ? _f : WING_DEFAULT_PATH_END_WIDTH), startWidth);
|
|
7586
|
+
return { startWidth, endWidth };
|
|
7587
|
+
};
|
|
7588
|
+
const getWingBlockPathRatio = (spec, index) => {
|
|
7589
|
+
var _a, _b;
|
|
7590
|
+
const count = (_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
7591
|
+
if (count <= 1) {
|
|
7592
|
+
return 0.5;
|
|
7593
|
+
}
|
|
7594
|
+
return index / (count - 1);
|
|
7595
|
+
};
|
|
7596
|
+
const getWingBlockImageScale = (spec, index) => {
|
|
7597
|
+
const { startWidth, endWidth } = getWingPathWidthRange(spec);
|
|
7598
|
+
const startScale = clamp(startWidth / WING_DEFAULT_PATH_END_WIDTH, WING_IMAGE_MIN_SCALE, WING_IMAGE_MAX_SCALE);
|
|
7599
|
+
const endScale = clamp(endWidth / WING_DEFAULT_PATH_END_WIDTH, WING_IMAGE_MIN_SCALE, WING_IMAGE_MAX_SCALE);
|
|
7600
|
+
return startScale + (endScale - startScale) * getWingBlockPathRatio(spec, index);
|
|
7601
|
+
};
|
|
7623
7602
|
const getWingArcGeometry = (spec, ctx) => {
|
|
7624
7603
|
var _a, _b, _c;
|
|
7625
7604
|
const { width, height, startX, startY } = getRegionGeometry(ctx);
|
|
@@ -7652,15 +7631,31 @@
|
|
|
7652
7631
|
y: arc.cy + Math.sin(angle) * arc.ry
|
|
7653
7632
|
};
|
|
7654
7633
|
};
|
|
7634
|
+
const isWingBottomBlock = (spec, ctx, index) => {
|
|
7635
|
+
var _a, _b;
|
|
7636
|
+
const count = (_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
7637
|
+
if (count <= 0) {
|
|
7638
|
+
return false;
|
|
7639
|
+
}
|
|
7640
|
+
let bottomIndex = 0;
|
|
7641
|
+
let bottomY = Number.NEGATIVE_INFINITY;
|
|
7642
|
+
for (let i = 0; i < count; i++) {
|
|
7643
|
+
const center = getWingBlockCenter(spec, ctx, i);
|
|
7644
|
+
if (center.y > bottomY) {
|
|
7645
|
+
bottomY = center.y;
|
|
7646
|
+
bottomIndex = i;
|
|
7647
|
+
}
|
|
7648
|
+
}
|
|
7649
|
+
return index === bottomIndex;
|
|
7650
|
+
};
|
|
7655
7651
|
const buildWingArcMark = (spec) => {
|
|
7656
|
-
var _a, _b, _c, _e, _f
|
|
7652
|
+
var _a, _b, _c, _e, _f;
|
|
7657
7653
|
if (((_a = spec.line) === null || _a === void 0 ? void 0 : _a.visible) === false) {
|
|
7658
7654
|
return null;
|
|
7659
7655
|
}
|
|
7660
7656
|
const themeColor = getThemeColor(spec);
|
|
7661
7657
|
const lineStyle = ((_c = (_b = spec.line) === null || _b === void 0 ? void 0 : _b.style) !== null && _c !== void 0 ? _c : {});
|
|
7662
|
-
const startWidth
|
|
7663
|
-
const endWidth = Math.max(Number((_g = (_f = lineStyle.endWidth) !== null && _f !== void 0 ? _f : lineStyle.lineWidth) !== null && _g !== void 0 ? _g : 350), startWidth);
|
|
7658
|
+
const { startWidth, endWidth } = getWingPathWidthRange(spec);
|
|
7664
7659
|
return {
|
|
7665
7660
|
type: 'group',
|
|
7666
7661
|
name: 'storyline-wing-arc',
|
|
@@ -7673,7 +7668,7 @@
|
|
|
7673
7668
|
style: {
|
|
7674
7669
|
stroke: false,
|
|
7675
7670
|
lineWidth: 0,
|
|
7676
|
-
fill: (
|
|
7671
|
+
fill: (_f = (_e = lineStyle.fill) !== null && _e !== void 0 ? _e : lineStyle.stroke) !== null && _f !== void 0 ? _f : themeColor,
|
|
7677
7672
|
opacity: 0.95,
|
|
7678
7673
|
path: (_d, ctx) => {
|
|
7679
7674
|
const arc = getWingArcGeometry(spec, ctx);
|
|
@@ -7763,8 +7758,9 @@
|
|
|
7763
7758
|
const titleToContentGap = WING_TITLE_TO_CONTENT_GAP;
|
|
7764
7759
|
const textHeight = WING_TEXT_BOX_HEIGHT;
|
|
7765
7760
|
const contentHeight = 100000;
|
|
7766
|
-
const
|
|
7767
|
-
const
|
|
7761
|
+
const imageScale = getWingBlockImageScale(spec, index);
|
|
7762
|
+
const imageWidth = Math.round(Number((_p = (_o = spec.image) === null || _o === void 0 ? void 0 : _o.width) !== null && _p !== void 0 ? _p : WING_BLOCK_IMAGE_SIZE) * imageScale);
|
|
7763
|
+
const imageHeight = Math.round(Number((_r = (_q = spec.image) === null || _q === void 0 ? void 0 : _q.height) !== null && _r !== void 0 ? _r : WING_BLOCK_IMAGE_SIZE) * imageScale);
|
|
7768
7764
|
const imageBox = {
|
|
7769
7765
|
x: -imageWidth / 2,
|
|
7770
7766
|
y: -imageHeight / 2,
|
|
@@ -7774,14 +7770,35 @@
|
|
|
7774
7770
|
const direction = getWingDirection(spec);
|
|
7775
7771
|
const count = (_t = (_s = spec.data) === null || _s === void 0 ? void 0 : _s.length) !== null && _t !== void 0 ? _t : 0;
|
|
7776
7772
|
const isSpecialBelow = (direction === 'right' && count > 0 && index === count - 1) || (direction === 'left' && index === 0);
|
|
7777
|
-
const
|
|
7773
|
+
const isBottomAbove = isWingBottomBlock(spec, ctx, index);
|
|
7774
|
+
const isVerticalLayout = isBottomAbove || isSpecialBelow;
|
|
7778
7775
|
const textWidth = WING_TEXT_BOX_WIDTH;
|
|
7779
7776
|
let textBox;
|
|
7780
7777
|
let contentBox;
|
|
7781
7778
|
let connectorBox;
|
|
7782
7779
|
let onLeft;
|
|
7783
7780
|
let verticalAlign;
|
|
7784
|
-
if (
|
|
7781
|
+
if (isBottomAbove) {
|
|
7782
|
+
const bottomTextImageGap = Math.round(WING_TEXT_IMAGE_GAP * WING_BOTTOM_TEXT_IMAGE_GAP_RATIO);
|
|
7783
|
+
const textX = -textWidth / 2;
|
|
7784
|
+
const textY = -imageHeight / 2 - bottomTextImageGap - textHeight;
|
|
7785
|
+
textBox = { x: textX, y: textY, width: textWidth, height: textHeight };
|
|
7786
|
+
contentBox = {
|
|
7787
|
+
x: textX,
|
|
7788
|
+
y: textY + titleHeight + titleToContentGap,
|
|
7789
|
+
width: textWidth,
|
|
7790
|
+
height: contentHeight
|
|
7791
|
+
};
|
|
7792
|
+
connectorBox = {
|
|
7793
|
+
x: -1,
|
|
7794
|
+
y: textY + textHeight,
|
|
7795
|
+
width: 2,
|
|
7796
|
+
height: bottomTextImageGap
|
|
7797
|
+
};
|
|
7798
|
+
onLeft = false;
|
|
7799
|
+
verticalAlign = 'above';
|
|
7800
|
+
}
|
|
7801
|
+
else if (isVerticalLayout) {
|
|
7785
7802
|
const textX = -textWidth / 2;
|
|
7786
7803
|
const textY = imageHeight / 2 + WING_TEXT_IMAGE_GAP;
|
|
7787
7804
|
textBox = { x: textX, y: textY, width: textWidth, height: textHeight };
|
|
@@ -7889,7 +7906,7 @@
|
|
|
7889
7906
|
return m.textBox.x + m.textBox.width / 2;
|
|
7890
7907
|
}
|
|
7891
7908
|
return m.onLeft ? m.textBox.x + m.textBox.width : m.textBox.x;
|
|
7892
|
-
}, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.y, text: block.title,
|
|
7909
|
+
}, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.y, text: block.title, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleHeight, heightLimit: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleFontSize, lineHeight: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleLineHeight, fontWeight: 'bold', fill: themeColor, stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: (_d, ctx) => {
|
|
7893
7910
|
const m = getWingBlockMetrics(spec, ctx, index);
|
|
7894
7911
|
if (m.verticalAlign) {
|
|
7895
7912
|
return 'center';
|
|
@@ -7916,194 +7933,6 @@
|
|
|
7916
7933
|
};
|
|
7917
7934
|
};
|
|
7918
7935
|
|
|
7919
|
-
const LADDER_HEADLINE_FONT_RATIO = 0.42;
|
|
7920
|
-
const LADDER_HEADLINE_FONT_MIN = 80;
|
|
7921
|
-
const LADDER_HEADLINE_FONT_MAX = 240;
|
|
7922
|
-
const LADDER_DIAGONAL_LINE_WIDTH = 2;
|
|
7923
|
-
const LADDER_DIAGONAL_DASH = [12, 8];
|
|
7924
|
-
const LADDER_BLOCK_IMAGE_SIZE = 100;
|
|
7925
|
-
const LADDER_TITLE_FONT_SIZE = 28;
|
|
7926
|
-
const LADDER_TITLE_LINE_HEIGHT = 26;
|
|
7927
|
-
const LADDER_CONTENT_FONT_SIZE = 16;
|
|
7928
|
-
const LADDER_CONTENT_LINE_HEIGHT = 23;
|
|
7929
|
-
const isDownLadder = (spec) => normalizeLayout(spec.layout).direction === 'down';
|
|
7930
|
-
const getLadderDiagonalGeometry = (spec, ctx) => {
|
|
7931
|
-
var _a;
|
|
7932
|
-
const { width, height, startX, startY } = getRegionGeometry(ctx);
|
|
7933
|
-
const padding = normalizePadding((_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding);
|
|
7934
|
-
const innerX = startX + padding.left;
|
|
7935
|
-
const innerY = startY + padding.top;
|
|
7936
|
-
const innerW = Math.max(width - padding.left - padding.right, 1);
|
|
7937
|
-
const innerH = Math.max(height - padding.top - padding.bottom, 1);
|
|
7938
|
-
const isDown = isDownLadder(spec);
|
|
7939
|
-
const x0 = innerX;
|
|
7940
|
-
const x1 = innerX + innerW;
|
|
7941
|
-
const y0 = isDown ? innerY : innerY + innerH;
|
|
7942
|
-
const y1 = isDown ? innerY + innerH : innerY;
|
|
7943
|
-
const cx = (x0 + x1) / 2;
|
|
7944
|
-
const cy = (y0 + y1) / 2;
|
|
7945
|
-
const dx = x1 - x0;
|
|
7946
|
-
const dy = y1 - y0;
|
|
7947
|
-
const angleRad = (Math.atan2(dy, dx) / Math.PI) * 180;
|
|
7948
|
-
const fontSize = Math.max(LADDER_HEADLINE_FONT_MIN, Math.min(LADDER_HEADLINE_FONT_MAX, Math.round(innerH * LADDER_HEADLINE_FONT_RATIO)));
|
|
7949
|
-
return { x0, y0, x1, y1, cx, cy, angleRad, fontSize };
|
|
7950
|
-
};
|
|
7951
|
-
const getLadderHeadlineText = (spec) => {
|
|
7952
|
-
var _a, _b;
|
|
7953
|
-
const layoutOpt = normalizeLayout(spec.layout);
|
|
7954
|
-
if (typeof layoutOpt.headline === 'string' && layoutOpt.headline.length > 0) {
|
|
7955
|
-
return layoutOpt.headline;
|
|
7956
|
-
}
|
|
7957
|
-
const title = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.text;
|
|
7958
|
-
if (typeof title === 'string' && title.length > 0) {
|
|
7959
|
-
return title;
|
|
7960
|
-
}
|
|
7961
|
-
return 'storyline';
|
|
7962
|
-
};
|
|
7963
|
-
const buildLadderDiagonalMark = (spec) => {
|
|
7964
|
-
const themeColor = getThemeColor(spec);
|
|
7965
|
-
return {
|
|
7966
|
-
type: 'group',
|
|
7967
|
-
name: 'storyline-ladder-diagonal',
|
|
7968
|
-
zIndex: vchart.LayoutZIndex.Mark - 1,
|
|
7969
|
-
children: [
|
|
7970
|
-
{
|
|
7971
|
-
type: 'path',
|
|
7972
|
-
name: 'storyline-ladder-diagonal-line',
|
|
7973
|
-
interactive: false,
|
|
7974
|
-
style: {
|
|
7975
|
-
path: (_d, ctx) => {
|
|
7976
|
-
const g = getLadderDiagonalGeometry(spec, ctx);
|
|
7977
|
-
return `M ${g.x0} ${g.y0} L ${g.x1} ${g.y1}`;
|
|
7978
|
-
},
|
|
7979
|
-
stroke: withAlpha(themeColor, 0.85),
|
|
7980
|
-
lineWidth: LADDER_DIAGONAL_LINE_WIDTH,
|
|
7981
|
-
lineDash: LADDER_DIAGONAL_DASH,
|
|
7982
|
-
fill: 'transparent'
|
|
7983
|
-
}
|
|
7984
|
-
}
|
|
7985
|
-
]
|
|
7986
|
-
};
|
|
7987
|
-
};
|
|
7988
|
-
const buildLadderHeadlineMark = (spec) => {
|
|
7989
|
-
const text = getLadderHeadlineText(spec);
|
|
7990
|
-
if (!text) {
|
|
7991
|
-
return null;
|
|
7992
|
-
}
|
|
7993
|
-
const themeColor = getThemeColor(spec);
|
|
7994
|
-
return {
|
|
7995
|
-
type: 'group',
|
|
7996
|
-
name: 'storyline-ladder-headline',
|
|
7997
|
-
zIndex: vchart.LayoutZIndex.Mark,
|
|
7998
|
-
style: {
|
|
7999
|
-
x: (_d, ctx) => getLadderDiagonalGeometry(spec, ctx).cx,
|
|
8000
|
-
y: (_d, ctx) => getLadderDiagonalGeometry(spec, ctx).cy,
|
|
8001
|
-
angle: (_d, ctx) => getLadderDiagonalGeometry(spec, ctx).angleRad
|
|
8002
|
-
},
|
|
8003
|
-
children: [
|
|
8004
|
-
{
|
|
8005
|
-
type: 'text',
|
|
8006
|
-
name: 'storyline-ladder-headline-text',
|
|
8007
|
-
interactive: false,
|
|
8008
|
-
style: {
|
|
8009
|
-
x: 0,
|
|
8010
|
-
y: 0,
|
|
8011
|
-
text,
|
|
8012
|
-
fontSize: (_d, ctx) => getLadderDiagonalGeometry(spec, ctx).fontSize,
|
|
8013
|
-
fontWeight: 900,
|
|
8014
|
-
fontFamily: 'Impact, "Arial Black", sans-serif',
|
|
8015
|
-
fill: withAlpha(themeColor, 0.92),
|
|
8016
|
-
textAlign: 'center',
|
|
8017
|
-
textBaseline: 'middle'
|
|
8018
|
-
}
|
|
8019
|
-
}
|
|
8020
|
-
]
|
|
8021
|
-
};
|
|
8022
|
-
};
|
|
8023
|
-
const isOnLeft = (index) => index % 2 === 1;
|
|
8024
|
-
const getLadderBlockMetrics = (spec, ctx, index) => {
|
|
8025
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
8026
|
-
const block = getLayout(spec, ctx).blocks[index];
|
|
8027
|
-
const padding = normalizePadding((_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding) !== null && _b !== void 0 ? _b : 12);
|
|
8028
|
-
const imagePosition = isOnLeft(index) ? 'right' : 'left';
|
|
8029
|
-
const imageWidth = (_e = (_c = spec.image) === null || _c === void 0 ? void 0 : _c.width) !== null && _e !== void 0 ? _e : LADDER_BLOCK_IMAGE_SIZE;
|
|
8030
|
-
const imageHeight = (_g = (_f = spec.image) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : LADDER_BLOCK_IMAGE_SIZE;
|
|
8031
|
-
const imageGap = (_j = (_h = spec.image) === null || _h === void 0 ? void 0 : _h.gap) !== null && _j !== void 0 ? _j : DEFAULT_IMAGE_GAP;
|
|
8032
|
-
const hasImage = !!((_l = (_k = spec.data) === null || _k === void 0 ? void 0 : _k[index]) === null || _l === void 0 ? void 0 : _l.image);
|
|
8033
|
-
const blockWidth = (_m = block === null || block === void 0 ? void 0 : block.width) !== null && _m !== void 0 ? _m : resolveBlockWidth(spec, 0);
|
|
8034
|
-
const blockHeight = (_q = (_o = block === null || block === void 0 ? void 0 : block.height) !== null && _o !== void 0 ? _o : (_p = spec.block) === null || _p === void 0 ? void 0 : _p.height) !== null && _q !== void 0 ? _q : DEFAULT_BLOCK_HEIGHT;
|
|
8035
|
-
const imageBox = getImageBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
|
|
8036
|
-
const textBox = getTextBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
|
|
8037
|
-
const titleFontSize = resolveTitleFontSize(spec, ctx, (_s = (_r = spec.data) === null || _r === void 0 ? void 0 : _r[index]) === null || _s === void 0 ? void 0 : _s.title, textBox.width, LADDER_TITLE_FONT_SIZE, [8, 34]);
|
|
8038
|
-
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_t = spec.title) === null || _t === void 0 ? void 0 : _t.style, LADDER_TITLE_LINE_HEIGHT, LADDER_TITLE_LINE_HEIGHT / LADDER_TITLE_FONT_SIZE);
|
|
8039
|
-
const titleHeight = getBlockTitleHeight(titleLineHeight, (_v = (_u = spec.data) === null || _u === void 0 ? void 0 : _u[index]) === null || _v === void 0 ? void 0 : _v.title, textBox.width, titleFontSize);
|
|
8040
|
-
const contentGap = ((_x = (_w = spec.data) === null || _w === void 0 ? void 0 : _w[index]) === null || _x === void 0 ? void 0 : _x.title) ? 8 : 0;
|
|
8041
|
-
return {
|
|
8042
|
-
block: { width: blockWidth, height: blockHeight },
|
|
8043
|
-
titleFontSize,
|
|
8044
|
-
titleLineHeight,
|
|
8045
|
-
titleHeight,
|
|
8046
|
-
imageBox,
|
|
8047
|
-
textBox,
|
|
8048
|
-
contentBox: {
|
|
8049
|
-
y: textBox.y + titleHeight + contentGap,
|
|
8050
|
-
height: Math.max(0, textBox.height - titleHeight - contentGap)
|
|
8051
|
-
}
|
|
8052
|
-
};
|
|
8053
|
-
};
|
|
8054
|
-
const buildLadderBlockMark = (spec, block, index) => {
|
|
8055
|
-
var _a, _b, _c, _e, _f, _g, _h;
|
|
8056
|
-
const hasImage = !!block.image;
|
|
8057
|
-
const onLeft = isOnLeft(index);
|
|
8058
|
-
const align = onLeft ? 'right' : 'left';
|
|
8059
|
-
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
8060
|
-
const showBackground = ((_a = spec.block) === null || _a === void 0 ? void 0 : _a.showBackground) === true;
|
|
8061
|
-
const showImageBackground = shouldShowImageBackground(spec);
|
|
8062
|
-
const getTitleX = (ctx) => {
|
|
8063
|
-
const m = getLadderBlockMetrics(spec, ctx, index);
|
|
8064
|
-
return align === 'right' ? m.textBox.x + m.textBox.width : m.textBox.x;
|
|
8065
|
-
};
|
|
8066
|
-
return {
|
|
8067
|
-
type: 'group',
|
|
8068
|
-
id: `storyline-block-${(_b = block.id) !== null && _b !== void 0 ? _b : index}`,
|
|
8069
|
-
name: `storyline-block-${index}`,
|
|
8070
|
-
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
8071
|
-
style: {
|
|
8072
|
-
x: (_d, ctx) => { var _a, _b; return (_b = (_a = getLayout(spec, ctx).blocks[index]) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0; },
|
|
8073
|
-
y: (_d, ctx) => { var _a, _b; return (_b = (_a = getLayout(spec, ctx).blocks[index]) === null || _a === void 0 ? void 0 : _a.y) !== null && _b !== void 0 ? _b : 0; },
|
|
8074
|
-
width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.width,
|
|
8075
|
-
height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.height
|
|
8076
|
-
},
|
|
8077
|
-
children: [
|
|
8078
|
-
showBackground
|
|
8079
|
-
? {
|
|
8080
|
-
type: 'rect',
|
|
8081
|
-
name: `storyline-block-bg-${index}`,
|
|
8082
|
-
interactive: false,
|
|
8083
|
-
style: Object.assign({ x: 0, y: 0, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.height, cornerRadius: 8, fill: '#ffffff', stroke: '#d7dce5', lineWidth: 1, shadowBlur: 6, shadowColor: 'rgba(0, 0, 0, 0.08)' }, (_c = spec.block) === null || _c === void 0 ? void 0 : _c.style)
|
|
8084
|
-
}
|
|
8085
|
-
: null,
|
|
8086
|
-
showImageBackground
|
|
8087
|
-
? {
|
|
8088
|
-
type: 'rect',
|
|
8089
|
-
name: `storyline-block-image-bg-${index}`,
|
|
8090
|
-
interactive: false,
|
|
8091
|
-
style: Object.assign(Object.assign({ x: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: 8 }, getImageBackgroundStyle(spec)), (_e = spec.block) === null || _e === void 0 ? void 0 : _e.style)
|
|
8092
|
-
}
|
|
8093
|
-
: null,
|
|
8094
|
-
hasImage
|
|
8095
|
-
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.height, image: block.image }, (_f = spec.image) === null || _f === void 0 ? void 0 : _f.style) })
|
|
8096
|
-
: null,
|
|
8097
|
-
block.title
|
|
8098
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign(Object.assign({ x: (_d, ctx) => getTitleX(ctx), y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).titleHeight, heightLimit: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).titleFontSize, lineHeight: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_g = spec.title) === null || _g === void 0 ? void 0 : _g.style), { textAlign: align }) })
|
|
8099
|
-
: null,
|
|
8100
|
-
contentText.length
|
|
8101
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { style: Object.assign(Object.assign({ x: (_d, ctx) => getTitleX(ctx), y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.height, text: buildPlainContent(contentText), maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.height, fontSize: LADDER_CONTENT_FONT_SIZE, lineHeight: LADDER_CONTENT_LINE_HEIGHT, textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style), { textAlign: align }) })
|
|
8102
|
-
: null
|
|
8103
|
-
].filter(Boolean)
|
|
8104
|
-
};
|
|
8105
|
-
};
|
|
8106
|
-
|
|
8107
7936
|
class StorylineChartSpecTransformer extends vchart.CommonChartSpecTransformer {
|
|
8108
7937
|
transformSpec(spec) {
|
|
8109
7938
|
var _a;
|
|
@@ -8128,15 +7957,11 @@
|
|
|
8128
7957
|
const arcDown = arc && normalizeLayout(spec.layout).direction === 'down';
|
|
8129
7958
|
const arcUp = arc && !arcDown;
|
|
8130
7959
|
const portrait = isPortrait(spec);
|
|
8131
|
-
const ladder = isLadder(spec);
|
|
8132
7960
|
const wing = isWing(spec);
|
|
8133
7961
|
const clock = isClock(spec);
|
|
8134
7962
|
const topTitleImageReserve = (() => {
|
|
8135
7963
|
var _a, _b, _c, _d;
|
|
8136
|
-
if (arc ||
|
|
8137
|
-
ladder ||
|
|
8138
|
-
!((_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.image) ||
|
|
8139
|
-
((_b = spec.titleImage) === null || _b === void 0 ? void 0 : _b.visible) === false) {
|
|
7964
|
+
if (arc || !((_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.image) || ((_b = spec.titleImage) === null || _b === void 0 ? void 0 : _b.visible) === false) {
|
|
8140
7965
|
return 0;
|
|
8141
7966
|
}
|
|
8142
7967
|
return getTitleImageReservedHeight(spec, Number((_c = spec.width) !== null && _c !== void 0 ? _c : 1000), Number((_d = spec.height) !== null && _d !== void 0 ? _d : 600));
|
|
@@ -8161,33 +7986,7 @@
|
|
|
8161
7986
|
const breath = 16;
|
|
8162
7987
|
return Math.max(LARGE, Math.round(imageHeight / 2 + textGap + titleLineHeight + titleToContentGap + contentHeight + breath));
|
|
8163
7988
|
})();
|
|
8164
|
-
const
|
|
8165
|
-
var _a, _b, _c, _d, _e, _f;
|
|
8166
|
-
if (!ladder) {
|
|
8167
|
-
return 0;
|
|
8168
|
-
}
|
|
8169
|
-
const blockWidth = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.minWidth) !== null && _b !== void 0 ? _b : resolveBlockWidth(spec, 0);
|
|
8170
|
-
const imageWidth = (_d = (_c = spec.image) === null || _c === void 0 ? void 0 : _c.width) !== null && _d !== void 0 ? _d : 96;
|
|
8171
|
-
const imageGap = (_f = (_e = spec.image) === null || _e === void 0 ? void 0 : _e.gap) !== null && _f !== void 0 ? _f : DEFAULT_IMAGE_GAP;
|
|
8172
|
-
const innerPadding = 12 * 2;
|
|
8173
|
-
const contentWidth = Math.max(blockWidth - imageWidth - imageGap - innerPadding, DEFAULT_BLOCK_WIDTH * 0.5);
|
|
8174
|
-
const ideal = Math.round(contentWidth * 2);
|
|
8175
|
-
const canvasWidth = spec.width;
|
|
8176
|
-
const cap = canvasWidth ? Math.floor(canvasWidth * 0.3) : ideal;
|
|
8177
|
-
return Math.min(ideal, cap);
|
|
8178
|
-
})();
|
|
8179
|
-
const ladderVerticalPadding = (() => {
|
|
8180
|
-
var _a, _b;
|
|
8181
|
-
if (!ladder) {
|
|
8182
|
-
return 0;
|
|
8183
|
-
}
|
|
8184
|
-
const blockHeight = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 132;
|
|
8185
|
-
const ideal = Math.round(blockHeight * 3);
|
|
8186
|
-
const canvasHeight = spec.height;
|
|
8187
|
-
const cap = canvasHeight ? Math.floor(canvasHeight * 0.3) : ideal;
|
|
8188
|
-
return Math.min(ideal, cap);
|
|
8189
|
-
})();
|
|
8190
|
-
const defaultTop = Math.max(topTitleImageReserve, clock ? 40 : ladder ? ladderVerticalPadding : arcDown ? 0 : arcUp ? TEXT_RESERVE : SMALL);
|
|
7989
|
+
const defaultTop = Math.max(topTitleImageReserve, clock ? 40 : arcDown ? 0 : arcUp ? TEXT_RESERVE : SMALL);
|
|
8191
7990
|
const defaultBottom = clock
|
|
8192
7991
|
? 60
|
|
8193
7992
|
: portrait
|
|
@@ -8211,8 +8010,8 @@
|
|
|
8211
8010
|
}
|
|
8212
8011
|
return Math.round(canvasWidth / (count + 1));
|
|
8213
8012
|
})();
|
|
8214
|
-
const defaultLeft = clock ? 40 :
|
|
8215
|
-
const defaultRight = clock ? 40 :
|
|
8013
|
+
const defaultLeft = clock ? 40 : arcHorizontalPadding;
|
|
8014
|
+
const defaultRight = clock ? 40 : arcHorizontalPadding;
|
|
8216
8015
|
const p = spec.padding;
|
|
8217
8016
|
if (p == null) {
|
|
8218
8017
|
spec.padding = [defaultTop, defaultRight, defaultBottom, defaultLeft];
|
|
@@ -8261,11 +8060,6 @@
|
|
|
8261
8060
|
const wingTitleImageMark = buildWingTitleImageMark(spec);
|
|
8262
8061
|
return [arcMark, wingTitleImageMark, ...blockMarks].filter(Boolean);
|
|
8263
8062
|
}
|
|
8264
|
-
if (isLadder(spec)) {
|
|
8265
|
-
const diagonalMark = buildLadderDiagonalMark(spec);
|
|
8266
|
-
const headlineMark = buildLadderHeadlineMark(spec);
|
|
8267
|
-
return [diagonalMark, headlineMark, ...blockMarks].filter(Boolean);
|
|
8268
|
-
}
|
|
8269
8063
|
return [titleImageMark, lineMark, ...blockMarks].filter(Boolean);
|
|
8270
8064
|
};
|
|
8271
8065
|
const buildLineMark = (spec) => {
|
|
@@ -8297,9 +8091,6 @@
|
|
|
8297
8091
|
if (isWing(spec)) {
|
|
8298
8092
|
return buildWingBlockMark(spec, block, index);
|
|
8299
8093
|
}
|
|
8300
|
-
if (isLadder(spec)) {
|
|
8301
|
-
return buildLadderBlockMark(spec, block, index);
|
|
8302
|
-
}
|
|
8303
8094
|
return buildDefaultBlockMark(spec, block, index);
|
|
8304
8095
|
};
|
|
8305
8096
|
|