@visactor/vchart 2.1.0-alpha.6 → 2.1.0-alpha.8
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 +110 -25
- package/build/index.js +110 -25
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/base/base-chart.d.ts +1 -0
- package/cjs/chart/base/base-chart.js +17 -13
- package/cjs/chart/base/base-chart.js.map +1 -1
- package/cjs/component/index.js +2 -1
- package/cjs/component/marker/base-marker.js +16 -6
- package/cjs/component/marker/base-marker.js.map +1 -1
- package/cjs/component/marker/mark-point/base-mark-point.js +19 -6
- package/cjs/component/marker/mark-point/base-mark-point.js.map +1 -1
- package/cjs/component/util.js +1 -1
- package/cjs/constant/animate.js +1 -2
- package/cjs/constant/scatter.js +2 -1
- package/cjs/constant/sunburst.js +1 -2
- package/cjs/core/instance-manager.js +1 -1
- package/cjs/core/interface.js +1 -1
- package/cjs/core/vchart.js +1 -5
- package/cjs/core/vchart.js.map +1 -1
- package/cjs/event/event.d.ts +4 -0
- package/cjs/event/event.js +26 -7
- package/cjs/event/event.js.map +1 -1
- package/cjs/scale/color-ordinal-scale.d.ts +1 -0
- package/cjs/scale/color-ordinal-scale.js +3 -0
- package/cjs/scale/color-ordinal-scale.js.map +1 -1
- package/cjs/scale/global-scale.js +9 -2
- package/cjs/scale/global-scale.js.map +1 -1
- package/esm/chart/base/base-chart.d.ts +1 -0
- package/esm/chart/base/base-chart.js +16 -13
- package/esm/chart/base/base-chart.js.map +1 -1
- package/esm/component/index.js +2 -1
- package/esm/component/marker/base-marker.js +16 -6
- package/esm/component/marker/base-marker.js.map +1 -1
- package/esm/component/marker/mark-point/base-mark-point.js +19 -6
- package/esm/component/marker/mark-point/base-mark-point.js.map +1 -1
- package/esm/component/util.js +1 -1
- package/esm/constant/animate.js +1 -2
- package/esm/constant/scatter.js +2 -1
- package/esm/constant/sunburst.js +1 -2
- package/esm/core/instance-manager.js +1 -1
- package/esm/core/interface.js +1 -1
- package/esm/core/vchart.js +1 -5
- package/esm/core/vchart.js.map +1 -1
- package/esm/event/event.d.ts +4 -0
- package/esm/event/event.js +26 -7
- package/esm/event/event.js.map +1 -1
- package/esm/scale/color-ordinal-scale.d.ts +1 -0
- package/esm/scale/color-ordinal-scale.js +3 -0
- package/esm/scale/color-ordinal-scale.js.map +1 -1
- package/esm/scale/global-scale.js +9 -1
- package/esm/scale/global-scale.js.map +1 -1
- package/package.json +5 -5
package/build/index.es.js
CHANGED
|
@@ -57796,6 +57796,10 @@ function getColorSchemeBySeries(colorScheme, seriesSpec) {
|
|
|
57796
57796
|
}
|
|
57797
57797
|
|
|
57798
57798
|
class ColorOrdinalScale extends OrdinalScale {
|
|
57799
|
+
setSpecified(value) {
|
|
57800
|
+
this._specified = value ? Object.assign({}, value) : {};
|
|
57801
|
+
return this;
|
|
57802
|
+
}
|
|
57799
57803
|
range(value) {
|
|
57800
57804
|
if (!value) {
|
|
57801
57805
|
return super.range();
|
|
@@ -59384,6 +59388,7 @@ let Event$1 = class Event {
|
|
|
59384
59388
|
}
|
|
59385
59389
|
constructor(eventDispatcher, mode) {
|
|
59386
59390
|
this._composedEventMap = new Map();
|
|
59391
|
+
this._eventHandlerMap = new Map();
|
|
59387
59392
|
this._eventDispatcher = eventDispatcher;
|
|
59388
59393
|
this._mode = mode;
|
|
59389
59394
|
}
|
|
@@ -59405,11 +59410,12 @@ let Event$1 = class Event {
|
|
|
59405
59410
|
}
|
|
59406
59411
|
else {
|
|
59407
59412
|
this._eventDispatcher.register(eType, handler);
|
|
59413
|
+
this._addEventHandler(eType, handler);
|
|
59408
59414
|
}
|
|
59409
59415
|
return this;
|
|
59410
59416
|
}
|
|
59411
59417
|
off(eType, query, cb) {
|
|
59412
|
-
var _a, _b;
|
|
59418
|
+
var _a, _b, _c;
|
|
59413
59419
|
const callback = (cb !== null && cb !== void 0 ? cb : query);
|
|
59414
59420
|
const ComposedEventCtor = Factory.getComposedEvent(eType);
|
|
59415
59421
|
if (!!ComposedEventCtor) {
|
|
@@ -59428,7 +59434,8 @@ let Event$1 = class Event {
|
|
|
59428
59434
|
}
|
|
59429
59435
|
else {
|
|
59430
59436
|
if (callback) {
|
|
59431
|
-
const
|
|
59437
|
+
const storedHandler = this._getEventHandler(eType, callback);
|
|
59438
|
+
const handler = (_c = storedHandler) !== null && _c !== void 0 ? _c : {
|
|
59432
59439
|
callback,
|
|
59433
59440
|
query: null,
|
|
59434
59441
|
filter: {
|
|
@@ -59442,9 +59449,11 @@ let Event$1 = class Event {
|
|
|
59442
59449
|
}
|
|
59443
59450
|
};
|
|
59444
59451
|
this._eventDispatcher.unregister(eType, handler);
|
|
59452
|
+
this._removeEventHandler(eType, callback);
|
|
59445
59453
|
}
|
|
59446
59454
|
else {
|
|
59447
59455
|
this._eventDispatcher.unregister(eType);
|
|
59456
|
+
this._eventHandlerMap.delete(eType);
|
|
59448
59457
|
}
|
|
59449
59458
|
}
|
|
59450
59459
|
return this;
|
|
@@ -59462,9 +59471,40 @@ let Event$1 = class Event {
|
|
|
59462
59471
|
return this;
|
|
59463
59472
|
}
|
|
59464
59473
|
release() {
|
|
59465
|
-
this.
|
|
59474
|
+
this._eventHandlerMap.forEach((handlers, eventType) => {
|
|
59475
|
+
handlers.forEach(handler => {
|
|
59476
|
+
this._eventDispatcher.unregister(eventType, handler);
|
|
59477
|
+
});
|
|
59478
|
+
});
|
|
59479
|
+
this._eventHandlerMap.clear();
|
|
59480
|
+
this._composedEventMap.forEach(entry => {
|
|
59481
|
+
entry.event.unregister();
|
|
59482
|
+
});
|
|
59466
59483
|
this._composedEventMap.clear();
|
|
59467
59484
|
}
|
|
59485
|
+
_addEventHandler(eventType, handler) {
|
|
59486
|
+
if (!handler.callback) {
|
|
59487
|
+
return;
|
|
59488
|
+
}
|
|
59489
|
+
if (!this._eventHandlerMap.has(eventType)) {
|
|
59490
|
+
this._eventHandlerMap.set(eventType, new Map());
|
|
59491
|
+
}
|
|
59492
|
+
this._eventHandlerMap.get(eventType).set(handler.callback, handler);
|
|
59493
|
+
}
|
|
59494
|
+
_getEventHandler(eventType, callback) {
|
|
59495
|
+
var _a;
|
|
59496
|
+
return (_a = this._eventHandlerMap.get(eventType)) === null || _a === void 0 ? void 0 : _a.get(callback);
|
|
59497
|
+
}
|
|
59498
|
+
_removeEventHandler(eventType, callback) {
|
|
59499
|
+
const handlerMap = this._eventHandlerMap.get(eventType);
|
|
59500
|
+
if (!handlerMap) {
|
|
59501
|
+
return;
|
|
59502
|
+
}
|
|
59503
|
+
handlerMap.delete(callback);
|
|
59504
|
+
if (!handlerMap.size) {
|
|
59505
|
+
this._eventHandlerMap.delete(eventType);
|
|
59506
|
+
}
|
|
59507
|
+
}
|
|
59468
59508
|
};
|
|
59469
59509
|
|
|
59470
59510
|
var HOOK_EVENT;
|
|
@@ -66783,7 +66823,6 @@ class VChart {
|
|
|
66783
66823
|
}
|
|
66784
66824
|
if (updateResult.reMake) {
|
|
66785
66825
|
(_c = this._compiler) === null || _c === void 0 ? void 0 : _c.releaseGrammar(true);
|
|
66786
|
-
this._userEvents.forEach(e => { var _a; return (_a = this._event) === null || _a === void 0 ? void 0 : _a.on(e.eType, e.query, e.handler); });
|
|
66787
66826
|
}
|
|
66788
66827
|
else if (updateResult.reCompile) {
|
|
66789
66828
|
(_d = this._compiler) === null || _d === void 0 ? void 0 : _d.clear({ chart: this._chart, vChart: this });
|
|
@@ -75567,8 +75606,22 @@ class GlobalScale {
|
|
|
75567
75606
|
return result;
|
|
75568
75607
|
}
|
|
75569
75608
|
if (!isEqual(lastSpec.specified, s.specified)) {
|
|
75570
|
-
|
|
75571
|
-
|
|
75609
|
+
if (s.id !== 'color') {
|
|
75610
|
+
result.reMake = true;
|
|
75611
|
+
return result;
|
|
75612
|
+
}
|
|
75613
|
+
const colorScale = scale;
|
|
75614
|
+
if (colorScale.setSpecified) {
|
|
75615
|
+
colorScale.setSpecified(s.specified);
|
|
75616
|
+
}
|
|
75617
|
+
else if (s.specified && colorScale.specified) {
|
|
75618
|
+
colorScale.specified(s.specified);
|
|
75619
|
+
}
|
|
75620
|
+
else {
|
|
75621
|
+
result.reMake = true;
|
|
75622
|
+
return result;
|
|
75623
|
+
}
|
|
75624
|
+
result.reRender = true;
|
|
75572
75625
|
}
|
|
75573
75626
|
if (s.range && !isEqual(s.range, scale.range())) {
|
|
75574
75627
|
scale.range(s.range);
|
|
@@ -75977,17 +76030,10 @@ const MARKER_COMPONENT_SPEC_KEYS = {
|
|
|
75977
76030
|
[ComponentTypeEnum.markArea]: true
|
|
75978
76031
|
};
|
|
75979
76032
|
const MARKER_ADDITION_REMAKE_SPEC_KEYS = {
|
|
75980
|
-
autoRange: true,
|
|
75981
76033
|
regionId: true,
|
|
75982
76034
|
regionIndex: true,
|
|
75983
76035
|
seriesId: true,
|
|
75984
76036
|
seriesIndex: true,
|
|
75985
|
-
relativeSeriesId: true,
|
|
75986
|
-
relativeSeriesIndex: true,
|
|
75987
|
-
startRelativeSeriesId: true,
|
|
75988
|
-
startRelativeSeriesIndex: true,
|
|
75989
|
-
endRelativeSeriesId: true,
|
|
75990
|
-
endRelativeSeriesIndex: true,
|
|
75991
76037
|
specifiedDataSeriesId: true,
|
|
75992
76038
|
specifiedDataSeriesIndex: true
|
|
75993
76039
|
};
|
|
@@ -76166,10 +76212,14 @@ class BaseChart extends CompilableBase {
|
|
|
76166
76212
|
return this._components.filter(c => c.type === type);
|
|
76167
76213
|
};
|
|
76168
76214
|
this._isMarkerAdditionSpecSafeWithoutRemake = (spec) => {
|
|
76169
|
-
if (!spec || typeof spec !== 'object'
|
|
76215
|
+
if (!spec || typeof spec !== 'object') {
|
|
76170
76216
|
return false;
|
|
76171
76217
|
}
|
|
76172
|
-
|
|
76218
|
+
const markerSpec = spec;
|
|
76219
|
+
if (markerSpec.visible === false) {
|
|
76220
|
+
return false;
|
|
76221
|
+
}
|
|
76222
|
+
return !Object.keys(MARKER_ADDITION_REMAKE_SPEC_KEYS).some(key => !isNil$1(markerSpec[key]));
|
|
76173
76223
|
};
|
|
76174
76224
|
this._paddingSpec = normalizeLayoutPaddingSpec((_a = spec.padding) !== null && _a !== void 0 ? _a : option.getTheme('padding'));
|
|
76175
76225
|
this._event = new Event$1(option.eventDispatcher, option.mode);
|
|
@@ -76790,6 +76840,9 @@ class BaseChart extends CompilableBase {
|
|
|
76790
76840
|
}
|
|
76791
76841
|
return nextSpec.slice(currentSpec.length).every(this._isMarkerAdditionSpecSafeWithoutRemake);
|
|
76792
76842
|
}
|
|
76843
|
+
_isAutoRangeMarkerSpec(spec) {
|
|
76844
|
+
return !!spec && typeof spec === 'object' && spec.autoRange === true;
|
|
76845
|
+
}
|
|
76793
76846
|
_canRemoveMarkerComponentsWithoutRemake(key, currentSpec, nextSpec) {
|
|
76794
76847
|
return (MARKER_COMPONENT_SPEC_KEYS[key] &&
|
|
76795
76848
|
isArray$1(currentSpec) &&
|
|
@@ -76916,6 +76969,7 @@ class BaseChart extends CompilableBase {
|
|
|
76916
76969
|
_createMissingMarkerComponentsForSpecs(result, componentCache) {
|
|
76917
76970
|
var _a;
|
|
76918
76971
|
let createdCount = 0;
|
|
76972
|
+
let hasAutoRangeMarker = false;
|
|
76919
76973
|
(_a = this._specTransformer) === null || _a === void 0 ? void 0 : _a.forEachComponentInSpec(this._spec, (constructor, specInfo) => {
|
|
76920
76974
|
if (result.reMake) {
|
|
76921
76975
|
return;
|
|
@@ -76933,12 +76987,13 @@ class BaseChart extends CompilableBase {
|
|
|
76933
76987
|
componentCache[compSpecKey].componentCount++;
|
|
76934
76988
|
}
|
|
76935
76989
|
createdCount++;
|
|
76990
|
+
hasAutoRangeMarker = hasAutoRangeMarker || this._isAutoRangeMarkerSpec(specInfo.spec);
|
|
76936
76991
|
}, this._option.getSpecInfo());
|
|
76937
76992
|
if (!createdCount) {
|
|
76938
76993
|
return;
|
|
76939
76994
|
}
|
|
76940
76995
|
result.change = true;
|
|
76941
|
-
result.effects = Object.assign(Object.assign({}, result.effects), { component: true, layout: true, render: true });
|
|
76996
|
+
result.effects = Object.assign(Object.assign(Object.assign(Object.assign({}, result.effects), { component: true }), (hasAutoRangeMarker ? { scaleDomain: true } : null)), { layout: true, render: true });
|
|
76942
76997
|
}
|
|
76943
76998
|
_removeMarkerComponentsForEmptySpecs(result) {
|
|
76944
76999
|
const removedComponents = this._components.filter(component => {
|
|
@@ -107886,6 +107941,7 @@ const MARKER_FORMAT_METHOD_PLACEHOLDER = '__vchart_marker_format_method__';
|
|
|
107886
107941
|
const MARKER_COORDINATE_PLACEHOLDER = '__vchart_marker_coordinate__';
|
|
107887
107942
|
const MARKER_TEXT_PLACEHOLDER = '__vchart_marker_text__';
|
|
107888
107943
|
const MARKER_AUTO_RANGE_PLACEHOLDER = '__vchart_marker_auto_range__';
|
|
107944
|
+
const MARKER_STYLE_PLACEHOLDER = '__vchart_marker_style__';
|
|
107889
107945
|
const MARKER_DOMAIN_POSITION_SPEC_KEYS = [
|
|
107890
107946
|
'coordinate',
|
|
107891
107947
|
'coordinates',
|
|
@@ -107911,6 +107967,24 @@ const normalizeMarkerLabelFormatMethod = (label) => {
|
|
|
107911
107967
|
}
|
|
107912
107968
|
return Object.assign(Object.assign({}, label), { formatMethod: MARKER_FORMAT_METHOD_PLACEHOLDER });
|
|
107913
107969
|
};
|
|
107970
|
+
const normalizeMarkerStyles = (value) => {
|
|
107971
|
+
if (Array.isArray(value)) {
|
|
107972
|
+
return value.map(normalizeMarkerStyles);
|
|
107973
|
+
}
|
|
107974
|
+
if (!value || typeof value !== 'object') {
|
|
107975
|
+
return value;
|
|
107976
|
+
}
|
|
107977
|
+
const normalized = Object.assign({}, value);
|
|
107978
|
+
Object.keys(normalized).forEach(key => {
|
|
107979
|
+
if (key === 'style' || key.endsWith('Style')) {
|
|
107980
|
+
normalized[key] = MARKER_STYLE_PLACEHOLDER;
|
|
107981
|
+
}
|
|
107982
|
+
else {
|
|
107983
|
+
normalized[key] = normalizeMarkerStyles(normalized[key]);
|
|
107984
|
+
}
|
|
107985
|
+
});
|
|
107986
|
+
return normalized;
|
|
107987
|
+
};
|
|
107914
107988
|
const normalizeMarkerSpecForComponentOnlyUpdate = (spec, options) => {
|
|
107915
107989
|
var _a;
|
|
107916
107990
|
if (!spec || typeof spec !== 'object') {
|
|
@@ -107919,9 +107993,7 @@ const normalizeMarkerSpecForComponentOnlyUpdate = (spec, options) => {
|
|
|
107919
107993
|
const normalized = Object.assign({}, spec);
|
|
107920
107994
|
if (options.normalizeDomainPosition) {
|
|
107921
107995
|
MARKER_DOMAIN_POSITION_SPEC_KEYS.forEach(key => {
|
|
107922
|
-
|
|
107923
|
-
normalized[key] = MARKER_COORDINATE_PLACEHOLDER;
|
|
107924
|
-
}
|
|
107996
|
+
normalized[key] = MARKER_COORDINATE_PLACEHOLDER;
|
|
107925
107997
|
});
|
|
107926
107998
|
}
|
|
107927
107999
|
if (options.normalizeAutoRange && 'autoRange' in normalized) {
|
|
@@ -107935,6 +108007,9 @@ const normalizeMarkerSpecForComponentOnlyUpdate = (spec, options) => {
|
|
|
107935
108007
|
if ('label' in normalized) {
|
|
107936
108008
|
normalized.label = normalizeMarkerLabelFormatMethod(normalized.label);
|
|
107937
108009
|
}
|
|
108010
|
+
Object.keys(normalized).forEach(key => {
|
|
108011
|
+
normalized[key] = normalizeMarkerStyles(normalized[key]);
|
|
108012
|
+
});
|
|
107938
108013
|
const text = (_a = normalized.itemContent) === null || _a === void 0 ? void 0 : _a.text;
|
|
107939
108014
|
if (text && typeof text === 'object') {
|
|
107940
108015
|
normalized.itemContent = Object.assign(Object.assign({}, normalized.itemContent), { text: Object.assign(Object.assign({}, normalizeMarkerLabelFormatMethod(text)), { text: MARKER_TEXT_PLACEHOLDER }) });
|
|
@@ -108192,6 +108267,7 @@ class BaseMarker extends BaseComponent {
|
|
|
108192
108267
|
}
|
|
108193
108268
|
reInit(spec) {
|
|
108194
108269
|
super.reInit(spec);
|
|
108270
|
+
this._releaseMarkerData();
|
|
108195
108271
|
this._bindSeries();
|
|
108196
108272
|
this._initDataView();
|
|
108197
108273
|
this._buildMarkerAttributeContext();
|
|
@@ -110454,7 +110530,7 @@ class BaseMarkPoint extends BaseMarker {
|
|
|
110454
110530
|
return markPoint;
|
|
110455
110531
|
}
|
|
110456
110532
|
_markerLayout() {
|
|
110457
|
-
var _a, _b, _c, _d, _e, _f;
|
|
110533
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
110458
110534
|
const spec = this._spec;
|
|
110459
110535
|
const data = this._markerData;
|
|
110460
110536
|
const relativeSeries = this._relativeSeries;
|
|
@@ -110465,8 +110541,16 @@ class BaseMarkPoint extends BaseMarker {
|
|
|
110465
110541
|
? data.latestData[0].latestData
|
|
110466
110542
|
: data.latestData
|
|
110467
110543
|
: seriesData;
|
|
110544
|
+
const { itemLine = {}, itemContent = {} } = this._spec;
|
|
110545
|
+
const { visible: itemLineVisible, line = {} } = itemLine, restItemLine = __rest$f(itemLine, ["visible", "line"]);
|
|
110546
|
+
const itemLineAttrs = itemLineVisible !== false
|
|
110547
|
+
? Object.assign(Object.assign({}, restItemLine), { visible: true, lineStyle: transformToGraphic(line.style) })
|
|
110548
|
+
: {
|
|
110549
|
+
visible: false
|
|
110550
|
+
};
|
|
110551
|
+
const labelAttrs = transformLabelAttributes(Object.assign(Object.assign({}, itemContent.text), { style: merge$1({ dx: 0, dy: 0 }, (_b = (_a = itemContent.text) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : itemContent.style) }), data, this._markAttributeContext);
|
|
110468
110552
|
let limitRect;
|
|
110469
|
-
if (spec.clip || ((
|
|
110553
|
+
if (spec.clip || ((_c = spec.itemContent) === null || _c === void 0 ? void 0 : _c.confine)) {
|
|
110470
110554
|
const { minX, maxX, minY, maxY } = computeClipRange([relativeSeries.getRegion()]);
|
|
110471
110555
|
limitRect = {
|
|
110472
110556
|
x: minX,
|
|
@@ -110476,17 +110560,18 @@ class BaseMarkPoint extends BaseMarker {
|
|
|
110476
110560
|
};
|
|
110477
110561
|
}
|
|
110478
110562
|
if (this._markerComponent) {
|
|
110479
|
-
const attribute = (
|
|
110480
|
-
const textStyle = (
|
|
110481
|
-
const specText = (
|
|
110563
|
+
const attribute = (_d = this._markerComponent.attribute) !== null && _d !== void 0 ? _d : {};
|
|
110564
|
+
const textStyle = (_f = (_e = attribute.itemContent) === null || _e === void 0 ? void 0 : _e.textStyle) !== null && _f !== void 0 ? _f : {};
|
|
110565
|
+
const specText = (_g = this._spec.itemContent.text) === null || _g === void 0 ? void 0 : _g.text;
|
|
110482
110566
|
this._markerComponent.setAttributes({
|
|
110483
110567
|
position: point === undefined ? { x: null, y: null } : point,
|
|
110484
|
-
itemContent: Object.assign(Object.assign({}, attribute.itemContent), { textStyle: Object.assign(Object.assign({}, textStyle), { text: ((
|
|
110568
|
+
itemContent: Object.assign(Object.assign({}, attribute.itemContent), { panel: (_h = labelAttrs.panel) !== null && _h !== void 0 ? _h : (_j = attribute.itemContent) === null || _j === void 0 ? void 0 : _j.panel, padding: (_k = labelAttrs.padding) !== null && _k !== void 0 ? _k : (_l = attribute.itemContent) === null || _l === void 0 ? void 0 : _l.padding, textStyle: Object.assign(Object.assign(Object.assign({}, textStyle), ((_m = labelAttrs.textStyle) !== null && _m !== void 0 ? _m : {})), { text: ((_o = this._spec.itemContent.text) === null || _o === void 0 ? void 0 : _o.formatMethod)
|
|
110485
110569
|
?
|
|
110486
110570
|
this._spec.itemContent.text.formatMethod(dataPoints, seriesData)
|
|
110487
110571
|
: isValid$1(specText)
|
|
110488
110572
|
? specText
|
|
110489
110573
|
: textStyle.text }), offsetX: computeOffsetFromRegion(point, attribute.itemContent.offsetX, this._relativeSeries.getRegion()), offsetY: computeOffsetFromRegion(point, attribute.itemContent.offsetY, this._relativeSeries.getRegion()) }),
|
|
110574
|
+
itemLine: itemLineAttrs,
|
|
110490
110575
|
limitRect,
|
|
110491
110576
|
dx: this._layoutOffsetX,
|
|
110492
110577
|
dy: this._layoutOffsetY
|
package/build/index.js
CHANGED
|
@@ -57802,6 +57802,10 @@
|
|
|
57802
57802
|
}
|
|
57803
57803
|
|
|
57804
57804
|
class ColorOrdinalScale extends OrdinalScale {
|
|
57805
|
+
setSpecified(value) {
|
|
57806
|
+
this._specified = value ? Object.assign({}, value) : {};
|
|
57807
|
+
return this;
|
|
57808
|
+
}
|
|
57805
57809
|
range(value) {
|
|
57806
57810
|
if (!value) {
|
|
57807
57811
|
return super.range();
|
|
@@ -59390,6 +59394,7 @@
|
|
|
59390
59394
|
}
|
|
59391
59395
|
constructor(eventDispatcher, mode) {
|
|
59392
59396
|
this._composedEventMap = new Map();
|
|
59397
|
+
this._eventHandlerMap = new Map();
|
|
59393
59398
|
this._eventDispatcher = eventDispatcher;
|
|
59394
59399
|
this._mode = mode;
|
|
59395
59400
|
}
|
|
@@ -59411,11 +59416,12 @@
|
|
|
59411
59416
|
}
|
|
59412
59417
|
else {
|
|
59413
59418
|
this._eventDispatcher.register(eType, handler);
|
|
59419
|
+
this._addEventHandler(eType, handler);
|
|
59414
59420
|
}
|
|
59415
59421
|
return this;
|
|
59416
59422
|
}
|
|
59417
59423
|
off(eType, query, cb) {
|
|
59418
|
-
var _a, _b;
|
|
59424
|
+
var _a, _b, _c;
|
|
59419
59425
|
const callback = (cb !== null && cb !== void 0 ? cb : query);
|
|
59420
59426
|
const ComposedEventCtor = Factory.getComposedEvent(eType);
|
|
59421
59427
|
if (!!ComposedEventCtor) {
|
|
@@ -59434,7 +59440,8 @@
|
|
|
59434
59440
|
}
|
|
59435
59441
|
else {
|
|
59436
59442
|
if (callback) {
|
|
59437
|
-
const
|
|
59443
|
+
const storedHandler = this._getEventHandler(eType, callback);
|
|
59444
|
+
const handler = (_c = storedHandler) !== null && _c !== void 0 ? _c : {
|
|
59438
59445
|
callback,
|
|
59439
59446
|
query: null,
|
|
59440
59447
|
filter: {
|
|
@@ -59448,9 +59455,11 @@
|
|
|
59448
59455
|
}
|
|
59449
59456
|
};
|
|
59450
59457
|
this._eventDispatcher.unregister(eType, handler);
|
|
59458
|
+
this._removeEventHandler(eType, callback);
|
|
59451
59459
|
}
|
|
59452
59460
|
else {
|
|
59453
59461
|
this._eventDispatcher.unregister(eType);
|
|
59462
|
+
this._eventHandlerMap.delete(eType);
|
|
59454
59463
|
}
|
|
59455
59464
|
}
|
|
59456
59465
|
return this;
|
|
@@ -59468,9 +59477,40 @@
|
|
|
59468
59477
|
return this;
|
|
59469
59478
|
}
|
|
59470
59479
|
release() {
|
|
59471
|
-
this.
|
|
59480
|
+
this._eventHandlerMap.forEach((handlers, eventType) => {
|
|
59481
|
+
handlers.forEach(handler => {
|
|
59482
|
+
this._eventDispatcher.unregister(eventType, handler);
|
|
59483
|
+
});
|
|
59484
|
+
});
|
|
59485
|
+
this._eventHandlerMap.clear();
|
|
59486
|
+
this._composedEventMap.forEach(entry => {
|
|
59487
|
+
entry.event.unregister();
|
|
59488
|
+
});
|
|
59472
59489
|
this._composedEventMap.clear();
|
|
59473
59490
|
}
|
|
59491
|
+
_addEventHandler(eventType, handler) {
|
|
59492
|
+
if (!handler.callback) {
|
|
59493
|
+
return;
|
|
59494
|
+
}
|
|
59495
|
+
if (!this._eventHandlerMap.has(eventType)) {
|
|
59496
|
+
this._eventHandlerMap.set(eventType, new Map());
|
|
59497
|
+
}
|
|
59498
|
+
this._eventHandlerMap.get(eventType).set(handler.callback, handler);
|
|
59499
|
+
}
|
|
59500
|
+
_getEventHandler(eventType, callback) {
|
|
59501
|
+
var _a;
|
|
59502
|
+
return (_a = this._eventHandlerMap.get(eventType)) === null || _a === void 0 ? void 0 : _a.get(callback);
|
|
59503
|
+
}
|
|
59504
|
+
_removeEventHandler(eventType, callback) {
|
|
59505
|
+
const handlerMap = this._eventHandlerMap.get(eventType);
|
|
59506
|
+
if (!handlerMap) {
|
|
59507
|
+
return;
|
|
59508
|
+
}
|
|
59509
|
+
handlerMap.delete(callback);
|
|
59510
|
+
if (!handlerMap.size) {
|
|
59511
|
+
this._eventHandlerMap.delete(eventType);
|
|
59512
|
+
}
|
|
59513
|
+
}
|
|
59474
59514
|
};
|
|
59475
59515
|
|
|
59476
59516
|
var HOOK_EVENT;
|
|
@@ -66789,7 +66829,6 @@
|
|
|
66789
66829
|
}
|
|
66790
66830
|
if (updateResult.reMake) {
|
|
66791
66831
|
(_c = this._compiler) === null || _c === void 0 ? void 0 : _c.releaseGrammar(true);
|
|
66792
|
-
this._userEvents.forEach(e => { var _a; return (_a = this._event) === null || _a === void 0 ? void 0 : _a.on(e.eType, e.query, e.handler); });
|
|
66793
66832
|
}
|
|
66794
66833
|
else if (updateResult.reCompile) {
|
|
66795
66834
|
(_d = this._compiler) === null || _d === void 0 ? void 0 : _d.clear({ chart: this._chart, vChart: this });
|
|
@@ -75573,8 +75612,22 @@
|
|
|
75573
75612
|
return result;
|
|
75574
75613
|
}
|
|
75575
75614
|
if (!isEqual(lastSpec.specified, s.specified)) {
|
|
75576
|
-
|
|
75577
|
-
|
|
75615
|
+
if (s.id !== 'color') {
|
|
75616
|
+
result.reMake = true;
|
|
75617
|
+
return result;
|
|
75618
|
+
}
|
|
75619
|
+
const colorScale = scale;
|
|
75620
|
+
if (colorScale.setSpecified) {
|
|
75621
|
+
colorScale.setSpecified(s.specified);
|
|
75622
|
+
}
|
|
75623
|
+
else if (s.specified && colorScale.specified) {
|
|
75624
|
+
colorScale.specified(s.specified);
|
|
75625
|
+
}
|
|
75626
|
+
else {
|
|
75627
|
+
result.reMake = true;
|
|
75628
|
+
return result;
|
|
75629
|
+
}
|
|
75630
|
+
result.reRender = true;
|
|
75578
75631
|
}
|
|
75579
75632
|
if (s.range && !isEqual(s.range, scale.range())) {
|
|
75580
75633
|
scale.range(s.range);
|
|
@@ -75983,17 +76036,10 @@
|
|
|
75983
76036
|
[ComponentTypeEnum.markArea]: true
|
|
75984
76037
|
};
|
|
75985
76038
|
const MARKER_ADDITION_REMAKE_SPEC_KEYS = {
|
|
75986
|
-
autoRange: true,
|
|
75987
76039
|
regionId: true,
|
|
75988
76040
|
regionIndex: true,
|
|
75989
76041
|
seriesId: true,
|
|
75990
76042
|
seriesIndex: true,
|
|
75991
|
-
relativeSeriesId: true,
|
|
75992
|
-
relativeSeriesIndex: true,
|
|
75993
|
-
startRelativeSeriesId: true,
|
|
75994
|
-
startRelativeSeriesIndex: true,
|
|
75995
|
-
endRelativeSeriesId: true,
|
|
75996
|
-
endRelativeSeriesIndex: true,
|
|
75997
76043
|
specifiedDataSeriesId: true,
|
|
75998
76044
|
specifiedDataSeriesIndex: true
|
|
75999
76045
|
};
|
|
@@ -76172,10 +76218,14 @@
|
|
|
76172
76218
|
return this._components.filter(c => c.type === type);
|
|
76173
76219
|
};
|
|
76174
76220
|
this._isMarkerAdditionSpecSafeWithoutRemake = (spec) => {
|
|
76175
|
-
if (!spec || typeof spec !== 'object'
|
|
76221
|
+
if (!spec || typeof spec !== 'object') {
|
|
76176
76222
|
return false;
|
|
76177
76223
|
}
|
|
76178
|
-
|
|
76224
|
+
const markerSpec = spec;
|
|
76225
|
+
if (markerSpec.visible === false) {
|
|
76226
|
+
return false;
|
|
76227
|
+
}
|
|
76228
|
+
return !Object.keys(MARKER_ADDITION_REMAKE_SPEC_KEYS).some(key => !isNil$1(markerSpec[key]));
|
|
76179
76229
|
};
|
|
76180
76230
|
this._paddingSpec = normalizeLayoutPaddingSpec((_a = spec.padding) !== null && _a !== void 0 ? _a : option.getTheme('padding'));
|
|
76181
76231
|
this._event = new Event$1(option.eventDispatcher, option.mode);
|
|
@@ -76796,6 +76846,9 @@
|
|
|
76796
76846
|
}
|
|
76797
76847
|
return nextSpec.slice(currentSpec.length).every(this._isMarkerAdditionSpecSafeWithoutRemake);
|
|
76798
76848
|
}
|
|
76849
|
+
_isAutoRangeMarkerSpec(spec) {
|
|
76850
|
+
return !!spec && typeof spec === 'object' && spec.autoRange === true;
|
|
76851
|
+
}
|
|
76799
76852
|
_canRemoveMarkerComponentsWithoutRemake(key, currentSpec, nextSpec) {
|
|
76800
76853
|
return (MARKER_COMPONENT_SPEC_KEYS[key] &&
|
|
76801
76854
|
isArray$1(currentSpec) &&
|
|
@@ -76922,6 +76975,7 @@
|
|
|
76922
76975
|
_createMissingMarkerComponentsForSpecs(result, componentCache) {
|
|
76923
76976
|
var _a;
|
|
76924
76977
|
let createdCount = 0;
|
|
76978
|
+
let hasAutoRangeMarker = false;
|
|
76925
76979
|
(_a = this._specTransformer) === null || _a === void 0 ? void 0 : _a.forEachComponentInSpec(this._spec, (constructor, specInfo) => {
|
|
76926
76980
|
if (result.reMake) {
|
|
76927
76981
|
return;
|
|
@@ -76939,12 +76993,13 @@
|
|
|
76939
76993
|
componentCache[compSpecKey].componentCount++;
|
|
76940
76994
|
}
|
|
76941
76995
|
createdCount++;
|
|
76996
|
+
hasAutoRangeMarker = hasAutoRangeMarker || this._isAutoRangeMarkerSpec(specInfo.spec);
|
|
76942
76997
|
}, this._option.getSpecInfo());
|
|
76943
76998
|
if (!createdCount) {
|
|
76944
76999
|
return;
|
|
76945
77000
|
}
|
|
76946
77001
|
result.change = true;
|
|
76947
|
-
result.effects = Object.assign(Object.assign({}, result.effects), { component: true, layout: true, render: true });
|
|
77002
|
+
result.effects = Object.assign(Object.assign(Object.assign(Object.assign({}, result.effects), { component: true }), (hasAutoRangeMarker ? { scaleDomain: true } : null)), { layout: true, render: true });
|
|
76948
77003
|
}
|
|
76949
77004
|
_removeMarkerComponentsForEmptySpecs(result) {
|
|
76950
77005
|
const removedComponents = this._components.filter(component => {
|
|
@@ -107892,6 +107947,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
107892
107947
|
const MARKER_COORDINATE_PLACEHOLDER = '__vchart_marker_coordinate__';
|
|
107893
107948
|
const MARKER_TEXT_PLACEHOLDER = '__vchart_marker_text__';
|
|
107894
107949
|
const MARKER_AUTO_RANGE_PLACEHOLDER = '__vchart_marker_auto_range__';
|
|
107950
|
+
const MARKER_STYLE_PLACEHOLDER = '__vchart_marker_style__';
|
|
107895
107951
|
const MARKER_DOMAIN_POSITION_SPEC_KEYS = [
|
|
107896
107952
|
'coordinate',
|
|
107897
107953
|
'coordinates',
|
|
@@ -107917,6 +107973,24 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
107917
107973
|
}
|
|
107918
107974
|
return Object.assign(Object.assign({}, label), { formatMethod: MARKER_FORMAT_METHOD_PLACEHOLDER });
|
|
107919
107975
|
};
|
|
107976
|
+
const normalizeMarkerStyles = (value) => {
|
|
107977
|
+
if (Array.isArray(value)) {
|
|
107978
|
+
return value.map(normalizeMarkerStyles);
|
|
107979
|
+
}
|
|
107980
|
+
if (!value || typeof value !== 'object') {
|
|
107981
|
+
return value;
|
|
107982
|
+
}
|
|
107983
|
+
const normalized = Object.assign({}, value);
|
|
107984
|
+
Object.keys(normalized).forEach(key => {
|
|
107985
|
+
if (key === 'style' || key.endsWith('Style')) {
|
|
107986
|
+
normalized[key] = MARKER_STYLE_PLACEHOLDER;
|
|
107987
|
+
}
|
|
107988
|
+
else {
|
|
107989
|
+
normalized[key] = normalizeMarkerStyles(normalized[key]);
|
|
107990
|
+
}
|
|
107991
|
+
});
|
|
107992
|
+
return normalized;
|
|
107993
|
+
};
|
|
107920
107994
|
const normalizeMarkerSpecForComponentOnlyUpdate = (spec, options) => {
|
|
107921
107995
|
var _a;
|
|
107922
107996
|
if (!spec || typeof spec !== 'object') {
|
|
@@ -107925,9 +107999,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
107925
107999
|
const normalized = Object.assign({}, spec);
|
|
107926
108000
|
if (options.normalizeDomainPosition) {
|
|
107927
108001
|
MARKER_DOMAIN_POSITION_SPEC_KEYS.forEach(key => {
|
|
107928
|
-
|
|
107929
|
-
normalized[key] = MARKER_COORDINATE_PLACEHOLDER;
|
|
107930
|
-
}
|
|
108002
|
+
normalized[key] = MARKER_COORDINATE_PLACEHOLDER;
|
|
107931
108003
|
});
|
|
107932
108004
|
}
|
|
107933
108005
|
if (options.normalizeAutoRange && 'autoRange' in normalized) {
|
|
@@ -107941,6 +108013,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
107941
108013
|
if ('label' in normalized) {
|
|
107942
108014
|
normalized.label = normalizeMarkerLabelFormatMethod(normalized.label);
|
|
107943
108015
|
}
|
|
108016
|
+
Object.keys(normalized).forEach(key => {
|
|
108017
|
+
normalized[key] = normalizeMarkerStyles(normalized[key]);
|
|
108018
|
+
});
|
|
107944
108019
|
const text = (_a = normalized.itemContent) === null || _a === void 0 ? void 0 : _a.text;
|
|
107945
108020
|
if (text && typeof text === 'object') {
|
|
107946
108021
|
normalized.itemContent = Object.assign(Object.assign({}, normalized.itemContent), { text: Object.assign(Object.assign({}, normalizeMarkerLabelFormatMethod(text)), { text: MARKER_TEXT_PLACEHOLDER }) });
|
|
@@ -108198,6 +108273,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
108198
108273
|
}
|
|
108199
108274
|
reInit(spec) {
|
|
108200
108275
|
super.reInit(spec);
|
|
108276
|
+
this._releaseMarkerData();
|
|
108201
108277
|
this._bindSeries();
|
|
108202
108278
|
this._initDataView();
|
|
108203
108279
|
this._buildMarkerAttributeContext();
|
|
@@ -110460,7 +110536,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
110460
110536
|
return markPoint;
|
|
110461
110537
|
}
|
|
110462
110538
|
_markerLayout() {
|
|
110463
|
-
var _a, _b, _c, _d, _e, _f;
|
|
110539
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
110464
110540
|
const spec = this._spec;
|
|
110465
110541
|
const data = this._markerData;
|
|
110466
110542
|
const relativeSeries = this._relativeSeries;
|
|
@@ -110471,8 +110547,16 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
110471
110547
|
? data.latestData[0].latestData
|
|
110472
110548
|
: data.latestData
|
|
110473
110549
|
: seriesData;
|
|
110550
|
+
const { itemLine = {}, itemContent = {} } = this._spec;
|
|
110551
|
+
const { visible: itemLineVisible, line = {} } = itemLine, restItemLine = __rest$f(itemLine, ["visible", "line"]);
|
|
110552
|
+
const itemLineAttrs = itemLineVisible !== false
|
|
110553
|
+
? Object.assign(Object.assign({}, restItemLine), { visible: true, lineStyle: transformToGraphic(line.style) })
|
|
110554
|
+
: {
|
|
110555
|
+
visible: false
|
|
110556
|
+
};
|
|
110557
|
+
const labelAttrs = transformLabelAttributes(Object.assign(Object.assign({}, itemContent.text), { style: merge$1({ dx: 0, dy: 0 }, (_b = (_a = itemContent.text) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : itemContent.style) }), data, this._markAttributeContext);
|
|
110474
110558
|
let limitRect;
|
|
110475
|
-
if (spec.clip || ((
|
|
110559
|
+
if (spec.clip || ((_c = spec.itemContent) === null || _c === void 0 ? void 0 : _c.confine)) {
|
|
110476
110560
|
const { minX, maxX, minY, maxY } = computeClipRange([relativeSeries.getRegion()]);
|
|
110477
110561
|
limitRect = {
|
|
110478
110562
|
x: minX,
|
|
@@ -110482,17 +110566,18 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
110482
110566
|
};
|
|
110483
110567
|
}
|
|
110484
110568
|
if (this._markerComponent) {
|
|
110485
|
-
const attribute = (
|
|
110486
|
-
const textStyle = (
|
|
110487
|
-
const specText = (
|
|
110569
|
+
const attribute = (_d = this._markerComponent.attribute) !== null && _d !== void 0 ? _d : {};
|
|
110570
|
+
const textStyle = (_f = (_e = attribute.itemContent) === null || _e === void 0 ? void 0 : _e.textStyle) !== null && _f !== void 0 ? _f : {};
|
|
110571
|
+
const specText = (_g = this._spec.itemContent.text) === null || _g === void 0 ? void 0 : _g.text;
|
|
110488
110572
|
this._markerComponent.setAttributes({
|
|
110489
110573
|
position: point === undefined ? { x: null, y: null } : point,
|
|
110490
|
-
itemContent: Object.assign(Object.assign({}, attribute.itemContent), { textStyle: Object.assign(Object.assign({}, textStyle), { text: ((
|
|
110574
|
+
itemContent: Object.assign(Object.assign({}, attribute.itemContent), { panel: (_h = labelAttrs.panel) !== null && _h !== void 0 ? _h : (_j = attribute.itemContent) === null || _j === void 0 ? void 0 : _j.panel, padding: (_k = labelAttrs.padding) !== null && _k !== void 0 ? _k : (_l = attribute.itemContent) === null || _l === void 0 ? void 0 : _l.padding, textStyle: Object.assign(Object.assign(Object.assign({}, textStyle), ((_m = labelAttrs.textStyle) !== null && _m !== void 0 ? _m : {})), { text: ((_o = this._spec.itemContent.text) === null || _o === void 0 ? void 0 : _o.formatMethod)
|
|
110491
110575
|
?
|
|
110492
110576
|
this._spec.itemContent.text.formatMethod(dataPoints, seriesData)
|
|
110493
110577
|
: isValid$1(specText)
|
|
110494
110578
|
? specText
|
|
110495
110579
|
: textStyle.text }), offsetX: computeOffsetFromRegion(point, attribute.itemContent.offsetX, this._relativeSeries.getRegion()), offsetY: computeOffsetFromRegion(point, attribute.itemContent.offsetY, this._relativeSeries.getRegion()) }),
|
|
110580
|
+
itemLine: itemLineAttrs,
|
|
110496
110581
|
limitRect,
|
|
110497
110582
|
dx: this._layoutOffsetX,
|
|
110498
110583
|
dy: this._layoutOffsetY
|