@visactor/vchart 2.1.3-alpha.5 → 2.1.4-alpha.0
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/es5/index.js +1 -1
- package/build/index.es.js +305 -70
- package/build/index.js +309 -70
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/animation-planner.js +1 -1
- package/cjs/animation/callback-disappear.js +1 -1
- package/cjs/animation/config.js +2 -1
- package/cjs/animation/grammar-dector.js +1 -1
- package/cjs/animation/index.js +1 -1
- package/cjs/animation/interface.js +1 -1
- package/cjs/animation/sequential-animate.js +1 -1
- package/cjs/animation/spec.js +1 -1
- package/cjs/animation/state-transition.js +1 -1
- package/cjs/animation/utils.js +1 -1
- package/cjs/chart/util.js +1 -2
- package/cjs/compile/compiler.d.ts +2 -0
- package/cjs/compile/compiler.js +23 -8
- package/cjs/compile/compiler.js.map +1 -1
- package/cjs/compile/interface/compiler.d.ts +1 -0
- package/cjs/compile/interface/compiler.js.map +1 -1
- package/cjs/compile/state-manager.js +2 -1
- package/cjs/component/axis/cartesian/axis.d.ts +12 -0
- package/cjs/component/axis/cartesian/axis.js +48 -2
- package/cjs/component/axis/cartesian/axis.js.map +1 -1
- package/cjs/component/axis/cartesian/interface/common.d.ts +1 -1
- package/cjs/component/axis/cartesian/interface/common.js.map +1 -1
- package/cjs/component/poptip/index.js +5 -2
- package/cjs/component/poptip/index.js.map +1 -1
- package/cjs/constant/event.js +1 -2
- package/cjs/constant/scatter.js +2 -1
- package/cjs/core/expression-function.js +1 -1
- package/cjs/core/factory-registry.d.ts +2 -1
- package/cjs/core/factory-registry.js +4 -2
- package/cjs/core/factory-registry.js.map +1 -1
- package/cjs/core/factory.d.ts +4 -1
- package/cjs/core/factory.js +5 -2
- package/cjs/core/factory.js.map +1 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +2 -3
- package/cjs/core/index.js.map +1 -1
- package/cjs/core/instance-manager.js +1 -1
- package/cjs/core/interface.js +1 -1
- package/cjs/core/util.js +1 -1
- package/cjs/core/vchart.js +13 -5
- package/cjs/core/vchart.js.map +1 -1
- package/cjs/data/initialize.js +1 -1
- package/cjs/data/register.js +1 -1
- package/cjs/data/transforms/funnel.js +9 -4
- package/cjs/data/transforms/funnel.js.map +1 -1
- package/cjs/interaction/interaction.d.ts +2 -0
- package/cjs/interaction/interaction.js +19 -11
- package/cjs/interaction/interaction.js.map +1 -1
- package/cjs/mark/component.js +1 -1
- package/cjs/mark/component.js.map +1 -1
- package/cjs/mark/glyph.d.ts +1 -1
- package/cjs/mark/glyph.js +7 -6
- package/cjs/mark/glyph.js.map +1 -1
- package/cjs/series/bar/bar.d.ts +4 -0
- package/cjs/series/bar/bar.js +17 -6
- package/cjs/series/bar/bar.js.map +1 -1
- package/cjs/series/base/base-series.js +1 -1
- package/cjs/series/base/base-series.js.map +1 -1
- package/cjs/series/funnel/interface.d.ts +6 -1
- package/cjs/series/funnel/interface.js.map +1 -1
- package/cjs/series/sankey/sankey.d.ts +3 -0
- package/cjs/series/sankey/sankey.js +26 -16
- package/cjs/series/sankey/sankey.js.map +1 -1
- package/cjs/series/treemap/interface.d.ts +1 -1
- package/cjs/series/treemap/interface.js.map +1 -1
- package/cjs/theme/builtin/common/series/funnel.js +18 -0
- package/cjs/theme/builtin/common/series/funnel.js.map +1 -1
- package/cjs/typings/spec/common.d.ts +4 -2
- package/cjs/typings/spec/common.js.map +1 -1
- package/cjs/util/spec/transform.d.ts +5 -2
- package/cjs/util/spec/transform.js +7 -11
- package/cjs/util/spec/transform.js.map +1 -1
- package/esm/animation/animation-planner.js +1 -1
- package/esm/animation/callback-disappear.js +1 -1
- package/esm/animation/config.js +2 -1
- package/esm/animation/grammar-dector.js +1 -1
- package/esm/animation/index.js +1 -1
- package/esm/animation/interface.js +1 -1
- package/esm/animation/sequential-animate.js +1 -1
- package/esm/animation/spec.js +1 -1
- package/esm/animation/state-transition.js +1 -1
- package/esm/animation/utils.js +1 -1
- package/esm/chart/util.js +1 -2
- package/esm/compile/compiler.d.ts +2 -0
- package/esm/compile/compiler.js +24 -7
- package/esm/compile/compiler.js.map +1 -1
- package/esm/compile/interface/compiler.d.ts +1 -0
- package/esm/compile/interface/compiler.js.map +1 -1
- package/esm/compile/state-manager.js +2 -1
- package/esm/component/axis/cartesian/axis.d.ts +12 -0
- package/esm/component/axis/cartesian/axis.js +48 -1
- package/esm/component/axis/cartesian/axis.js.map +1 -1
- package/esm/component/axis/cartesian/interface/common.d.ts +1 -1
- package/esm/component/axis/cartesian/interface/common.js.map +1 -1
- package/esm/component/poptip/index.js +8 -2
- package/esm/component/poptip/index.js.map +1 -1
- package/esm/constant/event.js +1 -2
- package/esm/constant/scatter.js +2 -1
- package/esm/core/expression-function.js +1 -1
- package/esm/core/factory-registry.d.ts +2 -1
- package/esm/core/factory-registry.js +4 -2
- package/esm/core/factory-registry.js.map +1 -1
- package/esm/core/factory.d.ts +4 -1
- package/esm/core/factory.js +4 -2
- package/esm/core/factory.js.map +1 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +2 -3
- package/esm/core/index.js.map +1 -1
- package/esm/core/instance-manager.js +1 -1
- package/esm/core/interface.js +1 -1
- package/esm/core/util.js +1 -1
- package/esm/core/vchart.js +12 -5
- package/esm/core/vchart.js.map +1 -1
- package/esm/data/initialize.js +1 -1
- package/esm/data/register.js +1 -1
- package/esm/data/transforms/funnel.js +8 -5
- package/esm/data/transforms/funnel.js.map +1 -1
- package/esm/interaction/interaction.d.ts +2 -0
- package/esm/interaction/interaction.js +19 -11
- package/esm/interaction/interaction.js.map +1 -1
- package/esm/mark/component.js +1 -1
- package/esm/mark/component.js.map +1 -1
- package/esm/mark/glyph.d.ts +1 -1
- package/esm/mark/glyph.js +7 -6
- package/esm/mark/glyph.js.map +1 -1
- package/esm/series/bar/bar.d.ts +4 -0
- package/esm/series/bar/bar.js +16 -5
- package/esm/series/bar/bar.js.map +1 -1
- package/esm/series/base/base-series.js +1 -1
- package/esm/series/base/base-series.js.map +1 -1
- package/esm/series/funnel/interface.d.ts +6 -1
- package/esm/series/funnel/interface.js.map +1 -1
- package/esm/series/sankey/sankey.d.ts +3 -0
- package/esm/series/sankey/sankey.js +26 -15
- package/esm/series/sankey/sankey.js.map +1 -1
- package/esm/series/treemap/interface.d.ts +1 -1
- package/esm/series/treemap/interface.js.map +1 -1
- package/esm/theme/builtin/common/series/funnel.js +18 -0
- package/esm/theme/builtin/common/series/funnel.js.map +1 -1
- package/esm/typings/spec/common.d.ts +4 -2
- package/esm/typings/spec/common.js.map +1 -1
- package/esm/util/spec/transform.d.ts +5 -2
- package/esm/util/spec/transform.js +7 -11
- package/esm/util/spec/transform.js.map +1 -1
- package/package.json +9 -9
package/build/index.es.js
CHANGED
|
@@ -70,7 +70,7 @@ import { linearDiscreteTicks } from '@visactor/vrender-components/axis/tick-data
|
|
|
70
70
|
import { LineAxisGrid } from '@visactor/vrender-components/axis/grid/line';
|
|
71
71
|
import { LineAxis } from '@visactor/vrender-components/axis/line';
|
|
72
72
|
import { continuousTicks } from '@visactor/vrender-components/axis/tick-data/continuous';
|
|
73
|
-
import { continuousTicks as continuousTicks$1, LineAxis as LineAxis$1, LineAxisGrid as LineAxisGrid$1, CircleAxis, CircleAxisGrid, polarAngleAxisDiscreteTicks, registerSymbolDataLabel as registerSymbolDataLabel$1, labelSmartInvert, loadScrollbar, ColorContinuousLegend, SizeContinuousLegend, LineCrosshair as LineCrosshair$1, SectorCrosshair, PolygonCrosshair, CircleCrosshair, DataZoom as DataZoom$1, ScrollBar as ScrollBar$1, Indicator as Indicator$1, MarkLine, registerMarkLineAnimate, MarkArcLine, registerMarkArcLineAnimate, Title as Title$1, MarkArea, registerMarkAreaAnimate, MarkArcArea, registerMarkArcAreaAnimate, DiscretePlayer, ContinuousPlayer, PlayerEventEnum, DataLabel as DataLabel$1, MarkPoint, registerMarkPointAnimate, Brush as Brush$1, IOperateType
|
|
73
|
+
import { continuousTicks as continuousTicks$1, LineAxis as LineAxis$1, LineAxisGrid as LineAxisGrid$1, CircleAxis, CircleAxisGrid, polarAngleAxisDiscreteTicks, registerSymbolDataLabel as registerSymbolDataLabel$1, labelSmartInvert, loadScrollbar, ColorContinuousLegend, SizeContinuousLegend, LineCrosshair as LineCrosshair$1, SectorCrosshair, PolygonCrosshair, CircleCrosshair, DataZoom as DataZoom$1, ScrollBar as ScrollBar$1, Indicator as Indicator$1, MarkLine, registerMarkLineAnimate, MarkArcLine, registerMarkArcLineAnimate, Title as Title$1, MarkArea, registerMarkAreaAnimate, MarkArcArea, registerMarkArcAreaAnimate, DiscretePlayer, ContinuousPlayer, PlayerEventEnum, DataLabel as DataLabel$1, MarkPoint, registerMarkPointAnimate, Brush as Brush$1, IOperateType } from '@visactor/vrender-components';
|
|
74
74
|
export { AbstractComponent, MarkPoint, Segment } from '@visactor/vrender-components';
|
|
75
75
|
import { registerRectDataLabel, registerArcDataLabel, DataLabel } from '@visactor/vrender-components/label';
|
|
76
76
|
import { getTextBounds, getRichTextBounds } from '@visactor/vrender-core/text';
|
|
@@ -79,6 +79,7 @@ import { DiscreteLegend as DiscreteLegend$1 } from '@visactor/vrender-components
|
|
|
79
79
|
import { LineCrosshair } from '@visactor/vrender-components/crosshair/line';
|
|
80
80
|
import { RectCrosshair } from '@visactor/vrender-components/crosshair/rect';
|
|
81
81
|
import { Tag } from '@visactor/vrender-components/tag';
|
|
82
|
+
import { installPoptipToApp, loadPoptip } from '@visactor/vrender-components/poptip';
|
|
82
83
|
import { Symbol as Symbol$1 } from '@visactor/vrender-core/graphic/symbol';
|
|
83
84
|
import { GradientParser } from '@visactor/vrender-core/svg';
|
|
84
85
|
import { Tooltip as Tooltip$1 } from '@visactor/vrender-components/tooltip';
|
|
@@ -11397,6 +11398,13 @@ Factory.createTooltipProcessor = (type, tooltip) => {
|
|
|
11397
11398
|
}
|
|
11398
11399
|
return new Cror(tooltip);
|
|
11399
11400
|
};
|
|
11401
|
+
Factory._runtimePluginInstallers = factoryRegistry.runtimePluginInstallers;
|
|
11402
|
+
Factory.registerRuntimePluginInstaller = (type, installer) => {
|
|
11403
|
+
Factory._runtimePluginInstallers[type] = installer;
|
|
11404
|
+
};
|
|
11405
|
+
Factory.getRuntimePluginInstaller = (type) => {
|
|
11406
|
+
return Factory._runtimePluginInstallers[type];
|
|
11407
|
+
};
|
|
11400
11408
|
|
|
11401
11409
|
function mergeTheme(target, ...sources) {
|
|
11402
11410
|
return mergeSpec(transformThemeToMerge(target), ...sources.map(transformThemeToMerge));
|
|
@@ -11461,6 +11469,24 @@ const getFunnelTheme = (is3d) => {
|
|
|
11461
11469
|
fill: { type: 'palette', key: 'secondaryFontColor' },
|
|
11462
11470
|
textBaseline: 'middle'
|
|
11463
11471
|
}
|
|
11472
|
+
},
|
|
11473
|
+
conversionArrow: {
|
|
11474
|
+
line: {
|
|
11475
|
+
style: {
|
|
11476
|
+
stroke: 'black'
|
|
11477
|
+
}
|
|
11478
|
+
},
|
|
11479
|
+
symbol: {
|
|
11480
|
+
style: {
|
|
11481
|
+
fill: 'black'
|
|
11482
|
+
}
|
|
11483
|
+
},
|
|
11484
|
+
text: {
|
|
11485
|
+
style: {
|
|
11486
|
+
fontSize: 12,
|
|
11487
|
+
fill: '#606773'
|
|
11488
|
+
}
|
|
11489
|
+
}
|
|
11464
11490
|
}
|
|
11465
11491
|
};
|
|
11466
11492
|
res[is3d ? 'transform3d' : 'transform'] = {
|
|
@@ -11639,27 +11665,27 @@ function specTransform(spec, special = {
|
|
|
11639
11665
|
}
|
|
11640
11666
|
return spec;
|
|
11641
11667
|
}
|
|
11642
|
-
function functionTransform(
|
|
11643
|
-
|
|
11644
|
-
|
|
11668
|
+
function functionTransform(value, registry) {
|
|
11669
|
+
var _a;
|
|
11670
|
+
if (!value) {
|
|
11671
|
+
return value;
|
|
11645
11672
|
}
|
|
11646
|
-
if (
|
|
11673
|
+
if (isString$1(value)) {
|
|
11674
|
+
return (_a = registry.getFunction(value)) !== null && _a !== void 0 ? _a : value;
|
|
11675
|
+
}
|
|
11676
|
+
if (isPlainObject$1(value)) {
|
|
11647
11677
|
const result = {};
|
|
11648
|
-
for (const key in
|
|
11649
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
11650
|
-
|
|
11651
|
-
result[key] = VChart.getFunction(spec[key]);
|
|
11652
|
-
continue;
|
|
11653
|
-
}
|
|
11654
|
-
result[key] = functionTransform(spec[key], VChart);
|
|
11678
|
+
for (const key in value) {
|
|
11679
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
|
11680
|
+
result[key] = functionTransform(value[key], registry);
|
|
11655
11681
|
}
|
|
11656
11682
|
}
|
|
11657
11683
|
return result;
|
|
11658
11684
|
}
|
|
11659
|
-
if (isArray$1(
|
|
11660
|
-
return
|
|
11685
|
+
if (isArray$1(value)) {
|
|
11686
|
+
return value.map(item => functionTransform(item, registry));
|
|
11661
11687
|
}
|
|
11662
|
-
return
|
|
11688
|
+
return value;
|
|
11663
11689
|
}
|
|
11664
11690
|
function transformFunctionAttribute(att, ...args) {
|
|
11665
11691
|
if (isFunction$1(att)) {
|
|
@@ -13394,6 +13420,7 @@ const resolveVRenderApp = (appOrOptions, mode) => {
|
|
|
13394
13420
|
};
|
|
13395
13421
|
const createStageFromApp = (app, params) => app.createStage(params);
|
|
13396
13422
|
|
|
13423
|
+
const POPTIP_FOR_TEXT_PLUGIN_NAME = 'poptipForText';
|
|
13397
13424
|
class Compiler {
|
|
13398
13425
|
get stateAnimationConfig() {
|
|
13399
13426
|
return this._stateAnimationConfig;
|
|
@@ -13458,8 +13485,36 @@ class Compiler {
|
|
|
13458
13485
|
getStage() {
|
|
13459
13486
|
return this._stage;
|
|
13460
13487
|
}
|
|
13488
|
+
_dedupeStagePlugin(pluginName) {
|
|
13489
|
+
var _a;
|
|
13490
|
+
const pluginService = (_a = this._stage) === null || _a === void 0 ? void 0 : _a.pluginService;
|
|
13491
|
+
if (!(pluginService === null || pluginService === void 0 ? void 0 : pluginService.findPluginsByName)) {
|
|
13492
|
+
return;
|
|
13493
|
+
}
|
|
13494
|
+
const plugins = pluginService.findPluginsByName(pluginName);
|
|
13495
|
+
if (plugins.length <= 1) {
|
|
13496
|
+
return;
|
|
13497
|
+
}
|
|
13498
|
+
const plugin = plugins[0];
|
|
13499
|
+
if (pluginService.uninstall) {
|
|
13500
|
+
pluginService.uninstall(pluginName);
|
|
13501
|
+
pluginService.register(plugin);
|
|
13502
|
+
}
|
|
13503
|
+
else {
|
|
13504
|
+
plugins.slice(1).forEach(duplicatePlugin => {
|
|
13505
|
+
pluginService.unRegister(duplicatePlugin);
|
|
13506
|
+
});
|
|
13507
|
+
}
|
|
13508
|
+
}
|
|
13509
|
+
_dedupePoptipPlugin() {
|
|
13510
|
+
var _a;
|
|
13511
|
+
if (!((_a = this._option.pluginList) === null || _a === void 0 ? void 0 : _a.includes(POPTIP_FOR_TEXT_PLUGIN_NAME))) {
|
|
13512
|
+
return;
|
|
13513
|
+
}
|
|
13514
|
+
this._dedupeStagePlugin(POPTIP_FOR_TEXT_PLUGIN_NAME);
|
|
13515
|
+
}
|
|
13461
13516
|
initView() {
|
|
13462
|
-
var _a, _b, _c, _d;
|
|
13517
|
+
var _a, _b, _c, _d, _e;
|
|
13463
13518
|
if (this._released) {
|
|
13464
13519
|
return;
|
|
13465
13520
|
}
|
|
@@ -13481,22 +13536,24 @@ class Compiler {
|
|
|
13481
13536
|
modeParams
|
|
13482
13537
|
});
|
|
13483
13538
|
this._releaseVRenderAppRef = resolvedApp.releaseAppRef;
|
|
13539
|
+
(_a = this._option.runtimePluginInstallers) === null || _a === void 0 ? void 0 : _a.forEach(install => install(resolvedApp.app));
|
|
13484
13540
|
try {
|
|
13485
|
-
this._stage = createStageFromApp(resolvedApp.app, Object.assign({ background, width: this._width, height: this._height, container: (
|
|
13541
|
+
this._stage = createStageFromApp(resolvedApp.app, Object.assign({ background, width: this._width, height: this._height, container: (_b = this._container.dom) !== null && _b !== void 0 ? _b : null, canvas: (_c = this._container.canvas) !== null && _c !== void 0 ? _c : null, dpr, viewBox: this._option.viewBox, canvasControled: this._option.canvasControled, beforeRender: (stage) => {
|
|
13486
13542
|
var _a, _b, _c;
|
|
13487
13543
|
(_a = this._compileChart) === null || _a === void 0 ? void 0 : _a.onBeforeRender();
|
|
13488
13544
|
(_c = (_b = this._option).beforeRender) === null || _c === void 0 ? void 0 : _c.call(_b, stage);
|
|
13489
13545
|
}, afterRender: this._option.afterRender, disableDirtyBounds: true, autoRender: true, ticker: this._option.ticker, pluginList: this._option.pluginList, enableHtmlAttribute: this._option.enableHtmlAttribute, optimize: this._option.optimize, supportsTouchEvents: this._option.supportsTouchEvents, supportsPointerEvents: this._option.supportsPointerEvents, event: {
|
|
13490
13546
|
clickInterval: clickInterval,
|
|
13491
13547
|
autoPreventDefault: autoPreventDefault
|
|
13492
|
-
}, ReactDOM: this._option.ReactDOM, autoRefresh: isValid$1(autoRefreshDpr) ? autoRefreshDpr : !isValid$1(dpr) }, ((
|
|
13548
|
+
}, ReactDOM: this._option.ReactDOM, autoRefresh: isValid$1(autoRefreshDpr) ? autoRefreshDpr : !isValid$1(dpr) }, ((_d = this._option.renderHooks) !== null && _d !== void 0 ? _d : {})));
|
|
13493
13549
|
}
|
|
13494
13550
|
catch (error) {
|
|
13495
|
-
(
|
|
13551
|
+
(_e = this._releaseVRenderAppRef) === null || _e === void 0 ? void 0 : _e.call(this);
|
|
13496
13552
|
this._releaseVRenderAppRef = undefined;
|
|
13497
13553
|
throw error;
|
|
13498
13554
|
}
|
|
13499
13555
|
}
|
|
13556
|
+
this._dedupePoptipPlugin();
|
|
13500
13557
|
this._stage.enableIncrementalAutoRender();
|
|
13501
13558
|
this._stage.setTheme({
|
|
13502
13559
|
symbol: {
|
|
@@ -19386,6 +19443,7 @@ class VChart {
|
|
|
19386
19443
|
}
|
|
19387
19444
|
let theme = this._currentTheme;
|
|
19388
19445
|
keys.forEach((key, index) => {
|
|
19446
|
+
var _a;
|
|
19389
19447
|
if (index === 1 && (keys[0] === 'series' || keys[0] === 'component')) {
|
|
19390
19448
|
const buildInTheme = keys[0] === 'series' ? Factory.getSeriesBuiltInTheme(key) : Factory.getComponentBuiltInTheme(key);
|
|
19391
19449
|
theme = theme ? mergeSpec({}, buildInTheme, theme[key]) : buildInTheme;
|
|
@@ -19397,6 +19455,9 @@ class VChart {
|
|
|
19397
19455
|
theme = preprocessTheme({
|
|
19398
19456
|
[key]: theme
|
|
19399
19457
|
}, this._currentTheme.colorScheme, this._currentTheme.token)[key];
|
|
19458
|
+
if ((_a = this.getFunctionList()) === null || _a === void 0 ? void 0 : _a.length) {
|
|
19459
|
+
theme = functionTransform(theme, this);
|
|
19460
|
+
}
|
|
19400
19461
|
}
|
|
19401
19462
|
});
|
|
19402
19463
|
this._cachedProcessedTheme[cacheKey] = theme;
|
|
@@ -19435,7 +19496,13 @@ class VChart {
|
|
|
19435
19496
|
this._updateCurrentTheme();
|
|
19436
19497
|
this._currentSize = this.getCurrentSize();
|
|
19437
19498
|
const pluginList = [];
|
|
19499
|
+
const runtimePluginInstallers = [];
|
|
19438
19500
|
if (poptip !== false) {
|
|
19501
|
+
const poptipInstaller = Factory.getRuntimePluginInstaller('poptipForText');
|
|
19502
|
+
if (poptipInstaller) {
|
|
19503
|
+
poptipInstaller();
|
|
19504
|
+
runtimePluginInstallers.push(poptipInstaller);
|
|
19505
|
+
}
|
|
19439
19506
|
pluginList.push('poptipForText');
|
|
19440
19507
|
}
|
|
19441
19508
|
if (spec.type === "sankey") {
|
|
@@ -19453,7 +19520,8 @@ class VChart {
|
|
|
19453
19520
|
dom: (_e = this._container) !== null && _e !== void 0 ? _e : 'none',
|
|
19454
19521
|
canvas: renderCanvas
|
|
19455
19522
|
}, Object.assign(Object.assign({ mode: this._option.mode, stage,
|
|
19456
|
-
pluginList
|
|
19523
|
+
pluginList,
|
|
19524
|
+
runtimePluginInstallers }, restOptions), { background: this._getBackground(), onError: this._onError }));
|
|
19457
19525
|
this._compiler.setSize(this._currentSize.width, this._currentSize.height);
|
|
19458
19526
|
this._eventDispatcher = new EventDispatcher(this, this._compiler);
|
|
19459
19527
|
this._event = new Event(this._eventDispatcher, mode);
|
|
@@ -19461,7 +19529,7 @@ class VChart {
|
|
|
19461
19529
|
this._compiler.updateLayoutTag();
|
|
19462
19530
|
this._setFontFamilyTheme(this.getTheme('fontFamily'));
|
|
19463
19531
|
this._initDataSet(this._option.dataSet);
|
|
19464
|
-
this._autoSize = isTrueBrowseEnv ? (_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true : false;
|
|
19532
|
+
this._autoSize = isTrueBrowseEnv ? ((_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true) : false;
|
|
19465
19533
|
this._bindResizeEvent();
|
|
19466
19534
|
this._bindViewEvent();
|
|
19467
19535
|
this._initChartPlugin();
|
|
@@ -20148,7 +20216,7 @@ class VChart {
|
|
|
20148
20216
|
resize = true;
|
|
20149
20217
|
}
|
|
20150
20218
|
const lasAutoSize = this._autoSize;
|
|
20151
|
-
this._autoSize = isTrueBrowser(this._option.mode) ? (_b = (_a = this._spec.autoFit) !== null && _a !== void 0 ? _a : this._option.autoFit) !== null && _b !== void 0 ? _b : true : false;
|
|
20219
|
+
this._autoSize = isTrueBrowser(this._option.mode) ? ((_b = (_a = this._spec.autoFit) !== null && _a !== void 0 ? _a : this._option.autoFit) !== null && _b !== void 0 ? _b : true) : false;
|
|
20152
20220
|
if (this._autoSize !== lasAutoSize) {
|
|
20153
20221
|
resize = true;
|
|
20154
20222
|
}
|
|
@@ -20744,7 +20812,7 @@ const lookup = (data, opt) => {
|
|
|
20744
20812
|
});
|
|
20745
20813
|
};
|
|
20746
20814
|
|
|
20747
|
-
const version = "2.1.
|
|
20815
|
+
const version = "2.1.3";
|
|
20748
20816
|
|
|
20749
20817
|
const addVChartProperty = (data, op) => {
|
|
20750
20818
|
const context = op.beforeCall();
|
|
@@ -22538,6 +22606,7 @@ class BaseSeries extends BaseModel {
|
|
|
22538
22606
|
this._spec[mark.name] && this.initMarkStyleWithSpec(mark, this._spec[mark.name]);
|
|
22539
22607
|
});
|
|
22540
22608
|
this.initMarkStyle();
|
|
22609
|
+
this.initMarkState();
|
|
22541
22610
|
marks.forEach(mark => {
|
|
22542
22611
|
mark.commit(false);
|
|
22543
22612
|
});
|
|
@@ -25251,6 +25320,9 @@ class ComponentMark extends BaseMark {
|
|
|
25251
25320
|
}
|
|
25252
25321
|
else {
|
|
25253
25322
|
this._component.setAttributes(attrs);
|
|
25323
|
+
if (this._product && this._component.parent !== this._product) {
|
|
25324
|
+
this._product.appendChild(this._component);
|
|
25325
|
+
}
|
|
25254
25326
|
}
|
|
25255
25327
|
if (this._component) {
|
|
25256
25328
|
this._component.context = this._getCommonContext();
|
|
@@ -25976,6 +26048,9 @@ class CartesianAxis extends AxisComponent {
|
|
|
25976
26048
|
});
|
|
25977
26049
|
}
|
|
25978
26050
|
};
|
|
26051
|
+
this._clearContinuousBarBandwidthCache = () => {
|
|
26052
|
+
this._continuousBarBandwidthCache = undefined;
|
|
26053
|
+
};
|
|
25979
26054
|
this._transformLayoutPosition = (pos) => {
|
|
25980
26055
|
let { x, y } = pos;
|
|
25981
26056
|
if (isValidNumber$1(x)) {
|
|
@@ -26266,16 +26341,99 @@ class CartesianAxis extends AxisComponent {
|
|
|
26266
26341
|
const getScale = (depth = 0) => {
|
|
26267
26342
|
return this._scales[depth];
|
|
26268
26343
|
};
|
|
26344
|
+
const getBandwidth = (depth = 0) => {
|
|
26345
|
+
return this._getContinuousBarBandwidth(depth);
|
|
26346
|
+
};
|
|
26269
26347
|
return {
|
|
26270
26348
|
isContinuous: isContinuous(this._scale.type),
|
|
26271
26349
|
dataToPosition: this.dataToPosition.bind(this),
|
|
26272
26350
|
getScale,
|
|
26351
|
+
getBandwidth,
|
|
26273
26352
|
getAxisType: () => this.type,
|
|
26274
26353
|
getAxisId: () => this.id,
|
|
26275
26354
|
isInverse: () => this._inverse === true,
|
|
26276
26355
|
getSpec: () => this._spec
|
|
26277
26356
|
};
|
|
26278
26357
|
}
|
|
26358
|
+
_getContinuousBarBandwidth(depth = 0) {
|
|
26359
|
+
if (depth !== 0 || !isContinuous(this._scale.type)) {
|
|
26360
|
+
return undefined;
|
|
26361
|
+
}
|
|
26362
|
+
const scale = this._scales[0];
|
|
26363
|
+
const domain = scale.domain();
|
|
26364
|
+
const range = scale.range();
|
|
26365
|
+
const domainStart = +(domain === null || domain === void 0 ? void 0 : domain[0]);
|
|
26366
|
+
const domainEnd = +(domain === null || domain === void 0 ? void 0 : domain[domain.length - 1]);
|
|
26367
|
+
const rangeStart = +(range === null || range === void 0 ? void 0 : range[0]);
|
|
26368
|
+
const rangeEnd = +(range === null || range === void 0 ? void 0 : range[range.length - 1]);
|
|
26369
|
+
if (!Number.isFinite(domainStart) ||
|
|
26370
|
+
!Number.isFinite(domainEnd) ||
|
|
26371
|
+
!Number.isFinite(rangeStart) ||
|
|
26372
|
+
!Number.isFinite(rangeEnd) ||
|
|
26373
|
+
domainStart === domainEnd) {
|
|
26374
|
+
return undefined;
|
|
26375
|
+
}
|
|
26376
|
+
const cache = this._continuousBarBandwidthCache;
|
|
26377
|
+
if (cache &&
|
|
26378
|
+
cache.scale === scale &&
|
|
26379
|
+
cache.domainStart === domainStart &&
|
|
26380
|
+
cache.domainEnd === domainEnd &&
|
|
26381
|
+
cache.rangeStart === rangeStart &&
|
|
26382
|
+
cache.rangeEnd === rangeEnd) {
|
|
26383
|
+
return cache.bandWidth;
|
|
26384
|
+
}
|
|
26385
|
+
const valueSet = new Set();
|
|
26386
|
+
const orient = this.getOrient();
|
|
26387
|
+
eachSeries(this._regions, s => {
|
|
26388
|
+
var _a, _b, _c, _d;
|
|
26389
|
+
if (s.type !== SeriesTypeEnum.bar) {
|
|
26390
|
+
return;
|
|
26391
|
+
}
|
|
26392
|
+
const barSeries = s;
|
|
26393
|
+
const field = isXAxis(orient) && barSeries.direction === "vertical"
|
|
26394
|
+
? barSeries.fieldX[0]
|
|
26395
|
+
: isYAxis(orient) && barSeries.direction === "horizontal"
|
|
26396
|
+
? barSeries.fieldY[0]
|
|
26397
|
+
: undefined;
|
|
26398
|
+
const values = (field ? (_d = (_c = (_b = (_a = s.getViewDataStatistics) === null || _a === void 0 ? void 0 : _a.call(s)) === null || _b === void 0 ? void 0 : _b.latestData) === null || _c === void 0 ? void 0 : _c[field]) === null || _d === void 0 ? void 0 : _d.values : undefined);
|
|
26399
|
+
values === null || values === void 0 ? void 0 : values.forEach(value => {
|
|
26400
|
+
const numericValue = +value;
|
|
26401
|
+
if (Number.isFinite(numericValue)) {
|
|
26402
|
+
valueSet.add(numericValue);
|
|
26403
|
+
}
|
|
26404
|
+
});
|
|
26405
|
+
}, {
|
|
26406
|
+
userId: this._seriesUserId,
|
|
26407
|
+
specIndex: this._seriesIndex
|
|
26408
|
+
});
|
|
26409
|
+
const values = Array.from(valueSet).sort((a, b) => a - b);
|
|
26410
|
+
if (values.length < 2) {
|
|
26411
|
+
return undefined;
|
|
26412
|
+
}
|
|
26413
|
+
let minStep = Infinity;
|
|
26414
|
+
let lastValue = values[0];
|
|
26415
|
+
for (let i = 1; i < values.length; i++) {
|
|
26416
|
+
const value = values[i];
|
|
26417
|
+
const step = value - lastValue;
|
|
26418
|
+
if (step > 0 && step < minStep) {
|
|
26419
|
+
minStep = step;
|
|
26420
|
+
}
|
|
26421
|
+
lastValue = value;
|
|
26422
|
+
}
|
|
26423
|
+
const bandWidth = minStep < Infinity ? Math.abs(((rangeEnd - rangeStart) / (domainEnd - domainStart)) * minStep) : undefined;
|
|
26424
|
+
if (!Number.isFinite(bandWidth)) {
|
|
26425
|
+
return undefined;
|
|
26426
|
+
}
|
|
26427
|
+
this._continuousBarBandwidthCache = {
|
|
26428
|
+
scale,
|
|
26429
|
+
domainStart,
|
|
26430
|
+
domainEnd,
|
|
26431
|
+
rangeStart,
|
|
26432
|
+
rangeEnd,
|
|
26433
|
+
bandWidth
|
|
26434
|
+
};
|
|
26435
|
+
return bandWidth;
|
|
26436
|
+
}
|
|
26279
26437
|
afterCompile() {
|
|
26280
26438
|
var _a;
|
|
26281
26439
|
const product = (_a = this._axisMark) === null || _a === void 0 ? void 0 : _a.getProduct();
|
|
@@ -26537,6 +26695,13 @@ class CartesianAxis extends AxisComponent {
|
|
|
26537
26695
|
}
|
|
26538
26696
|
initEvent() {
|
|
26539
26697
|
super.initEvent();
|
|
26698
|
+
eachSeries(this._regions, s => {
|
|
26699
|
+
var _a, _b;
|
|
26700
|
+
(_b = (_a = s.getViewDataStatistics) === null || _a === void 0 ? void 0 : _a.call(s)) === null || _b === void 0 ? void 0 : _b.target.addListener('change', this._clearContinuousBarBandwidthCache);
|
|
26701
|
+
}, {
|
|
26702
|
+
userId: this._seriesUserId,
|
|
26703
|
+
specIndex: this._seriesIndex
|
|
26704
|
+
});
|
|
26540
26705
|
if (this._specVisible) {
|
|
26541
26706
|
this.event.on(ChartEvent.layoutEnd, this._updateAxisLayout);
|
|
26542
26707
|
this.event.on(ChartEvent.layoutEnd, this._fixAxisOnZero);
|
|
@@ -28547,11 +28712,28 @@ class Interaction {
|
|
|
28547
28712
|
getStatedGraphics(trigger) {
|
|
28548
28713
|
return this._stateGraphicsByTrigger.get(trigger);
|
|
28549
28714
|
}
|
|
28715
|
+
_getMarkById(trigger) {
|
|
28716
|
+
const markById = new Map();
|
|
28717
|
+
trigger.getMarks().forEach(mark => {
|
|
28718
|
+
if (mark) {
|
|
28719
|
+
markById.set(mark.id, mark);
|
|
28720
|
+
}
|
|
28721
|
+
});
|
|
28722
|
+
return markById;
|
|
28723
|
+
}
|
|
28724
|
+
_hasAnimationByGraphicState(graphic, markById) {
|
|
28725
|
+
var _a, _b, _c;
|
|
28726
|
+
const mark = (_b = (_a = graphic.parent) === null || _a === void 0 ? void 0 : _a.mark) !== null && _b !== void 0 ? _b : markById.get(graphic.context.markId);
|
|
28727
|
+
return !!((_c = mark === null || mark === void 0 ? void 0 : mark.hasAnimationByState) === null || _c === void 0 ? void 0 : _c.call(mark, 'state'));
|
|
28728
|
+
}
|
|
28550
28729
|
updateStates(trigger, newStatedGraphics, prevStatedGraphics, state, reverseState) {
|
|
28551
28730
|
if (this._disableTriggerEvent) {
|
|
28552
28731
|
return [];
|
|
28553
28732
|
}
|
|
28554
28733
|
if (!newStatedGraphics || !newStatedGraphics.length) {
|
|
28734
|
+
if (prevStatedGraphics && prevStatedGraphics.length) {
|
|
28735
|
+
this.clearAllStatesOfTrigger(trigger, state, reverseState);
|
|
28736
|
+
}
|
|
28555
28737
|
return [];
|
|
28556
28738
|
}
|
|
28557
28739
|
if (state && reverseState) {
|
|
@@ -28575,42 +28757,36 @@ class Interaction {
|
|
|
28575
28757
|
}
|
|
28576
28758
|
toggleReverseStateOfGraphics(trigger, newStatedGraphics, prevStatedGraphics, reverseState) {
|
|
28577
28759
|
const markIdByState = trigger.getMarkIdByState();
|
|
28760
|
+
const markById = this._getMarkById(trigger);
|
|
28578
28761
|
prevStatedGraphics.forEach(g => {
|
|
28579
|
-
var _a;
|
|
28580
28762
|
const hasReverse = reverseState && markIdByState[reverseState] && markIdByState[reverseState].includes(g.context.markId);
|
|
28581
28763
|
if (hasReverse) {
|
|
28582
|
-
const
|
|
28583
|
-
const hasAnimation = m.hasAnimationByState && m.hasAnimationByState('state');
|
|
28764
|
+
const hasAnimation = this._hasAnimationByGraphicState(g, markById);
|
|
28584
28765
|
addGraphicState(g, reverseState, true, hasAnimation);
|
|
28585
28766
|
}
|
|
28586
28767
|
});
|
|
28587
28768
|
newStatedGraphics.forEach(g => {
|
|
28588
|
-
var _a;
|
|
28589
28769
|
const hasReverse = reverseState && markIdByState[reverseState] && markIdByState[reverseState].includes(g.context.markId);
|
|
28590
28770
|
if (hasReverse) {
|
|
28591
|
-
const
|
|
28592
|
-
const hasAnimation = m.hasAnimationByState && m.hasAnimationByState('state');
|
|
28771
|
+
const hasAnimation = this._hasAnimationByGraphicState(g, markById);
|
|
28593
28772
|
removeGraphicState(g, reverseState, hasAnimation);
|
|
28594
28773
|
}
|
|
28595
28774
|
});
|
|
28596
28775
|
}
|
|
28597
28776
|
toggleStateOfGraphics(trigger, newStatedGraphics, prevStatedGraphics, state) {
|
|
28598
28777
|
const markIdByState = trigger.getMarkIdByState();
|
|
28778
|
+
const markById = this._getMarkById(trigger);
|
|
28599
28779
|
prevStatedGraphics.forEach(g => {
|
|
28600
|
-
var _a;
|
|
28601
28780
|
const hasState = state && markIdByState[state] && markIdByState[state].includes(g.context.markId);
|
|
28602
28781
|
if (hasState) {
|
|
28603
|
-
const
|
|
28604
|
-
const hasAnimation = m.hasAnimationByState && m.hasAnimationByState('state');
|
|
28782
|
+
const hasAnimation = this._hasAnimationByGraphicState(g, markById);
|
|
28605
28783
|
removeGraphicState(g, state, hasAnimation);
|
|
28606
28784
|
}
|
|
28607
28785
|
});
|
|
28608
28786
|
newStatedGraphics.forEach(g => {
|
|
28609
|
-
var _a;
|
|
28610
28787
|
const hasState = state && markIdByState[state] && markIdByState[state].includes(g.context.markId);
|
|
28611
28788
|
if (hasState) {
|
|
28612
|
-
const
|
|
28613
|
-
const hasAnimation = m.hasAnimationByState && m.hasAnimationByState('state');
|
|
28789
|
+
const hasAnimation = this._hasAnimationByGraphicState(g, markById);
|
|
28614
28790
|
addGraphicState(g, state, true, hasAnimation);
|
|
28615
28791
|
}
|
|
28616
28792
|
});
|
|
@@ -32444,6 +32620,27 @@ class BarSeries extends CartesianSeries {
|
|
|
32444
32620
|
const policy = super._getSpecUpdatePolicy();
|
|
32445
32621
|
return Object.assign(Object.assign({}, policy), { compileOnlyKeys: Object.assign(Object.assign({}, policy.compileOnlyKeys), BAR_SERIES_COMPILE_ONLY_KEYS) });
|
|
32446
32622
|
}
|
|
32623
|
+
getStatisticFields() {
|
|
32624
|
+
var _a;
|
|
32625
|
+
const fields = super.getStatisticFields();
|
|
32626
|
+
const positionAxisHelper = this.direction === "horizontal" ? this.getYAxisHelper() : this.getXAxisHelper();
|
|
32627
|
+
const positionFields = this.direction === "horizontal" ? this._fieldY : this._fieldX;
|
|
32628
|
+
const positionScale = (_a = positionAxisHelper === null || positionAxisHelper === void 0 ? void 0 : positionAxisHelper.getScale) === null || _a === void 0 ? void 0 : _a.call(positionAxisHelper, 0);
|
|
32629
|
+
if (positionScale && isContinuous(positionScale.type)) {
|
|
32630
|
+
positionFields.forEach(field => {
|
|
32631
|
+
const fieldStatistics = fields.find(entry => entry.key === field);
|
|
32632
|
+
if (fieldStatistics) {
|
|
32633
|
+
if (!fieldStatistics.operations.includes('values')) {
|
|
32634
|
+
fieldStatistics.operations.push('values');
|
|
32635
|
+
}
|
|
32636
|
+
}
|
|
32637
|
+
else {
|
|
32638
|
+
fields.push({ key: field, operations: ['values'] });
|
|
32639
|
+
}
|
|
32640
|
+
});
|
|
32641
|
+
}
|
|
32642
|
+
return fields;
|
|
32643
|
+
}
|
|
32447
32644
|
initMark() {
|
|
32448
32645
|
this._initBarBackgroundMark();
|
|
32449
32646
|
this._barMark = this._createMark(Object.assign(Object.assign({}, BarSeries.mark.bar), { name: this._barMarkName, type: this._barMarkType }), {
|
|
@@ -32880,14 +33077,19 @@ class BarSeries extends CartesianSeries {
|
|
|
32880
33077
|
this._barMark.setAnimationConfig(animationConfig((_b = Factory.getAnimationInKey('bar')) === null || _b === void 0 ? void 0 : _b(barAnimationParams, appearPreset), userAnimationConfig(this._barMarkName, this._spec, this._markAttributeContext), animationParams));
|
|
32881
33078
|
}
|
|
32882
33079
|
_getBarWidth(axisHelper, scaleDepth) {
|
|
32883
|
-
var _a
|
|
33080
|
+
var _a;
|
|
32884
33081
|
const depthFromSpec = this._groups ? this._groups.fields.length : 1;
|
|
32885
33082
|
const depth = isNil$1(scaleDepth) ? depthFromSpec : Math.min(depthFromSpec, scaleDepth);
|
|
32886
|
-
const bandWidth = (_b = (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1)) !== null && _b !== void 0 ? _b : DefaultBandWidth$2;
|
|
32887
33083
|
const hasBarWidth = isValid$1(this._spec.barWidth) && depth === depthFromSpec;
|
|
33084
|
+
const useFixedWidth = hasBarWidth &&
|
|
33085
|
+
typeof this._spec.barWidth === 'number' &&
|
|
33086
|
+
typeof this._spec.barMinWidth !== 'string' &&
|
|
33087
|
+
typeof this._spec.barMaxWidth !== 'string';
|
|
33088
|
+
const axisBandWidth = useFixedWidth ? undefined : (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1);
|
|
33089
|
+
const bandWidth = axisBandWidth !== null && axisBandWidth !== void 0 ? axisBandWidth : DefaultBandWidth$2;
|
|
32888
33090
|
const hasBarMinWidth = isValid$1(this._spec.barMinWidth);
|
|
32889
33091
|
const hasBarMaxWidth = isValid$1(this._spec.barMaxWidth);
|
|
32890
|
-
let width = bandWidth;
|
|
33092
|
+
let width = axisHelper.isContinuous && !isNil$1(axisBandWidth) && !hasBarWidth ? bandWidth * 0.5 : bandWidth;
|
|
32891
33093
|
if (hasBarWidth) {
|
|
32892
33094
|
width = getActualNumValue(this._spec.barWidth, bandWidth);
|
|
32893
33095
|
}
|
|
@@ -32900,7 +33102,7 @@ class BarSeries extends CartesianSeries {
|
|
|
32900
33102
|
return width;
|
|
32901
33103
|
}
|
|
32902
33104
|
_getPosition(direction, datum, scaleDepth, mark) {
|
|
32903
|
-
var _a, _b, _c, _d, _e;
|
|
33105
|
+
var _a, _b, _c, _d, _e, _f;
|
|
32904
33106
|
let axisHelper;
|
|
32905
33107
|
let sizeAttribute;
|
|
32906
33108
|
let dataToPosition;
|
|
@@ -32945,7 +33147,7 @@ class BarSeries extends CartesianSeries {
|
|
|
32945
33147
|
totalWidth += totalWidth + (groupCount - 1) * gap;
|
|
32946
33148
|
}
|
|
32947
33149
|
}
|
|
32948
|
-
const center = scale.scale(datum[groupFields[0]]) + axisHelper.getBandwidth(0) / 2;
|
|
33150
|
+
const center = scale.scale(datum[groupFields[0]]) + ((_f = axisHelper.getBandwidth(0)) !== null && _f !== void 0 ? _f : bandWidth) / 2;
|
|
32949
33151
|
return center - totalWidth / 2 + offSet;
|
|
32950
33152
|
}
|
|
32951
33153
|
const continuous = isContinuous(scale.type || 'band');
|
|
@@ -36098,7 +36300,7 @@ const GLYPH_STATE_ATTRIBUTE_UPDATE_TYPE = 2;
|
|
|
36098
36300
|
class GlyphMark extends BaseMark {
|
|
36099
36301
|
constructor() {
|
|
36100
36302
|
super(...arguments);
|
|
36101
|
-
this._setStateOfGraphic = (g) => {
|
|
36303
|
+
this._setStateOfGraphic = (g, hasAnimation) => {
|
|
36102
36304
|
g.clearStates();
|
|
36103
36305
|
if (g.context.diffState === DiffState.enter || g.context.diffState === DiffState.update) {
|
|
36104
36306
|
g.glyphStateProxy = (stateName, nexStates) => {
|
|
@@ -36114,7 +36316,7 @@ class GlyphMark extends BaseMark {
|
|
|
36114
36316
|
}
|
|
36115
36317
|
return glyphAttrs;
|
|
36116
36318
|
};
|
|
36117
|
-
g.useStates(g.context.states);
|
|
36319
|
+
g.useStates(g.context.states, hasAnimation);
|
|
36118
36320
|
}
|
|
36119
36321
|
};
|
|
36120
36322
|
}
|
|
@@ -36193,12 +36395,13 @@ class GlyphMark extends BaseMark {
|
|
|
36193
36395
|
_createGraphic(attrs = {}) {
|
|
36194
36396
|
const glyph = createGlyph(attrs);
|
|
36195
36397
|
glyph.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(glyph);
|
|
36196
|
-
glyph.
|
|
36197
|
-
|
|
36198
|
-
|
|
36398
|
+
const onAttributeUpdate = glyph.onAttributeUpdate.bind(glyph);
|
|
36399
|
+
glyph.onAttributeUpdate = (context) => {
|
|
36400
|
+
onAttributeUpdate(context);
|
|
36401
|
+
if ((context === null || context === void 0 ? void 0 : context.type) === GLYPH_STATE_ATTRIBUTE_UPDATE_TYPE) {
|
|
36199
36402
|
this._syncInheritedStyleAttrs(glyph, glyph.attribute);
|
|
36200
36403
|
}
|
|
36201
|
-
}
|
|
36404
|
+
};
|
|
36202
36405
|
const subMarks = this._subMarks;
|
|
36203
36406
|
if (subMarks) {
|
|
36204
36407
|
const subGraphics = [];
|
|
@@ -47176,14 +47379,26 @@ const funnel = (originData, op) => {
|
|
|
47176
47379
|
if (!data || data.length === 0) {
|
|
47177
47380
|
return data;
|
|
47178
47381
|
}
|
|
47179
|
-
const { asTransformRatio, asReachRatio, asHeightRatio, asValueRatio, asNextValueRatio, asLastValueRatio, asLastValue, asCurrentValue, asNextValue
|
|
47382
|
+
const { asTransformRatio, asReachRatio, asHeightRatio, asValueRatio, asNextValueRatio, asLastValueRatio, asLastValue, asCurrentValue, asNextValue } = op;
|
|
47180
47383
|
const valueField = resolveOptionValue$2(op.valueField);
|
|
47181
47384
|
const heightVisual = (_a = resolveOptionValue$2(op.heightVisual)) !== null && _a !== void 0 ? _a : false;
|
|
47182
47385
|
const isCone = (_b = resolveOptionValue$2(op.isCone)) !== null && _b !== void 0 ? _b : true;
|
|
47183
47386
|
const range = resolveOptionValue$2(op.range);
|
|
47184
|
-
const max = data.reduce((m, d) =>
|
|
47185
|
-
|
|
47186
|
-
|
|
47387
|
+
const max = data.reduce((m, d) => {
|
|
47388
|
+
const value = Number.parseFloat(d[valueField]);
|
|
47389
|
+
return isValidNumber$1(value) ? Math.max(m, value) : m;
|
|
47390
|
+
}, -Infinity);
|
|
47391
|
+
const rangeMin = (_c = range === null || range === void 0 ? void 0 : range.min) !== null && _c !== void 0 ? _c : 0;
|
|
47392
|
+
const rangeMax = (_d = range === null || range === void 0 ? void 0 : range.max) !== null && _d !== void 0 ? _d : max;
|
|
47393
|
+
const getValueRatio = (value) => {
|
|
47394
|
+
if (!isValidNumber$1(value) || !isValidNumber$1(rangeMin) || !isValidNumber$1(rangeMax)) {
|
|
47395
|
+
return 0;
|
|
47396
|
+
}
|
|
47397
|
+
if (rangeMin === rangeMax) {
|
|
47398
|
+
return value < rangeMin ? 0 : 1;
|
|
47399
|
+
}
|
|
47400
|
+
return clamp$1((value - rangeMin) / (rangeMax - rangeMin), 0, 1);
|
|
47401
|
+
};
|
|
47187
47402
|
data.forEach((d, i) => {
|
|
47188
47403
|
var _a, _b;
|
|
47189
47404
|
const currentValue = Number.parseFloat(d[valueField]);
|
|
@@ -47191,15 +47406,16 @@ const funnel = (originData, op) => {
|
|
|
47191
47406
|
const nextValue = Number.parseFloat((_b = data[i + 1]) === null || _b === void 0 ? void 0 : _b[valueField]);
|
|
47192
47407
|
const transformRatio = !isValidNumber$1(nextValue * currentValue) || currentValue === 0 ? 0 : nextValue / currentValue;
|
|
47193
47408
|
const reachRatio = !isValidNumber$1(currentValue * lastValue) || lastValue === 0 ? 0 : currentValue / lastValue;
|
|
47409
|
+
const valueRatio = getValueRatio(currentValue);
|
|
47194
47410
|
asLastValue && (d[asLastValue] = lastValue);
|
|
47195
47411
|
asNextValue && (d[asNextValue] = nextValue);
|
|
47196
47412
|
asTransformRatio && (d[asTransformRatio] = transformRatio);
|
|
47197
47413
|
asReachRatio && (d[asReachRatio] = i === 0 ? 1 : reachRatio);
|
|
47198
47414
|
asHeightRatio && (d[asHeightRatio] = heightVisual === true ? transformRatio : 1 / data.length);
|
|
47199
|
-
asValueRatio && (d[asValueRatio] =
|
|
47415
|
+
asValueRatio && (d[asValueRatio] = valueRatio);
|
|
47200
47416
|
asNextValueRatio &&
|
|
47201
|
-
(d[asNextValueRatio] = i === data.length - 1 ? (isCone ? 0 : d[asValueRatio]) : nextValue
|
|
47202
|
-
asLastValueRatio && (d[asLastValueRatio] = i === 0 ? 1 : lastValue
|
|
47417
|
+
(d[asNextValueRatio] = i === data.length - 1 ? (isCone ? 0 : d[asValueRatio]) : getValueRatio(nextValue));
|
|
47418
|
+
asLastValueRatio && (d[asLastValueRatio] = i === 0 ? 1 : getValueRatio(lastValue));
|
|
47203
47419
|
asCurrentValue && (d[asCurrentValue] = currentValue);
|
|
47204
47420
|
});
|
|
47205
47421
|
return data;
|
|
@@ -49390,18 +49606,18 @@ class SankeySeries extends CartesianSeries {
|
|
|
49390
49606
|
highlightNodes.push(linkDatum.target);
|
|
49391
49607
|
}
|
|
49392
49608
|
removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
|
|
49393
|
-
addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true);
|
|
49609
|
+
addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true, this._hasLinkStateAnimation());
|
|
49394
49610
|
}
|
|
49395
49611
|
else if (linkDatum.target === nodeDatum.key) {
|
|
49396
49612
|
if (!highlightNodes.includes(linkDatum.source)) {
|
|
49397
49613
|
highlightNodes.push(linkDatum.source);
|
|
49398
49614
|
}
|
|
49399
49615
|
removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
|
|
49400
|
-
addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true);
|
|
49616
|
+
addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true, this._hasLinkStateAnimation());
|
|
49401
49617
|
}
|
|
49402
49618
|
else {
|
|
49403
49619
|
removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS);
|
|
49404
|
-
addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true);
|
|
49620
|
+
addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true, this._hasLinkStateAnimation());
|
|
49405
49621
|
}
|
|
49406
49622
|
});
|
|
49407
49623
|
}
|
|
@@ -49421,11 +49637,11 @@ class SankeySeries extends CartesianSeries {
|
|
|
49421
49637
|
allLinkElements.forEach(linkEl => {
|
|
49422
49638
|
if (linkEl === graphic) {
|
|
49423
49639
|
removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
|
|
49424
|
-
addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio: 1 });
|
|
49640
|
+
addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio: 1 }, true, this._hasLinkStateAnimation());
|
|
49425
49641
|
}
|
|
49426
49642
|
else {
|
|
49427
49643
|
removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS);
|
|
49428
|
-
addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true);
|
|
49644
|
+
addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true, this._hasLinkStateAnimation());
|
|
49429
49645
|
}
|
|
49430
49646
|
});
|
|
49431
49647
|
}
|
|
@@ -49539,11 +49755,11 @@ class SankeySeries extends CartesianSeries {
|
|
|
49539
49755
|
const linkDatum = getDatumOfGraphic(linkEl);
|
|
49540
49756
|
if (highlightLinks.includes((_a = linkDatum.key) !== null && _a !== void 0 ? _a : linkDatum.index)) {
|
|
49541
49757
|
removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
|
|
49542
|
-
addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true);
|
|
49758
|
+
addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true, this._hasLinkStateAnimation());
|
|
49543
49759
|
}
|
|
49544
49760
|
else {
|
|
49545
49761
|
removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS);
|
|
49546
|
-
addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true);
|
|
49762
|
+
addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true, this._hasLinkStateAnimation());
|
|
49547
49763
|
}
|
|
49548
49764
|
});
|
|
49549
49765
|
}
|
|
@@ -49592,7 +49808,7 @@ class SankeySeries extends CartesianSeries {
|
|
|
49592
49808
|
}, 0);
|
|
49593
49809
|
const ratio = val / linkDatum.value;
|
|
49594
49810
|
removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
|
|
49595
|
-
addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio });
|
|
49811
|
+
addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio }, true, this._hasLinkStateAnimation());
|
|
49596
49812
|
return;
|
|
49597
49813
|
}
|
|
49598
49814
|
if (upSelectedLink) {
|
|
@@ -49605,11 +49821,11 @@ class SankeySeries extends CartesianSeries {
|
|
|
49605
49821
|
removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
|
|
49606
49822
|
addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, {
|
|
49607
49823
|
ratio: upSelectedLink.value / linkDatum.value
|
|
49608
|
-
});
|
|
49824
|
+
}, true, this._hasLinkStateAnimation());
|
|
49609
49825
|
return;
|
|
49610
49826
|
}
|
|
49611
49827
|
removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS);
|
|
49612
|
-
addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true);
|
|
49828
|
+
addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true, this._hasLinkStateAnimation());
|
|
49613
49829
|
return;
|
|
49614
49830
|
});
|
|
49615
49831
|
if (this._nodeMark) {
|
|
@@ -49677,7 +49893,7 @@ class SankeySeries extends CartesianSeries {
|
|
|
49677
49893
|
const originalDatum = linkDatum.datum;
|
|
49678
49894
|
if (linkDatum.source === curLinkDatum.source && linkDatum.target === curLinkDatum.target) {
|
|
49679
49895
|
removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
|
|
49680
|
-
addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio: 1 });
|
|
49896
|
+
addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio: 1 }, true, this._hasLinkStateAnimation());
|
|
49681
49897
|
return;
|
|
49682
49898
|
}
|
|
49683
49899
|
const selectedDatum = originalDatum
|
|
@@ -49705,7 +49921,7 @@ class SankeySeries extends CartesianSeries {
|
|
|
49705
49921
|
}, 0);
|
|
49706
49922
|
const ratio = val / linkDatum.value;
|
|
49707
49923
|
removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
|
|
49708
|
-
addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio });
|
|
49924
|
+
addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio }, true, this._hasLinkStateAnimation());
|
|
49709
49925
|
return;
|
|
49710
49926
|
}
|
|
49711
49927
|
const upSelectedLink = upstreamLinks.find((upLink) => upLink.source === linkDatum.source && upLink.target === linkDatum.target);
|
|
@@ -49719,11 +49935,11 @@ class SankeySeries extends CartesianSeries {
|
|
|
49719
49935
|
removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
|
|
49720
49936
|
addRuntimeState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, {
|
|
49721
49937
|
ratio: upSelectedLink.value / linkDatum.value
|
|
49722
|
-
});
|
|
49938
|
+
}, true, this._hasLinkStateAnimation());
|
|
49723
49939
|
return;
|
|
49724
49940
|
}
|
|
49725
49941
|
removeGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS);
|
|
49726
|
-
addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true);
|
|
49942
|
+
addGraphicState(linkEl, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true, this._hasLinkStateAnimation());
|
|
49727
49943
|
return;
|
|
49728
49944
|
});
|
|
49729
49945
|
this._highLightElements(allNodeElements, highlightNodes);
|
|
@@ -49735,6 +49951,16 @@ class SankeySeries extends CartesianSeries {
|
|
|
49735
49951
|
var _a;
|
|
49736
49952
|
return (_a = this._spec.direction) !== null && _a !== void 0 ? _a : 'horizontal';
|
|
49737
49953
|
}
|
|
49954
|
+
_hasStateAnimation(mark) {
|
|
49955
|
+
var _a;
|
|
49956
|
+
return isAnimationEnabledForSeries(this) && !!((_a = mark === null || mark === void 0 ? void 0 : mark.hasAnimationByState) === null || _a === void 0 ? void 0 : _a.call(mark, 'state'));
|
|
49957
|
+
}
|
|
49958
|
+
_hasLinkStateAnimation() {
|
|
49959
|
+
return this._hasStateAnimation(this._linkMark);
|
|
49960
|
+
}
|
|
49961
|
+
_hasNodeStateAnimation() {
|
|
49962
|
+
return this._hasStateAnimation(this._nodeMark);
|
|
49963
|
+
}
|
|
49738
49964
|
getCategoryField() {
|
|
49739
49965
|
return this._categoryField;
|
|
49740
49966
|
}
|
|
@@ -50028,10 +50254,10 @@ class SankeySeries extends CartesianSeries {
|
|
|
50028
50254
|
graphics.forEach(g => {
|
|
50029
50255
|
removeGraphicState(g, [STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]);
|
|
50030
50256
|
if (highlightNodes.includes(getDatumOfGraphic(g).key)) {
|
|
50031
|
-
addGraphicState(g, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true);
|
|
50257
|
+
addGraphicState(g, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true, this._hasNodeStateAnimation());
|
|
50032
50258
|
}
|
|
50033
50259
|
else {
|
|
50034
|
-
addGraphicState(g, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true);
|
|
50260
|
+
addGraphicState(g, STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true, this._hasNodeStateAnimation());
|
|
50035
50261
|
}
|
|
50036
50262
|
});
|
|
50037
50263
|
}
|
|
@@ -64996,8 +65222,17 @@ const registerGridLayout = () => {
|
|
|
64996
65222
|
Factory.registerLayout(GridLayout.type, GridLayout);
|
|
64997
65223
|
};
|
|
64998
65224
|
|
|
65225
|
+
const installPoptip = (app) => {
|
|
65226
|
+
if (app) {
|
|
65227
|
+
installPoptipToApp(app);
|
|
65228
|
+
}
|
|
65229
|
+
else {
|
|
65230
|
+
loadPoptip();
|
|
65231
|
+
}
|
|
65232
|
+
};
|
|
64999
65233
|
const registerPoptip = () => {
|
|
65000
|
-
|
|
65234
|
+
Factory.registerRuntimePluginInstaller('poptipForText', installPoptip);
|
|
65235
|
+
installPoptip();
|
|
65001
65236
|
};
|
|
65002
65237
|
|
|
65003
65238
|
const TOOLTIP_PREFIX = 'vchart-tooltip';
|