@visactor/vchart 2.1.0-alpha.2 → 2.1.0-alpha.4
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 +518 -82
- package/build/index.js +518 -82
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/base/base-chart-transformer.js +2 -2
- package/cjs/chart/base/base-chart-transformer.js.map +1 -1
- package/cjs/chart/base/base-chart.d.ts +8 -0
- package/cjs/chart/base/base-chart.js +72 -11
- package/cjs/chart/base/base-chart.js.map +1 -1
- package/cjs/component/axis/base-axis.js +3 -5
- package/cjs/component/axis/base-axis.js.map +1 -1
- package/cjs/component/axis/mixin/linear-axis-mixin.js +7 -10
- package/cjs/component/axis/mixin/linear-axis-mixin.js.map +1 -1
- package/cjs/component/brush/brush.d.ts +1 -0
- package/cjs/component/brush/brush.js +19 -5
- package/cjs/component/brush/brush.js.map +1 -1
- package/cjs/component/crosshair/base.d.ts +3 -0
- package/cjs/component/crosshair/base.js +30 -2
- package/cjs/component/crosshair/base.js.map +1 -1
- package/cjs/component/custom-mark/custom-mark.d.ts +3 -0
- package/cjs/component/custom-mark/custom-mark.js +27 -3
- package/cjs/component/custom-mark/custom-mark.js.map +1 -1
- package/cjs/component/data-zoom/data-filter-base-component.d.ts +2 -0
- package/cjs/component/data-zoom/data-filter-base-component.js +15 -2
- package/cjs/component/data-zoom/data-filter-base-component.js.map +1 -1
- package/cjs/component/data-zoom/data-zoom/data-zoom.d.ts +1 -0
- package/cjs/component/data-zoom/data-zoom/data-zoom.js +19 -1
- package/cjs/component/data-zoom/data-zoom/data-zoom.js.map +1 -1
- package/cjs/component/data-zoom/scroll-bar/scroll-bar.d.ts +1 -0
- package/cjs/component/data-zoom/scroll-bar/scroll-bar.js +12 -1
- package/cjs/component/data-zoom/scroll-bar/scroll-bar.js.map +1 -1
- package/cjs/component/indicator/indicator.d.ts +1 -0
- package/cjs/component/indicator/indicator.js +9 -0
- package/cjs/component/indicator/indicator.js.map +1 -1
- package/cjs/component/label/base-label.js +6 -2
- package/cjs/component/label/base-label.js.map +1 -1
- package/cjs/component/marker/base-marker.d.ts +7 -0
- package/cjs/component/marker/base-marker.js +77 -8
- package/cjs/component/marker/base-marker.js.map +1 -1
- package/cjs/component/marker/mark-area/cartesian-mark-area.js +3 -3
- package/cjs/component/marker/mark-area/cartesian-mark-area.js.map +1 -1
- package/cjs/component/marker/mark-area/polar-mark-area.js +2 -2
- package/cjs/component/marker/mark-area/polar-mark-area.js.map +1 -1
- package/cjs/component/marker/mark-line/cartesian-mark-line.js +2 -2
- package/cjs/component/marker/mark-line/cartesian-mark-line.js.map +1 -1
- package/cjs/component/marker/mark-line/polar-mark-line.js +2 -2
- package/cjs/component/marker/mark-line/polar-mark-line.js.map +1 -1
- package/cjs/component/marker/mark-point/base-mark-point.js +4 -3
- package/cjs/component/marker/mark-point/base-mark-point.js.map +1 -1
- package/cjs/component/marker/mark-point/cartesian-mark-point.js +2 -2
- package/cjs/component/marker/mark-point/cartesian-mark-point.js.map +1 -1
- package/cjs/component/marker/mark-point/polar-mark-point.js +1 -1
- package/cjs/component/marker/mark-point/polar-mark-point.js.map +1 -1
- package/cjs/component/marker/utils.d.ts +4 -4
- package/cjs/component/marker/utils.js +27 -23
- package/cjs/component/marker/utils.js.map +1 -1
- package/cjs/component/player/player.d.ts +1 -0
- package/cjs/component/player/player.js +10 -0
- package/cjs/component/player/player.js.map +1 -1
- package/cjs/component/tooltip/tooltip.d.ts +1 -0
- package/cjs/component/tooltip/tooltip.js +8 -0
- package/cjs/component/tooltip/tooltip.js.map +1 -1
- package/cjs/constant/funnel.js +1 -2
- package/cjs/constant/scatter.js +2 -1
- package/cjs/constant/scroll-bar.js +1 -1
- package/cjs/constant/sunburst.js +1 -1
- package/cjs/constant/waterfall.js +1 -1
- package/cjs/constant/word-cloud.js +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 +1 -1
- package/cjs/series/base/base-series.js +13 -5
- package/cjs/series/base/base-series.js.map +1 -1
- package/esm/chart/base/base-chart-transformer.js +2 -2
- package/esm/chart/base/base-chart-transformer.js.map +1 -1
- package/esm/chart/base/base-chart.d.ts +8 -0
- package/esm/chart/base/base-chart.js +69 -9
- package/esm/chart/base/base-chart.js.map +1 -1
- package/esm/component/axis/base-axis.js +3 -5
- package/esm/component/axis/base-axis.js.map +1 -1
- package/esm/component/axis/mixin/linear-axis-mixin.js +7 -10
- package/esm/component/axis/mixin/linear-axis-mixin.js.map +1 -1
- package/esm/component/brush/brush.d.ts +1 -0
- package/esm/component/brush/brush.js +17 -4
- package/esm/component/brush/brush.js.map +1 -1
- package/esm/component/crosshair/base.d.ts +3 -0
- package/esm/component/crosshair/base.js +26 -2
- package/esm/component/crosshair/base.js.map +1 -1
- package/esm/component/custom-mark/custom-mark.d.ts +3 -0
- package/esm/component/custom-mark/custom-mark.js +27 -2
- package/esm/component/custom-mark/custom-mark.js.map +1 -1
- package/esm/component/data-zoom/data-filter-base-component.d.ts +2 -0
- package/esm/component/data-zoom/data-filter-base-component.js +14 -2
- package/esm/component/data-zoom/data-filter-base-component.js.map +1 -1
- package/esm/component/data-zoom/data-zoom/data-zoom.d.ts +1 -0
- package/esm/component/data-zoom/data-zoom/data-zoom.js +20 -0
- package/esm/component/data-zoom/data-zoom/data-zoom.js.map +1 -1
- package/esm/component/data-zoom/scroll-bar/scroll-bar.d.ts +1 -0
- package/esm/component/data-zoom/scroll-bar/scroll-bar.js +12 -1
- package/esm/component/data-zoom/scroll-bar/scroll-bar.js.map +1 -1
- package/esm/component/indicator/indicator.d.ts +1 -0
- package/esm/component/indicator/indicator.js +9 -0
- package/esm/component/indicator/indicator.js.map +1 -1
- package/esm/component/label/base-label.js +5 -1
- package/esm/component/label/base-label.js.map +1 -1
- package/esm/component/marker/base-marker.d.ts +7 -0
- package/esm/component/marker/base-marker.js +76 -7
- package/esm/component/marker/base-marker.js.map +1 -1
- package/esm/component/marker/mark-area/cartesian-mark-area.js +3 -3
- package/esm/component/marker/mark-area/cartesian-mark-area.js.map +1 -1
- package/esm/component/marker/mark-area/polar-mark-area.js +2 -2
- package/esm/component/marker/mark-area/polar-mark-area.js.map +1 -1
- package/esm/component/marker/mark-line/cartesian-mark-line.js +2 -2
- package/esm/component/marker/mark-line/cartesian-mark-line.js.map +1 -1
- package/esm/component/marker/mark-line/polar-mark-line.js +2 -2
- package/esm/component/marker/mark-line/polar-mark-line.js.map +1 -1
- package/esm/component/marker/mark-point/base-mark-point.js +3 -3
- package/esm/component/marker/mark-point/base-mark-point.js.map +1 -1
- package/esm/component/marker/mark-point/cartesian-mark-point.js +1 -1
- package/esm/component/marker/mark-point/cartesian-mark-point.js.map +1 -1
- package/esm/component/marker/mark-point/polar-mark-point.js +1 -1
- package/esm/component/marker/mark-point/polar-mark-point.js.map +1 -1
- package/esm/component/marker/utils.d.ts +4 -4
- package/esm/component/marker/utils.js +27 -23
- package/esm/component/marker/utils.js.map +1 -1
- package/esm/component/player/player.d.ts +1 -0
- package/esm/component/player/player.js +10 -0
- package/esm/component/player/player.js.map +1 -1
- package/esm/component/tooltip/tooltip.d.ts +1 -0
- package/esm/component/tooltip/tooltip.js +9 -1
- package/esm/component/tooltip/tooltip.js.map +1 -1
- package/esm/constant/funnel.js +1 -2
- package/esm/constant/scatter.js +2 -1
- package/esm/constant/scroll-bar.js +1 -1
- package/esm/constant/sunburst.js +1 -1
- package/esm/constant/waterfall.js +1 -1
- package/esm/constant/word-cloud.js +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 +1 -1
- package/esm/series/base/base-series.js +13 -5
- package/esm/series/base/base-series.js.map +1 -1
- package/package.json +4 -4
|
@@ -54,6 +54,20 @@ const MARKER_COMPONENT_SPEC_KEYS = {
|
|
|
54
54
|
[ComponentTypeEnum.markPoint]: !0,
|
|
55
55
|
[ComponentTypeEnum.markLine]: !0,
|
|
56
56
|
[ComponentTypeEnum.markArea]: !0
|
|
57
|
+
}, MARKER_ADDITION_REMAKE_SPEC_KEYS = {
|
|
58
|
+
autoRange: !0,
|
|
59
|
+
regionId: !0,
|
|
60
|
+
regionIndex: !0,
|
|
61
|
+
seriesId: !0,
|
|
62
|
+
seriesIndex: !0,
|
|
63
|
+
relativeSeriesId: !0,
|
|
64
|
+
relativeSeriesIndex: !0,
|
|
65
|
+
startRelativeSeriesId: !0,
|
|
66
|
+
startRelativeSeriesIndex: !0,
|
|
67
|
+
endRelativeSeriesId: !0,
|
|
68
|
+
endRelativeSeriesIndex: !0,
|
|
69
|
+
specifiedDataSeriesId: !0,
|
|
70
|
+
specifiedDataSeriesIndex: !0
|
|
57
71
|
};
|
|
58
72
|
|
|
59
73
|
export class BaseChart extends CompilableBase {
|
|
@@ -142,6 +156,7 @@ export class BaseChart extends CompilableBase {
|
|
|
142
156
|
const component = this._components.find((s => s.userId === userId));
|
|
143
157
|
if (component) return component;
|
|
144
158
|
}, this.getComponentsByType = type => this._components.filter((c => c.type === type)),
|
|
159
|
+
this._isMarkerAdditionSpecSafeWithoutRemake = spec => !(!spec || "object" != typeof spec || !1 === spec.visible) && !Object.keys(MARKER_ADDITION_REMAKE_SPEC_KEYS).some((key => !isNil(spec[key]))),
|
|
145
160
|
this._paddingSpec = normalizeLayoutPaddingSpec(null !== (_a = spec.padding) && void 0 !== _a ? _a : option.getTheme("padding")),
|
|
146
161
|
this._event = new Event(option.eventDispatcher, option.mode), this._dataSet = option.dataSet,
|
|
147
162
|
this._chartData = new ChartData(this._dataSet), this._modelOption = Object.assign(Object.assign({}, option), {
|
|
@@ -459,7 +474,7 @@ export class BaseChart extends CompilableBase {
|
|
|
459
474
|
return Object.keys(spec).filter((key => !ignoreKeys[key])).sort();
|
|
460
475
|
}
|
|
461
476
|
updateSpec(spec) {
|
|
462
|
-
var _a;
|
|
477
|
+
var _a, _b;
|
|
463
478
|
const result = {
|
|
464
479
|
change: !1,
|
|
465
480
|
reMake: !1,
|
|
@@ -474,7 +489,7 @@ export class BaseChart extends CompilableBase {
|
|
|
474
489
|
result;
|
|
475
490
|
for (let i = 0; i < currentKeys.length; i++) {
|
|
476
491
|
const key = currentKeys[i], currentSpec = this._spec[key], nextSpec = spec[key];
|
|
477
|
-
if (isArray(currentSpec) && currentSpec.length !== array(nextSpec).length && !this.
|
|
492
|
+
if (isArray(currentSpec) && currentSpec.length !== array(nextSpec).length && !this._canChangeMarkerComponentsWithoutRemake(key, currentSpec, nextSpec)) return result.reMake = !0,
|
|
478
493
|
this.setLayoutTag(!0, null, !1), result;
|
|
479
494
|
}
|
|
480
495
|
const oldSpec = this._spec, onlyMarkerComponentsRemoved = this._isOnlyMarkerComponentsRemoved(this._spec, spec, currentKeys), onlyComponentSpecsChanged = this._isOnlyComponentSpecsChanged(this._spec, spec, currentKeys), onlySeriesSpecsChanged = this._isOnlySeriesSpecsChanged(this._spec, spec, currentKeys);
|
|
@@ -487,12 +502,14 @@ export class BaseChart extends CompilableBase {
|
|
|
487
502
|
if (this.updateRegionSpec(result), result.reMake) return this.setLayoutTag(!0, null, !1),
|
|
488
503
|
result;
|
|
489
504
|
const componentUpdateResult = this.updateComponentSpec(result);
|
|
490
|
-
return result.reMake ? (this.setLayoutTag(!0, null, !1), result) :
|
|
505
|
+
return result.reMake ? (this.setLayoutTag(!0, null, !1), result) : (!onlyComponentSpecsChanged && (null === (_a = result.effects) || void 0 === _a ? void 0 : _a.localOnly) && delete result.effects.localOnly,
|
|
506
|
+
isUpdateSpecResultLocalOnly(result) ? result : onlyComponentSpecsChanged && !componentUpdateResult.hasNonComponentOnlyUpdate && (isUpdateSpecResultComponentOnly(result) || this._isComponentScaleDomainOnlyUpdate(result)) ? (componentUpdateResult.componentOnlyUpdatedComponents.forEach((component => {
|
|
491
507
|
component.reInit(component.getSpec());
|
|
492
|
-
})), (null === (
|
|
508
|
+
})), (null === (_b = result.effects) || void 0 === _b ? void 0 : _b.layout) && this.setLayoutTag(!0, null, !1),
|
|
493
509
|
result) : (this.setLayoutTag(!0, null, !1), this.updateSeriesSpec(result), result.reMake || (this.reInit(),
|
|
494
510
|
onlySeriesSpecsChanged && this._canSkipChartDataStages(result) || (this.updateDataSpec(),
|
|
495
|
-
this.
|
|
511
|
+
this.reDataFlow(), this._reRunStackDataFlow(), this.getAllModels().forEach((model => model.onDataUpdate())))),
|
|
512
|
+
result));
|
|
496
513
|
}
|
|
497
514
|
updateChartConfig(result, oldSpec) {
|
|
498
515
|
var _a, _b;
|
|
@@ -528,14 +545,14 @@ export class BaseChart extends CompilableBase {
|
|
|
528
545
|
}, this._canRemoveMarkerComponentsWithoutRemake(compSpecKey, [ c.getSpec() ], cmpSpec)) return void removedComponents.push(c);
|
|
529
546
|
componentCache[compSpecKey].componentCount++;
|
|
530
547
|
const componentSpec = null !== (_b = cmpSpec[c.getSpecIndex()]) && void 0 !== _b ? _b : {}, previousComponentSpec = c.getSpec(), componentResult = c.updateSpec(componentSpec, cmpSpec);
|
|
531
|
-
isUpdateSpecResultComponentOnly(componentResult) ? componentOnlyUpdatedComponents.push(c) : isEqual(previousComponentSpec, componentSpec) || (hasNonComponentOnlyUpdate = !0),
|
|
548
|
+
isUpdateSpecResultComponentOnly(componentResult) || this._isComponentScaleDomainOnlyUpdate(componentResult) ? componentOnlyUpdatedComponents.push(c) : isEqual(previousComponentSpec, componentSpec) || (hasNonComponentOnlyUpdate = !0),
|
|
532
549
|
mergeUpdateResult(result, componentResult);
|
|
533
550
|
} else {
|
|
534
551
|
const previousComponentSpec = c.getSpec(), componentResult = c.updateSpec(cmpSpec);
|
|
535
|
-
isUpdateSpecResultComponentOnly(componentResult) ? componentOnlyUpdatedComponents.push(c) : isEqual(previousComponentSpec, cmpSpec) || (hasNonComponentOnlyUpdate = !0),
|
|
552
|
+
isUpdateSpecResultComponentOnly(componentResult) || this._isComponentScaleDomainOnlyUpdate(componentResult) ? componentOnlyUpdatedComponents.push(c) : isEqual(previousComponentSpec, cmpSpec) || (hasNonComponentOnlyUpdate = !0),
|
|
536
553
|
mergeUpdateResult(result, componentResult);
|
|
537
554
|
}
|
|
538
|
-
}));
|
|
555
|
+
})), result.reMake || this._createMissingMarkerComponentsForSpecs(result, componentCache);
|
|
539
556
|
for (const key in componentCache) if (Object.prototype.hasOwnProperty.call(componentCache, key)) {
|
|
540
557
|
const element = componentCache[key];
|
|
541
558
|
element.componentCount !== element.specCount && (result.reMake = !0);
|
|
@@ -557,6 +574,12 @@ export class BaseChart extends CompilableBase {
|
|
|
557
574
|
hasNonComponentOnlyUpdate: hasNonComponentOnlyUpdate
|
|
558
575
|
};
|
|
559
576
|
}
|
|
577
|
+
_canChangeMarkerComponentsWithoutRemake(key, currentSpec, nextSpec) {
|
|
578
|
+
return this._canRemoveMarkerComponentsWithoutRemake(key, currentSpec, nextSpec) || this._canAddMarkerComponentsWithoutRemake(key, currentSpec, nextSpec);
|
|
579
|
+
}
|
|
580
|
+
_canAddMarkerComponentsWithoutRemake(key, currentSpec, nextSpec) {
|
|
581
|
+
return !!(MARKER_COMPONENT_SPEC_KEYS[key] && isArray(currentSpec) && isArray(nextSpec)) && (!(nextSpec.length <= currentSpec.length) && nextSpec.slice(currentSpec.length).every(this._isMarkerAdditionSpecSafeWithoutRemake));
|
|
582
|
+
}
|
|
560
583
|
_canRemoveMarkerComponentsWithoutRemake(key, currentSpec, nextSpec) {
|
|
561
584
|
return MARKER_COMPONENT_SPEC_KEYS[key] && isArray(currentSpec) && currentSpec.length > 0 && isArray(nextSpec) && 0 === nextSpec.length;
|
|
562
585
|
}
|
|
@@ -567,7 +590,7 @@ export class BaseChart extends CompilableBase {
|
|
|
567
590
|
return hasMarkerRemoval && onlyMarkerRemoval;
|
|
568
591
|
}
|
|
569
592
|
_isComponentSpecKey(key) {
|
|
570
|
-
return this._components.some((component => (component.specKey || component.type) === key));
|
|
593
|
+
return !!MARKER_COMPONENT_SPEC_KEYS[key] || this._components.some((component => (component.specKey || component.type) === key));
|
|
571
594
|
}
|
|
572
595
|
_isOnlyComponentSpecsChanged(currentSpec, nextSpec, specKeys) {
|
|
573
596
|
let hasComponentSpecChange = !1;
|
|
@@ -586,6 +609,43 @@ export class BaseChart extends CompilableBase {
|
|
|
586
609
|
const effects = result.effects;
|
|
587
610
|
return !(!(null == effects ? void 0 : effects.series) || effects.remake || effects.data || effects.scaleDomain || result.reMake);
|
|
588
611
|
}
|
|
612
|
+
_isComponentScaleDomainOnlyUpdate(result) {
|
|
613
|
+
const effects = result.effects;
|
|
614
|
+
return !(!(null == effects ? void 0 : effects.component) || !effects.scaleDomain || result.reMake || result.reCompile || result.reSize || effects.remake || effects.compile || effects.data || effects.series || effects.animation || result.reTransformSpec || result.reAnimate || result.changeTheme || result.changeBackground);
|
|
615
|
+
}
|
|
616
|
+
_reRunStackDataFlow() {
|
|
617
|
+
var _a, _b;
|
|
618
|
+
this._series.some((series => {
|
|
619
|
+
var _a;
|
|
620
|
+
return null === (_a = series.getStack) || void 0 === _a ? void 0 : _a.call(series);
|
|
621
|
+
})) && (null === (_b = null === (_a = this._stack) || void 0 === _a ? void 0 : _a.stackAll) || void 0 === _b || _b.call(_a),
|
|
622
|
+
this._series.forEach((series => {
|
|
623
|
+
series.getViewDataFilter() && series.reTransformViewData();
|
|
624
|
+
})));
|
|
625
|
+
}
|
|
626
|
+
_getModelSpecIndex(specInfo) {
|
|
627
|
+
var _a;
|
|
628
|
+
const specPath = null !== (_a = specInfo.specPath) && void 0 !== _a ? _a : [], specIndex = specPath[specPath.length - 1];
|
|
629
|
+
return "number" == typeof specIndex ? specIndex : 0;
|
|
630
|
+
}
|
|
631
|
+
_hasComponentForSpecInfo(key, specInfo) {
|
|
632
|
+
const specIndex = this._getModelSpecIndex(specInfo);
|
|
633
|
+
return this._components.some((component => (component.specKey || component.type) === key && component.getSpecIndex() === specIndex));
|
|
634
|
+
}
|
|
635
|
+
_createMissingMarkerComponentsForSpecs(result, componentCache) {
|
|
636
|
+
var _a;
|
|
637
|
+
let createdCount = 0;
|
|
638
|
+
null === (_a = this._specTransformer) || void 0 === _a || _a.forEachComponentInSpec(this._spec, ((constructor, specInfo) => {
|
|
639
|
+
if (result.reMake) return;
|
|
640
|
+
const compSpecKey = constructor.specKey || constructor.type;
|
|
641
|
+
MARKER_COMPONENT_SPEC_KEYS[compSpecKey] && !this._hasComponentForSpecInfo(compSpecKey, specInfo) && (this._isMarkerAdditionSpecSafeWithoutRemake(specInfo.spec) ? (this._createComponent(constructor, specInfo),
|
|
642
|
+
componentCache[compSpecKey] && componentCache[compSpecKey].componentCount++, createdCount++) : result.reMake = !0);
|
|
643
|
+
}), this._option.getSpecInfo()), createdCount && (result.change = !0, result.effects = Object.assign(Object.assign({}, result.effects), {
|
|
644
|
+
component: !0,
|
|
645
|
+
layout: !0,
|
|
646
|
+
render: !0
|
|
647
|
+
}));
|
|
648
|
+
}
|
|
589
649
|
_removeMarkerComponentsForEmptySpecs(result) {
|
|
590
650
|
const removedComponents = this._components.filter((component => {
|
|
591
651
|
var _a;
|