@visactor/vchart 2.0.13-alpha.4 → 2.0.13-alpha.5
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 +714 -709
- package/build/index.js +714 -709
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/component/brush/brush.d.ts +0 -2
- package/cjs/component/brush/brush.js +12 -17
- package/cjs/component/brush/brush.js.map +1 -1
- package/cjs/component/tooltip/interface/common.d.ts +1 -0
- package/cjs/component/tooltip/interface/common.js.map +1 -1
- package/cjs/component/tooltip/processor/base.js +1 -1
- package/cjs/component/tooltip/processor/base.js.map +1 -1
- package/cjs/component/tooltip/tooltip.d.ts +1 -0
- package/cjs/component/tooltip/tooltip.js +3 -2
- package/cjs/component/tooltip/tooltip.js.map +1 -1
- package/cjs/core/interface.d.ts +3 -0
- package/cjs/core/interface.js.map +1 -1
- package/cjs/core/vchart.d.ts +3 -0
- package/cjs/core/vchart.js +10 -1
- package/cjs/core/vchart.js.map +1 -1
- package/esm/component/brush/brush.d.ts +0 -2
- package/esm/component/brush/brush.js +11 -18
- package/esm/component/brush/brush.js.map +1 -1
- package/esm/component/tooltip/interface/common.d.ts +1 -0
- package/esm/component/tooltip/interface/common.js.map +1 -1
- package/esm/component/tooltip/processor/base.js +1 -1
- package/esm/component/tooltip/processor/base.js.map +1 -1
- package/esm/component/tooltip/tooltip.d.ts +1 -0
- package/esm/component/tooltip/tooltip.js +3 -2
- package/esm/component/tooltip/tooltip.js.map +1 -1
- package/esm/core/interface.d.ts +3 -0
- package/esm/core/interface.js.map +1 -1
- package/esm/core/vchart.d.ts +3 -0
- package/esm/core/vchart.js +11 -0
- package/esm/core/vchart.js.map +1 -1
- package/package.json +5 -5
package/build/index.js
CHANGED
|
@@ -60286,6 +60286,609 @@
|
|
|
60286
60286
|
}
|
|
60287
60287
|
}
|
|
60288
60288
|
|
|
60289
|
+
function getComponentThemeFromOption(type, getTheme) {
|
|
60290
|
+
return getTheme('component', type);
|
|
60291
|
+
}
|
|
60292
|
+
function getFormatFunction(formatMethod, formatter, text, datum) {
|
|
60293
|
+
if (formatMethod) {
|
|
60294
|
+
return { formatFunc: formatMethod, args: [text, datum] };
|
|
60295
|
+
}
|
|
60296
|
+
const formatterImpl = Factory.getFormatter();
|
|
60297
|
+
if (formatter && formatterImpl) {
|
|
60298
|
+
return { formatFunc: formatterImpl, args: [text, datum, formatter] };
|
|
60299
|
+
}
|
|
60300
|
+
return {};
|
|
60301
|
+
}
|
|
60302
|
+
const getSpecInfo = (chartSpec, specKey, compType, filter) => {
|
|
60303
|
+
if (isNil$1(chartSpec[specKey])) {
|
|
60304
|
+
return undefined;
|
|
60305
|
+
}
|
|
60306
|
+
const isArraySpec = isArray$1(chartSpec[specKey]);
|
|
60307
|
+
const spec = isArraySpec ? chartSpec[specKey] : [chartSpec[specKey]];
|
|
60308
|
+
const specInfos = [];
|
|
60309
|
+
spec.forEach((s, i) => {
|
|
60310
|
+
if (s && (!filter || filter(s))) {
|
|
60311
|
+
specInfos.push({
|
|
60312
|
+
spec: s,
|
|
60313
|
+
specPath: isArraySpec ? [specKey, i] : [specKey],
|
|
60314
|
+
specInfoPath: ['component', specKey, i],
|
|
60315
|
+
type: compType
|
|
60316
|
+
});
|
|
60317
|
+
}
|
|
60318
|
+
});
|
|
60319
|
+
return specInfos;
|
|
60320
|
+
};
|
|
60321
|
+
|
|
60322
|
+
function isXAxis(orient) {
|
|
60323
|
+
return orient === 'bottom' || orient === 'top';
|
|
60324
|
+
}
|
|
60325
|
+
function isYAxis(orient) {
|
|
60326
|
+
return orient === 'left' || orient === 'right';
|
|
60327
|
+
}
|
|
60328
|
+
function isZAxis(orient) {
|
|
60329
|
+
return orient === 'z';
|
|
60330
|
+
}
|
|
60331
|
+
function autoAxisType(orient, isHorizontal) {
|
|
60332
|
+
if (isHorizontal) {
|
|
60333
|
+
return isXAxis(orient) ? 'linear' : 'band';
|
|
60334
|
+
}
|
|
60335
|
+
return isXAxis(orient) ? 'band' : 'linear';
|
|
60336
|
+
}
|
|
60337
|
+
function getOrient(spec, whiteList) {
|
|
60338
|
+
return isValidOrient(spec.orient) || (whiteList && whiteList.includes(spec.orient)) ? spec.orient : 'left';
|
|
60339
|
+
}
|
|
60340
|
+
function getDirectionByOrient(orient) {
|
|
60341
|
+
return orient === 'top' || orient === 'bottom' ? "horizontal" : "vertical";
|
|
60342
|
+
}
|
|
60343
|
+
function transformInverse(spec, isHorizontal) {
|
|
60344
|
+
let inverse = spec.inverse;
|
|
60345
|
+
if (isHorizontal && !isXAxis(spec.orient)) {
|
|
60346
|
+
inverse = isValid$1(spec.inverse) ? !spec.inverse : true;
|
|
60347
|
+
}
|
|
60348
|
+
return inverse;
|
|
60349
|
+
}
|
|
60350
|
+
function getCartesianAxisInfo(spec, isHorizontal) {
|
|
60351
|
+
var _a;
|
|
60352
|
+
const axisType = (_a = spec.type) !== null && _a !== void 0 ? _a : autoAxisType(spec.orient, isHorizontal);
|
|
60353
|
+
const componentName = `${ComponentTypeEnum.cartesianAxis}-${axisType}`;
|
|
60354
|
+
return { axisType, componentName };
|
|
60355
|
+
}
|
|
60356
|
+
const getCartesianAxisTheme = (orient, type, getTheme) => {
|
|
60357
|
+
var _a;
|
|
60358
|
+
const axisTypeTheme = (_a = (type === 'band'
|
|
60359
|
+
? getComponentThemeFromOption('axisBand', getTheme)
|
|
60360
|
+
: ['linear', 'log', 'symlog'].includes(type)
|
|
60361
|
+
? getComponentThemeFromOption('axisLinear', getTheme)
|
|
60362
|
+
: {})) !== null && _a !== void 0 ? _a : {};
|
|
60363
|
+
const axisTheme = isXAxis(orient)
|
|
60364
|
+
? getComponentThemeFromOption('axisX', getTheme)
|
|
60365
|
+
: isYAxis(orient)
|
|
60366
|
+
? getComponentThemeFromOption('axisY', getTheme)
|
|
60367
|
+
: getComponentThemeFromOption('axisZ', getTheme);
|
|
60368
|
+
return mergeSpec({}, getComponentThemeFromOption('axis', getTheme), axisTypeTheme, axisTheme);
|
|
60369
|
+
};
|
|
60370
|
+
|
|
60371
|
+
class DimensionEvent {
|
|
60372
|
+
constructor(eventDispatcher, mode) {
|
|
60373
|
+
this._eventDispatcher = eventDispatcher;
|
|
60374
|
+
this._mode = mode;
|
|
60375
|
+
}
|
|
60376
|
+
get chart() {
|
|
60377
|
+
var _a, _b;
|
|
60378
|
+
if (!this._chart) {
|
|
60379
|
+
this._chart = (_b = (_a = this._eventDispatcher.globalInstance).getChart) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
60380
|
+
}
|
|
60381
|
+
return this._chart;
|
|
60382
|
+
}
|
|
60383
|
+
register(eType, handler) {
|
|
60384
|
+
var _a, _b;
|
|
60385
|
+
((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error)('Method not implemented.');
|
|
60386
|
+
}
|
|
60387
|
+
unregister() {
|
|
60388
|
+
var _a, _b;
|
|
60389
|
+
((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error)('Method not implemented.');
|
|
60390
|
+
}
|
|
60391
|
+
getTargetDimensionInfo(x, y) {
|
|
60392
|
+
var _a, _b, _c;
|
|
60393
|
+
const dimensionInfo = (_c = (_b = (_a = this.chart.getModelOption()).getDimensionInfo) === null || _b === void 0 ? void 0 : _b.call(_a, this.chart, { x, y })) !== null && _c !== void 0 ? _c : [];
|
|
60394
|
+
if (dimensionInfo.length === 0) {
|
|
60395
|
+
return null;
|
|
60396
|
+
}
|
|
60397
|
+
return dimensionInfo;
|
|
60398
|
+
}
|
|
60399
|
+
dispatch(v, opt) {
|
|
60400
|
+
var _a, _b;
|
|
60401
|
+
const axes = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getAllComponents().filter(c => {
|
|
60402
|
+
if (c.specKey !== 'axes') {
|
|
60403
|
+
return false;
|
|
60404
|
+
}
|
|
60405
|
+
if (opt === null || opt === void 0 ? void 0 : opt.filter) {
|
|
60406
|
+
return opt.filter(c);
|
|
60407
|
+
}
|
|
60408
|
+
return true;
|
|
60409
|
+
});
|
|
60410
|
+
const discreteAxes = axes.filter(axis => {
|
|
60411
|
+
const scale = axis.getScale();
|
|
60412
|
+
return isDiscrete(scale.type);
|
|
60413
|
+
});
|
|
60414
|
+
const dimAxes = discreteAxes.length
|
|
60415
|
+
? discreteAxes
|
|
60416
|
+
: axes.filter(axis => {
|
|
60417
|
+
const orient = axis.getOrient();
|
|
60418
|
+
return isXAxis(orient) || orient === 'angle';
|
|
60419
|
+
});
|
|
60420
|
+
const dimensionInfo = [];
|
|
60421
|
+
const getDimensionInfoByValue = (_b = this.chart) === null || _b === void 0 ? void 0 : _b.getModelOption().getDimensionInfoByValue;
|
|
60422
|
+
if (getDimensionInfoByValue) {
|
|
60423
|
+
dimAxes.forEach(a => {
|
|
60424
|
+
const info = getDimensionInfoByValue(a, v);
|
|
60425
|
+
if (info) {
|
|
60426
|
+
dimensionInfo.push(info);
|
|
60427
|
+
}
|
|
60428
|
+
});
|
|
60429
|
+
}
|
|
60430
|
+
this._callback.call(null, {
|
|
60431
|
+
action: 'enter',
|
|
60432
|
+
dimensionInfo
|
|
60433
|
+
});
|
|
60434
|
+
return dimensionInfo;
|
|
60435
|
+
}
|
|
60436
|
+
}
|
|
60437
|
+
|
|
60438
|
+
class DimensionClickEvent extends DimensionEvent {
|
|
60439
|
+
constructor() {
|
|
60440
|
+
super(...arguments);
|
|
60441
|
+
this.onClick = (params) => {
|
|
60442
|
+
if (!params) {
|
|
60443
|
+
return;
|
|
60444
|
+
}
|
|
60445
|
+
const x = params.event.viewX;
|
|
60446
|
+
const y = params.event.viewY;
|
|
60447
|
+
const targetDimensionInfo = this.getTargetDimensionInfo(x, y);
|
|
60448
|
+
if (!targetDimensionInfo) {
|
|
60449
|
+
return;
|
|
60450
|
+
}
|
|
60451
|
+
this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'click', dimensionInfo: targetDimensionInfo.slice() }));
|
|
60452
|
+
};
|
|
60453
|
+
}
|
|
60454
|
+
register(eType, handler) {
|
|
60455
|
+
this._callback = handler.callback;
|
|
60456
|
+
this._eventDispatcher.register('pointertap', {
|
|
60457
|
+
query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
|
|
60458
|
+
callback: this.onClick
|
|
60459
|
+
});
|
|
60460
|
+
}
|
|
60461
|
+
unregister() {
|
|
60462
|
+
this._eventDispatcher.unregister('pointertap', {
|
|
60463
|
+
query: null,
|
|
60464
|
+
callback: this.onClick
|
|
60465
|
+
});
|
|
60466
|
+
}
|
|
60467
|
+
}
|
|
60468
|
+
|
|
60469
|
+
const isInBound = (pos, min, max) => pos.x >= min.x && pos.x <= max.x && pos.y >= min.y && pos.y <= max.y;
|
|
60470
|
+
const isInRegionBound = (chart, axis, pos) => {
|
|
60471
|
+
const regionList = chart.getRegionsInIds(array(axis.layout.layoutBindRegionID));
|
|
60472
|
+
return regionList === null || regionList === void 0 ? void 0 : regionList.some(region => {
|
|
60473
|
+
const rect = region.getLayoutRect();
|
|
60474
|
+
const startPoint = region.getLayoutStartPoint();
|
|
60475
|
+
return isInBound(pos, { x: startPoint.x, y: startPoint.y }, { x: rect.width + startPoint.x, y: rect.height + startPoint.y });
|
|
60476
|
+
});
|
|
60477
|
+
};
|
|
60478
|
+
const isSameDimensionInfo = (a, b) => {
|
|
60479
|
+
var _a, _b;
|
|
60480
|
+
if (a === b) {
|
|
60481
|
+
return true;
|
|
60482
|
+
}
|
|
60483
|
+
if (isNil$1(a) || isNil$1(b)) {
|
|
60484
|
+
return false;
|
|
60485
|
+
}
|
|
60486
|
+
if (a.value !== b.value) {
|
|
60487
|
+
return false;
|
|
60488
|
+
}
|
|
60489
|
+
if (((_a = a.axis) === null || _a === void 0 ? void 0 : _a.id) !== ((_b = b.axis) === null || _b === void 0 ? void 0 : _b.id)) {
|
|
60490
|
+
return false;
|
|
60491
|
+
}
|
|
60492
|
+
return true;
|
|
60493
|
+
};
|
|
60494
|
+
const resolveTooltipFilterRange = (spec, scale) => {
|
|
60495
|
+
const range = spec.tooltipFilterRange;
|
|
60496
|
+
const rangeValue = typeof range === 'function' ? range({ scale }) : range;
|
|
60497
|
+
const rangeArr = (isValidNumber$1(rangeValue) ? [-rangeValue, rangeValue] : rangeValue);
|
|
60498
|
+
return rangeArr;
|
|
60499
|
+
};
|
|
60500
|
+
const getDimensionData = (value, axis, coordinate, getDimensionField) => {
|
|
60501
|
+
var _a;
|
|
60502
|
+
const scale = axis.getScale();
|
|
60503
|
+
const isDiscreteAxis = isDiscrete(scale.type);
|
|
60504
|
+
const data = [];
|
|
60505
|
+
const seriesList = axis.getOption().getChart().getSeriesInIndex(axis.getSpecInfo().seriesIndexes);
|
|
60506
|
+
for (const series of seriesList) {
|
|
60507
|
+
if (series.coordinate === coordinate) {
|
|
60508
|
+
const dimensionField = array(getDimensionField(series));
|
|
60509
|
+
const viewData = (_a = series.getViewData()) === null || _a === void 0 ? void 0 : _a.latestData;
|
|
60510
|
+
if (dimensionField && viewData) {
|
|
60511
|
+
if (isDiscreteAxis) {
|
|
60512
|
+
const datums = [];
|
|
60513
|
+
const datumIdList = [];
|
|
60514
|
+
viewData.forEach((datum, i) => {
|
|
60515
|
+
var _a;
|
|
60516
|
+
if (((_a = datum[dimensionField[0]]) === null || _a === void 0 ? void 0 : _a.toString()) === (value === null || value === void 0 ? void 0 : value.toString())) {
|
|
60517
|
+
datums.push(datum);
|
|
60518
|
+
datumIdList.push(i);
|
|
60519
|
+
}
|
|
60520
|
+
});
|
|
60521
|
+
data.push({
|
|
60522
|
+
series,
|
|
60523
|
+
datum: datums,
|
|
60524
|
+
key: getDimensionDataKey(series, datumIdList)
|
|
60525
|
+
});
|
|
60526
|
+
}
|
|
60527
|
+
else {
|
|
60528
|
+
if (isValid$1(dimensionField[1])) {
|
|
60529
|
+
const datums = [];
|
|
60530
|
+
const datumIdList = [];
|
|
60531
|
+
viewData.forEach((datum, i) => {
|
|
60532
|
+
var _a;
|
|
60533
|
+
if (((_a = datum[dimensionField[0]]) === null || _a === void 0 ? void 0 : _a.toString()) === (value === null || value === void 0 ? void 0 : value.toString()) ||
|
|
60534
|
+
(isValid$1(datum[dimensionField[0]]) &&
|
|
60535
|
+
isValid$1(datum[dimensionField[1]]) &&
|
|
60536
|
+
value >= datum[dimensionField[0]] &&
|
|
60537
|
+
value < datum[dimensionField[1]])) {
|
|
60538
|
+
datums.push(datum);
|
|
60539
|
+
datumIdList.push(i);
|
|
60540
|
+
}
|
|
60541
|
+
});
|
|
60542
|
+
data.push({
|
|
60543
|
+
series,
|
|
60544
|
+
datum: datums,
|
|
60545
|
+
key: getDimensionDataKey(series, datumIdList)
|
|
60546
|
+
});
|
|
60547
|
+
}
|
|
60548
|
+
else {
|
|
60549
|
+
const spec = axis.getSpec();
|
|
60550
|
+
const rangeArr = resolveTooltipFilterRange(spec, scale);
|
|
60551
|
+
let datums = [];
|
|
60552
|
+
let datumIdList = [];
|
|
60553
|
+
if (rangeArr) {
|
|
60554
|
+
viewData.forEach((datum, i) => {
|
|
60555
|
+
if (isValid$1(datum[dimensionField[0]])) {
|
|
60556
|
+
const delta = datum[dimensionField[0]] - value;
|
|
60557
|
+
if (delta >= rangeArr[0] && delta <= rangeArr[1]) {
|
|
60558
|
+
datums.push(datum);
|
|
60559
|
+
datumIdList.push(i);
|
|
60560
|
+
}
|
|
60561
|
+
}
|
|
60562
|
+
});
|
|
60563
|
+
}
|
|
60564
|
+
else {
|
|
60565
|
+
let minDelta = Infinity;
|
|
60566
|
+
let deltaSign = 0;
|
|
60567
|
+
viewData.forEach((datum, i) => {
|
|
60568
|
+
if (isValid$1(datum[dimensionField[0]])) {
|
|
60569
|
+
const delta = Math.abs(datum[dimensionField[0]] - value);
|
|
60570
|
+
const sign = Math.sign(datum[dimensionField[0]] - value);
|
|
60571
|
+
if (delta < minDelta) {
|
|
60572
|
+
minDelta = delta;
|
|
60573
|
+
datums = [datum];
|
|
60574
|
+
datumIdList = [i];
|
|
60575
|
+
deltaSign = sign;
|
|
60576
|
+
}
|
|
60577
|
+
else if (delta === minDelta && sign === deltaSign) {
|
|
60578
|
+
datums.push(datum);
|
|
60579
|
+
datumIdList.push(i);
|
|
60580
|
+
}
|
|
60581
|
+
}
|
|
60582
|
+
});
|
|
60583
|
+
}
|
|
60584
|
+
data.push({
|
|
60585
|
+
series,
|
|
60586
|
+
datum: datums,
|
|
60587
|
+
key: getDimensionDataKey(series, datumIdList)
|
|
60588
|
+
});
|
|
60589
|
+
}
|
|
60590
|
+
}
|
|
60591
|
+
}
|
|
60592
|
+
}
|
|
60593
|
+
}
|
|
60594
|
+
return data;
|
|
60595
|
+
};
|
|
60596
|
+
const getDimensionDataKey = (series, datumIdList) => `${series.id}_${datumIdList.join('_')}`;
|
|
60597
|
+
const getAxis = (chart, filter, pos) => {
|
|
60598
|
+
const axesComponents = chart
|
|
60599
|
+
.getAllComponents()
|
|
60600
|
+
.filter(c => c.specKey === 'axes' && filter(c) && isInRegionBound(chart, c, pos));
|
|
60601
|
+
if (!axesComponents.length) {
|
|
60602
|
+
return null;
|
|
60603
|
+
}
|
|
60604
|
+
return axesComponents;
|
|
60605
|
+
};
|
|
60606
|
+
|
|
60607
|
+
class DimensionHoverEvent extends DimensionEvent {
|
|
60608
|
+
constructor() {
|
|
60609
|
+
super(...arguments);
|
|
60610
|
+
this._cacheDimensionInfo = null;
|
|
60611
|
+
this.onMouseMove = (params) => {
|
|
60612
|
+
if (!params || DimensionHoverEvent._disableDimensionEvent) {
|
|
60613
|
+
return;
|
|
60614
|
+
}
|
|
60615
|
+
const x = params.event.viewX;
|
|
60616
|
+
const y = params.event.viewY;
|
|
60617
|
+
const targetDimensionInfo = this.getTargetDimensionInfo(x, y);
|
|
60618
|
+
if (targetDimensionInfo === null && this._cacheDimensionInfo !== null) {
|
|
60619
|
+
this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: this._cacheDimensionInfo.slice() }));
|
|
60620
|
+
this._cacheDimensionInfo = targetDimensionInfo;
|
|
60621
|
+
}
|
|
60622
|
+
else if (targetDimensionInfo !== null &&
|
|
60623
|
+
(this._cacheDimensionInfo === null ||
|
|
60624
|
+
targetDimensionInfo.length !== this._cacheDimensionInfo.length ||
|
|
60625
|
+
targetDimensionInfo.some((info, i) => !isSameDimensionInfo(info, this._cacheDimensionInfo[i])))) {
|
|
60626
|
+
this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'enter', dimensionInfo: targetDimensionInfo.slice() }));
|
|
60627
|
+
this._cacheDimensionInfo = targetDimensionInfo;
|
|
60628
|
+
}
|
|
60629
|
+
else if (targetDimensionInfo !== null) {
|
|
60630
|
+
this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'move', dimensionInfo: targetDimensionInfo.slice() }));
|
|
60631
|
+
}
|
|
60632
|
+
};
|
|
60633
|
+
this.onMouseOut = (params) => {
|
|
60634
|
+
if (!params || DimensionHoverEvent._disableDimensionEvent) {
|
|
60635
|
+
return;
|
|
60636
|
+
}
|
|
60637
|
+
this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: this._cacheDimensionInfo ? this._cacheDimensionInfo.slice() : [] }));
|
|
60638
|
+
this._cacheDimensionInfo = null;
|
|
60639
|
+
};
|
|
60640
|
+
}
|
|
60641
|
+
static disableDimensionEvent(value) {
|
|
60642
|
+
this._disableDimensionEvent = value;
|
|
60643
|
+
}
|
|
60644
|
+
register(eType, handler) {
|
|
60645
|
+
this._callback = handler.callback;
|
|
60646
|
+
this._eventDispatcher.register('pointermove', {
|
|
60647
|
+
query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
|
|
60648
|
+
callback: this.onMouseMove
|
|
60649
|
+
});
|
|
60650
|
+
this._eventDispatcher.register('pointerout', {
|
|
60651
|
+
query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.canvas }),
|
|
60652
|
+
callback: this.onMouseOut
|
|
60653
|
+
});
|
|
60654
|
+
if (isMobileLikeMode(this._mode)) {
|
|
60655
|
+
this._eventDispatcher.register('pointerdown', {
|
|
60656
|
+
query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
|
|
60657
|
+
callback: this.onMouseMove
|
|
60658
|
+
});
|
|
60659
|
+
}
|
|
60660
|
+
}
|
|
60661
|
+
unregister() {
|
|
60662
|
+
this._eventDispatcher.unregister('pointermove', {
|
|
60663
|
+
query: null,
|
|
60664
|
+
callback: this.onMouseMove
|
|
60665
|
+
});
|
|
60666
|
+
if (isMobileLikeMode(this._mode)) {
|
|
60667
|
+
this._eventDispatcher.unregister('pointerdown', {
|
|
60668
|
+
query: null,
|
|
60669
|
+
callback: this.onMouseMove
|
|
60670
|
+
});
|
|
60671
|
+
}
|
|
60672
|
+
}
|
|
60673
|
+
}
|
|
60674
|
+
DimensionHoverEvent._disableDimensionEvent = false;
|
|
60675
|
+
|
|
60676
|
+
exports.DimensionEventEnum = void 0;
|
|
60677
|
+
(function (DimensionEventEnum) {
|
|
60678
|
+
DimensionEventEnum["dimensionHover"] = "dimensionHover";
|
|
60679
|
+
DimensionEventEnum["dimensionClick"] = "dimensionClick";
|
|
60680
|
+
})(exports.DimensionEventEnum || (exports.DimensionEventEnum = {}));
|
|
60681
|
+
|
|
60682
|
+
const registerDimensionEvents = () => {
|
|
60683
|
+
Factory.registerComposedEvent(exports.DimensionEventEnum.dimensionHover, DimensionHoverEvent);
|
|
60684
|
+
Factory.registerComposedEvent(exports.DimensionEventEnum.dimensionClick, DimensionClickEvent);
|
|
60685
|
+
};
|
|
60686
|
+
|
|
60687
|
+
const discreteXAxisGetDimensionField = (series) => series.fieldX[0];
|
|
60688
|
+
const discreteYAxisGetDimensionField = (series) => series.fieldY[0];
|
|
60689
|
+
const continuousXAxisGetDimensionField = (series) => {
|
|
60690
|
+
var _a;
|
|
60691
|
+
return [
|
|
60692
|
+
series.fieldX[0],
|
|
60693
|
+
(_a = series.fieldX2) !== null && _a !== void 0 ? _a : series.fieldX[1]
|
|
60694
|
+
];
|
|
60695
|
+
};
|
|
60696
|
+
const continuousYAxisGetDimensionField = (series) => {
|
|
60697
|
+
var _a;
|
|
60698
|
+
return [
|
|
60699
|
+
series.fieldY[0],
|
|
60700
|
+
(_a = series.fieldY2) !== null && _a !== void 0 ? _a : series.fieldY[1]
|
|
60701
|
+
];
|
|
60702
|
+
};
|
|
60703
|
+
const getDimensionFieldFunc = (isXAxis, isDiscreteAxis) => isXAxis
|
|
60704
|
+
? isDiscreteAxis
|
|
60705
|
+
? discreteXAxisGetDimensionField
|
|
60706
|
+
: continuousXAxisGetDimensionField
|
|
60707
|
+
: isDiscreteAxis
|
|
60708
|
+
? discreteYAxisGetDimensionField
|
|
60709
|
+
: continuousYAxisGetDimensionField;
|
|
60710
|
+
const getCartesianDimensionInfo = (chart, pos, isTooltip) => {
|
|
60711
|
+
var _a, _b;
|
|
60712
|
+
if (!chart) {
|
|
60713
|
+
return null;
|
|
60714
|
+
}
|
|
60715
|
+
const { x, y } = pos;
|
|
60716
|
+
const xAxisList = (_a = getAxis(chart, (cmp) => isXAxis(cmp.getOrient()), pos)) !== null && _a !== void 0 ? _a : [];
|
|
60717
|
+
const yAxisList = (_b = getAxis(chart, (cmp) => isYAxis(cmp.getOrient()), pos)) !== null && _b !== void 0 ? _b : [];
|
|
60718
|
+
if (!xAxisList.length && !yAxisList.length) {
|
|
60719
|
+
return null;
|
|
60720
|
+
}
|
|
60721
|
+
const bandAxisSet = new Set();
|
|
60722
|
+
const linearAxisSet = new Set();
|
|
60723
|
+
const forceAxisSet = new Set();
|
|
60724
|
+
[xAxisList, yAxisList].forEach(axisList => axisList.forEach(axis => {
|
|
60725
|
+
const isDiscreteAxis = isDiscrete(axis.getScale().type);
|
|
60726
|
+
if (isDiscreteAxis) {
|
|
60727
|
+
bandAxisSet.add(axis);
|
|
60728
|
+
}
|
|
60729
|
+
else {
|
|
60730
|
+
linearAxisSet.add(axis);
|
|
60731
|
+
}
|
|
60732
|
+
if (isTooltip && axis.getSpec().hasDimensionTooltip) {
|
|
60733
|
+
forceAxisSet.add(axis);
|
|
60734
|
+
}
|
|
60735
|
+
}));
|
|
60736
|
+
const targetAxisInfo = [];
|
|
60737
|
+
const addAxisDimensionInfo = (orient) => {
|
|
60738
|
+
const isXAxis = orient === 'x';
|
|
60739
|
+
const posValue = isXAxis ? x : y;
|
|
60740
|
+
const axisList = isXAxis ? xAxisList : yAxisList;
|
|
60741
|
+
axisList.forEach(axis => {
|
|
60742
|
+
if (forceAxisSet.size > 0) {
|
|
60743
|
+
if (forceAxisSet.has(axis)) {
|
|
60744
|
+
const info = getDimensionInfoByPosition(axis, posValue, getDimensionFieldFunc(isXAxis, isDiscrete(axis.getScale().type)));
|
|
60745
|
+
info && targetAxisInfo.push(info);
|
|
60746
|
+
}
|
|
60747
|
+
}
|
|
60748
|
+
else {
|
|
60749
|
+
const hasDiscreteAxis = bandAxisSet.size > 0;
|
|
60750
|
+
if ((hasDiscreteAxis ? bandAxisSet : linearAxisSet).has(axis)) {
|
|
60751
|
+
const info = getDimensionInfoByPosition(axis, posValue, getDimensionFieldFunc(isXAxis, hasDiscreteAxis));
|
|
60752
|
+
info && targetAxisInfo.push(info);
|
|
60753
|
+
}
|
|
60754
|
+
}
|
|
60755
|
+
});
|
|
60756
|
+
};
|
|
60757
|
+
if (chart.getSpec().direction === "horizontal") {
|
|
60758
|
+
addAxisDimensionInfo('y');
|
|
60759
|
+
if (targetAxisInfo.length === 0) {
|
|
60760
|
+
addAxisDimensionInfo('x');
|
|
60761
|
+
}
|
|
60762
|
+
}
|
|
60763
|
+
else {
|
|
60764
|
+
addAxisDimensionInfo('x');
|
|
60765
|
+
if (targetAxisInfo.length === 0) {
|
|
60766
|
+
addAxisDimensionInfo('y');
|
|
60767
|
+
}
|
|
60768
|
+
}
|
|
60769
|
+
if (!targetAxisInfo.length) {
|
|
60770
|
+
return null;
|
|
60771
|
+
}
|
|
60772
|
+
return targetAxisInfo;
|
|
60773
|
+
};
|
|
60774
|
+
const getDimensionInfoByPosition = (axis, posValue, getDimensionField) => {
|
|
60775
|
+
const value = axis.positionToData(posValue, true);
|
|
60776
|
+
return isNil$1(value) ? null : getDimensionInfoByValue(axis, value, getDimensionField);
|
|
60777
|
+
};
|
|
60778
|
+
const getDimensionInfoByValue = (axis, value, getDimensionField) => {
|
|
60779
|
+
const scale = axis.getScale();
|
|
60780
|
+
if (isNil$1(value)) {
|
|
60781
|
+
return null;
|
|
60782
|
+
}
|
|
60783
|
+
const domain = scale.domain();
|
|
60784
|
+
let index = domain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
|
|
60785
|
+
if (index < 0) {
|
|
60786
|
+
index = undefined;
|
|
60787
|
+
}
|
|
60788
|
+
const data = getDimensionData(value, axis, 'cartesian', getDimensionField !== null && getDimensionField !== void 0 ? getDimensionField : (isXAxis(axis.getOrient()) ? discreteXAxisGetDimensionField : discreteYAxisGetDimensionField));
|
|
60789
|
+
return { index, value, position: scale.scale(value), axis, data };
|
|
60790
|
+
};
|
|
60791
|
+
|
|
60792
|
+
const angleStandardize = (angle, range) => {
|
|
60793
|
+
const unit = Math.PI * 2;
|
|
60794
|
+
const min = minInArray(range);
|
|
60795
|
+
const max = maxInArray(range);
|
|
60796
|
+
if (angle < min) {
|
|
60797
|
+
angle += Math.ceil((min - angle) / unit) * unit;
|
|
60798
|
+
}
|
|
60799
|
+
else if (angle > max) {
|
|
60800
|
+
angle -= Math.ceil((angle - max) / unit) * unit;
|
|
60801
|
+
}
|
|
60802
|
+
return angle;
|
|
60803
|
+
};
|
|
60804
|
+
const getPolarDimensionInfo = (chart, pos) => {
|
|
60805
|
+
if (!chart) {
|
|
60806
|
+
return null;
|
|
60807
|
+
}
|
|
60808
|
+
const angleAxisList = getAxis(chart, (cmp) => cmp.getOrient() === 'angle', pos);
|
|
60809
|
+
const radiusAxisList = getAxis(chart, (cmp) => cmp.getOrient() === 'radius', pos);
|
|
60810
|
+
if ((!angleAxisList || !angleAxisList.length) && (!radiusAxisList || !radiusAxisList.length)) {
|
|
60811
|
+
return null;
|
|
60812
|
+
}
|
|
60813
|
+
const targetAxisInfo = [];
|
|
60814
|
+
const getDimensionField = (series) => series.getDimensionField()[0];
|
|
60815
|
+
const { x, y } = pos;
|
|
60816
|
+
if (angleAxisList) {
|
|
60817
|
+
angleAxisList.forEach(axis => {
|
|
60818
|
+
var _a;
|
|
60819
|
+
const angleScale = axis.getScale();
|
|
60820
|
+
if (angleScale && isDiscrete(angleScale.type)) {
|
|
60821
|
+
const angleDomain = angleScale.domain();
|
|
60822
|
+
const angleRange = angleScale.range();
|
|
60823
|
+
const center = axis.getCenter();
|
|
60824
|
+
const vector = {
|
|
60825
|
+
x: x - axis.getLayoutStartPoint().x - center.x,
|
|
60826
|
+
y: y - axis.getLayoutStartPoint().y - center.y
|
|
60827
|
+
};
|
|
60828
|
+
let angle = vectorAngle({ x: 1, y: 0 }, vector);
|
|
60829
|
+
angle = angleStandardize(angle, angleRange);
|
|
60830
|
+
const radius = distance(vector);
|
|
60831
|
+
const radiusScale = (_a = radiusAxisList[0]) === null || _a === void 0 ? void 0 : _a.getScale();
|
|
60832
|
+
const radiusRange = radiusScale === null || radiusScale === void 0 ? void 0 : radiusScale.range();
|
|
60833
|
+
if ((angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[0])) * (angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[1])) > 0 ||
|
|
60834
|
+
(radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[0])) * (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[1])) > 0) {
|
|
60835
|
+
return;
|
|
60836
|
+
}
|
|
60837
|
+
const value = axis.invert(angle);
|
|
60838
|
+
if (isNil$1(value)) {
|
|
60839
|
+
return;
|
|
60840
|
+
}
|
|
60841
|
+
let index = angleDomain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
|
|
60842
|
+
if (index < 0) {
|
|
60843
|
+
index = undefined;
|
|
60844
|
+
}
|
|
60845
|
+
const data = getDimensionData(value, axis, 'polar', getDimensionField);
|
|
60846
|
+
targetAxisInfo.push({ index, value, position: angleScale.scale(value), axis, data });
|
|
60847
|
+
}
|
|
60848
|
+
});
|
|
60849
|
+
}
|
|
60850
|
+
if (radiusAxisList) {
|
|
60851
|
+
radiusAxisList.forEach(axis => {
|
|
60852
|
+
var _a;
|
|
60853
|
+
const radiusScale = axis.getScale();
|
|
60854
|
+
const radiusRange = radiusScale === null || radiusScale === void 0 ? void 0 : radiusScale.range();
|
|
60855
|
+
if (radiusScale && isDiscrete(radiusScale.type)) {
|
|
60856
|
+
const center = axis.getCenter();
|
|
60857
|
+
const vector = {
|
|
60858
|
+
x: x - axis.getLayoutStartPoint().x - center.x,
|
|
60859
|
+
y: y - axis.getLayoutStartPoint().y - center.y
|
|
60860
|
+
};
|
|
60861
|
+
let angle = vectorAngle({ x: 1, y: 0 }, vector);
|
|
60862
|
+
if (angle < -Math.PI / 2) {
|
|
60863
|
+
angle = Math.PI * 2 + angle;
|
|
60864
|
+
}
|
|
60865
|
+
const radius = distance(vector);
|
|
60866
|
+
const angleScale = (_a = angleAxisList[0]) === null || _a === void 0 ? void 0 : _a.getScale();
|
|
60867
|
+
const angleRange = angleScale === null || angleScale === void 0 ? void 0 : angleScale.range();
|
|
60868
|
+
if ((angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[0])) * (angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[1])) > 0 ||
|
|
60869
|
+
(radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[0])) * (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[1])) > 0) {
|
|
60870
|
+
return;
|
|
60871
|
+
}
|
|
60872
|
+
const value = radiusScale.invert(radius);
|
|
60873
|
+
if (isNil$1(value)) {
|
|
60874
|
+
return;
|
|
60875
|
+
}
|
|
60876
|
+
const domain = radiusScale.domain();
|
|
60877
|
+
let index = domain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
|
|
60878
|
+
if (index < 0) {
|
|
60879
|
+
index = undefined;
|
|
60880
|
+
}
|
|
60881
|
+
const data = getDimensionData(value, axis, 'polar', getDimensionField);
|
|
60882
|
+
targetAxisInfo.push({ index, value, position: radiusScale.scale(value), axis, data });
|
|
60883
|
+
}
|
|
60884
|
+
});
|
|
60885
|
+
}
|
|
60886
|
+
if (!targetAxisInfo.length) {
|
|
60887
|
+
return null;
|
|
60888
|
+
}
|
|
60889
|
+
return targetAxisInfo;
|
|
60890
|
+
};
|
|
60891
|
+
|
|
60289
60892
|
class VChart {
|
|
60290
60893
|
static useRegisters(comps) {
|
|
60291
60894
|
comps.forEach((fn) => {
|
|
@@ -61428,6 +62031,19 @@
|
|
|
61428
62031
|
var _a;
|
|
61429
62032
|
return (_a = this._chart) === null || _a === void 0 ? void 0 : _a.setDimensionIndex(value, opt);
|
|
61430
62033
|
}
|
|
62034
|
+
disableDimensionHoverEvent(value = true) {
|
|
62035
|
+
DimensionHoverEvent.disableDimensionEvent(value);
|
|
62036
|
+
}
|
|
62037
|
+
disableCrossHair(value = true) {
|
|
62038
|
+
this.getChart()
|
|
62039
|
+
.getComponentsByKey('crosshair')
|
|
62040
|
+
.forEach(crosshair => (crosshair.enable = !value));
|
|
62041
|
+
}
|
|
62042
|
+
disableTooltip(value = true) {
|
|
62043
|
+
this.getChart()
|
|
62044
|
+
.getComponentsByKey('tooltip')
|
|
62045
|
+
.forEach(tooltip => (tooltip.enable = !value));
|
|
62046
|
+
}
|
|
61431
62047
|
showCrosshair(cb) {
|
|
61432
62048
|
var _a;
|
|
61433
62049
|
(_a = this._chart) === null || _a === void 0 ? void 0 : _a.showCrosshair(cb);
|
|
@@ -61670,39 +62286,6 @@
|
|
|
61670
62286
|
Direction["horizontal"] = "horizontal";
|
|
61671
62287
|
})(exports.Direction || (exports.Direction = {}));
|
|
61672
62288
|
|
|
61673
|
-
function getComponentThemeFromOption(type, getTheme) {
|
|
61674
|
-
return getTheme('component', type);
|
|
61675
|
-
}
|
|
61676
|
-
function getFormatFunction(formatMethod, formatter, text, datum) {
|
|
61677
|
-
if (formatMethod) {
|
|
61678
|
-
return { formatFunc: formatMethod, args: [text, datum] };
|
|
61679
|
-
}
|
|
61680
|
-
const formatterImpl = Factory.getFormatter();
|
|
61681
|
-
if (formatter && formatterImpl) {
|
|
61682
|
-
return { formatFunc: formatterImpl, args: [text, datum, formatter] };
|
|
61683
|
-
}
|
|
61684
|
-
return {};
|
|
61685
|
-
}
|
|
61686
|
-
const getSpecInfo = (chartSpec, specKey, compType, filter) => {
|
|
61687
|
-
if (isNil$1(chartSpec[specKey])) {
|
|
61688
|
-
return undefined;
|
|
61689
|
-
}
|
|
61690
|
-
const isArraySpec = isArray$1(chartSpec[specKey]);
|
|
61691
|
-
const spec = isArraySpec ? chartSpec[specKey] : [chartSpec[specKey]];
|
|
61692
|
-
const specInfos = [];
|
|
61693
|
-
spec.forEach((s, i) => {
|
|
61694
|
-
if (s && (!filter || filter(s))) {
|
|
61695
|
-
specInfos.push({
|
|
61696
|
-
spec: s,
|
|
61697
|
-
specPath: isArraySpec ? [specKey, i] : [specKey],
|
|
61698
|
-
specInfoPath: ['component', specKey, i],
|
|
61699
|
-
type: compType
|
|
61700
|
-
});
|
|
61701
|
-
}
|
|
61702
|
-
});
|
|
61703
|
-
return specInfos;
|
|
61704
|
-
};
|
|
61705
|
-
|
|
61706
62289
|
const lookup = (data, opt) => {
|
|
61707
62290
|
if (!opt.from || !opt.from()) {
|
|
61708
62291
|
return data;
|
|
@@ -64056,467 +64639,107 @@
|
|
|
64056
64639
|
y: this.positionToDataY(p.y)
|
|
64057
64640
|
};
|
|
64058
64641
|
}
|
|
64059
|
-
positionToDataX(xPos) {
|
|
64060
|
-
if (!this._scaleX) {
|
|
64061
|
-
return null;
|
|
64062
|
-
}
|
|
64063
|
-
return this._scaleX.invert(xPos);
|
|
64064
|
-
}
|
|
64065
|
-
positionToDataY(yPos) {
|
|
64066
|
-
if (!this._scaleY) {
|
|
64067
|
-
return null;
|
|
64068
|
-
}
|
|
64069
|
-
return this._scaleY.invert(yPos);
|
|
64070
|
-
}
|
|
64071
|
-
getRegionRectLeft() {
|
|
64072
|
-
if (!this._xAxisHelper) {
|
|
64073
|
-
return Number.NaN;
|
|
64074
|
-
}
|
|
64075
|
-
const { getScale } = this._xAxisHelper;
|
|
64076
|
-
return getScale(0).range()[0];
|
|
64077
|
-
}
|
|
64078
|
-
getRegionRectRight() {
|
|
64079
|
-
if (!this._xAxisHelper) {
|
|
64080
|
-
return Number.NaN;
|
|
64081
|
-
}
|
|
64082
|
-
const { getScale } = this._xAxisHelper;
|
|
64083
|
-
return getScale(0).range()[1];
|
|
64084
|
-
}
|
|
64085
|
-
afterInitMark() {
|
|
64086
|
-
super.afterInitMark();
|
|
64087
|
-
this.setFieldX(this._fieldX);
|
|
64088
|
-
this.setFieldY(this._fieldY);
|
|
64089
|
-
this._buildScaleConfig();
|
|
64090
|
-
}
|
|
64091
|
-
getDimensionField() {
|
|
64092
|
-
if (this._direction === "horizontal") {
|
|
64093
|
-
return this._specYField;
|
|
64094
|
-
}
|
|
64095
|
-
return this._specXField;
|
|
64096
|
-
}
|
|
64097
|
-
getDimensionContinuousField() {
|
|
64098
|
-
if (this._direction === "horizontal") {
|
|
64099
|
-
return [this.fieldY[0], this.fieldY2];
|
|
64100
|
-
}
|
|
64101
|
-
return [this.fieldX[0], this.fieldX2];
|
|
64102
|
-
}
|
|
64103
|
-
getMeasureField() {
|
|
64104
|
-
if (this._direction === "horizontal") {
|
|
64105
|
-
return this._specXField;
|
|
64106
|
-
}
|
|
64107
|
-
return this._specYField;
|
|
64108
|
-
}
|
|
64109
|
-
initEvent() {
|
|
64110
|
-
super.initEvent();
|
|
64111
|
-
if (this.sortDataByAxis) {
|
|
64112
|
-
this.event.on(exports.ChartEvent.scaleDomainUpdate, {
|
|
64113
|
-
filter: param => {
|
|
64114
|
-
var _a;
|
|
64115
|
-
return param.model.id ===
|
|
64116
|
-
((_a = (this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper)) === null || _a === void 0 ? void 0 : _a.getAxisId());
|
|
64117
|
-
}
|
|
64118
|
-
}, () => {
|
|
64119
|
-
this._sortDataInAxisDomain();
|
|
64120
|
-
});
|
|
64121
|
-
}
|
|
64122
|
-
}
|
|
64123
|
-
_sortDataInAxisDomain() {
|
|
64124
|
-
var _a, _b, _c;
|
|
64125
|
-
if ((_b = (_a = this.getViewData()) === null || _a === void 0 ? void 0 : _a.latestData) === null || _b === void 0 ? void 0 : _b.length) {
|
|
64126
|
-
sortDataInAxisHelper(this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper, this._direction === "horizontal" ? this._fieldY[0] : this._fieldX[0], this.getViewData().latestData);
|
|
64127
|
-
(_c = this._data) === null || _c === void 0 ? void 0 : _c.updateData(true);
|
|
64128
|
-
}
|
|
64129
|
-
}
|
|
64130
|
-
getInvalidCheckFields() {
|
|
64131
|
-
const fields = [];
|
|
64132
|
-
if (this._xAxisHelper &&
|
|
64133
|
-
this._xAxisHelper.isContinuous &&
|
|
64134
|
-
this._xAxisHelper.getAxisType() !== ComponentTypeEnum.geoCoordinate) {
|
|
64135
|
-
const xFields = this._xAxisHelper.getFields ? this._xAxisHelper.getFields() : this._specXField;
|
|
64136
|
-
xFields.forEach(f => {
|
|
64137
|
-
fields.push(f);
|
|
64138
|
-
});
|
|
64139
|
-
}
|
|
64140
|
-
if (this._yAxisHelper &&
|
|
64141
|
-
this._yAxisHelper.isContinuous &&
|
|
64142
|
-
this._yAxisHelper.getAxisType() !== ComponentTypeEnum.geoCoordinate) {
|
|
64143
|
-
const yFields = this._yAxisHelper.getFields ? this._yAxisHelper.getFields() : this._specYField;
|
|
64144
|
-
yFields.forEach(f => {
|
|
64145
|
-
fields.push(f);
|
|
64146
|
-
});
|
|
64147
|
-
}
|
|
64148
|
-
return fields;
|
|
64149
|
-
}
|
|
64150
|
-
reInit(spec) {
|
|
64151
|
-
if (this._positionXEncoder) {
|
|
64152
|
-
this._positionXEncoder = null;
|
|
64153
|
-
}
|
|
64154
|
-
if (this._positionYEncoder) {
|
|
64155
|
-
this._positionYEncoder = null;
|
|
64156
|
-
}
|
|
64157
|
-
super.reInit(spec);
|
|
64158
|
-
}
|
|
64159
|
-
}
|
|
64160
|
-
|
|
64161
|
-
function isXAxis(orient) {
|
|
64162
|
-
return orient === 'bottom' || orient === 'top';
|
|
64163
|
-
}
|
|
64164
|
-
function isYAxis(orient) {
|
|
64165
|
-
return orient === 'left' || orient === 'right';
|
|
64166
|
-
}
|
|
64167
|
-
function isZAxis(orient) {
|
|
64168
|
-
return orient === 'z';
|
|
64169
|
-
}
|
|
64170
|
-
function autoAxisType(orient, isHorizontal) {
|
|
64171
|
-
if (isHorizontal) {
|
|
64172
|
-
return isXAxis(orient) ? 'linear' : 'band';
|
|
64173
|
-
}
|
|
64174
|
-
return isXAxis(orient) ? 'band' : 'linear';
|
|
64175
|
-
}
|
|
64176
|
-
function getOrient(spec, whiteList) {
|
|
64177
|
-
return isValidOrient(spec.orient) || (whiteList && whiteList.includes(spec.orient)) ? spec.orient : 'left';
|
|
64178
|
-
}
|
|
64179
|
-
function getDirectionByOrient(orient) {
|
|
64180
|
-
return orient === 'top' || orient === 'bottom' ? "horizontal" : "vertical";
|
|
64181
|
-
}
|
|
64182
|
-
function transformInverse(spec, isHorizontal) {
|
|
64183
|
-
let inverse = spec.inverse;
|
|
64184
|
-
if (isHorizontal && !isXAxis(spec.orient)) {
|
|
64185
|
-
inverse = isValid$1(spec.inverse) ? !spec.inverse : true;
|
|
64186
|
-
}
|
|
64187
|
-
return inverse;
|
|
64188
|
-
}
|
|
64189
|
-
function getCartesianAxisInfo(spec, isHorizontal) {
|
|
64190
|
-
var _a;
|
|
64191
|
-
const axisType = (_a = spec.type) !== null && _a !== void 0 ? _a : autoAxisType(spec.orient, isHorizontal);
|
|
64192
|
-
const componentName = `${ComponentTypeEnum.cartesianAxis}-${axisType}`;
|
|
64193
|
-
return { axisType, componentName };
|
|
64194
|
-
}
|
|
64195
|
-
const getCartesianAxisTheme = (orient, type, getTheme) => {
|
|
64196
|
-
var _a;
|
|
64197
|
-
const axisTypeTheme = (_a = (type === 'band'
|
|
64198
|
-
? getComponentThemeFromOption('axisBand', getTheme)
|
|
64199
|
-
: ['linear', 'log', 'symlog'].includes(type)
|
|
64200
|
-
? getComponentThemeFromOption('axisLinear', getTheme)
|
|
64201
|
-
: {})) !== null && _a !== void 0 ? _a : {};
|
|
64202
|
-
const axisTheme = isXAxis(orient)
|
|
64203
|
-
? getComponentThemeFromOption('axisX', getTheme)
|
|
64204
|
-
: isYAxis(orient)
|
|
64205
|
-
? getComponentThemeFromOption('axisY', getTheme)
|
|
64206
|
-
: getComponentThemeFromOption('axisZ', getTheme);
|
|
64207
|
-
return mergeSpec({}, getComponentThemeFromOption('axis', getTheme), axisTypeTheme, axisTheme);
|
|
64208
|
-
};
|
|
64209
|
-
|
|
64210
|
-
class DimensionEvent {
|
|
64211
|
-
constructor(eventDispatcher, mode) {
|
|
64212
|
-
this._eventDispatcher = eventDispatcher;
|
|
64213
|
-
this._mode = mode;
|
|
64214
|
-
}
|
|
64215
|
-
get chart() {
|
|
64216
|
-
var _a, _b;
|
|
64217
|
-
if (!this._chart) {
|
|
64218
|
-
this._chart = (_b = (_a = this._eventDispatcher.globalInstance).getChart) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
64219
|
-
}
|
|
64220
|
-
return this._chart;
|
|
64221
|
-
}
|
|
64222
|
-
register(eType, handler) {
|
|
64223
|
-
var _a, _b;
|
|
64224
|
-
((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error)('Method not implemented.');
|
|
64225
|
-
}
|
|
64226
|
-
unregister() {
|
|
64227
|
-
var _a, _b;
|
|
64228
|
-
((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error)('Method not implemented.');
|
|
64229
|
-
}
|
|
64230
|
-
getTargetDimensionInfo(x, y) {
|
|
64231
|
-
var _a, _b, _c;
|
|
64232
|
-
const dimensionInfo = (_c = (_b = (_a = this.chart.getModelOption()).getDimensionInfo) === null || _b === void 0 ? void 0 : _b.call(_a, this.chart, { x, y })) !== null && _c !== void 0 ? _c : [];
|
|
64233
|
-
if (dimensionInfo.length === 0) {
|
|
64234
|
-
return null;
|
|
64235
|
-
}
|
|
64236
|
-
return dimensionInfo;
|
|
64237
|
-
}
|
|
64238
|
-
dispatch(v, opt) {
|
|
64239
|
-
var _a, _b;
|
|
64240
|
-
const axes = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getAllComponents().filter(c => {
|
|
64241
|
-
if (c.specKey !== 'axes') {
|
|
64242
|
-
return false;
|
|
64243
|
-
}
|
|
64244
|
-
if (opt === null || opt === void 0 ? void 0 : opt.filter) {
|
|
64245
|
-
return opt.filter(c);
|
|
64246
|
-
}
|
|
64247
|
-
return true;
|
|
64248
|
-
});
|
|
64249
|
-
const discreteAxes = axes.filter(axis => {
|
|
64250
|
-
const scale = axis.getScale();
|
|
64251
|
-
return isDiscrete(scale.type);
|
|
64252
|
-
});
|
|
64253
|
-
const dimAxes = discreteAxes.length
|
|
64254
|
-
? discreteAxes
|
|
64255
|
-
: axes.filter(axis => {
|
|
64256
|
-
const orient = axis.getOrient();
|
|
64257
|
-
return isXAxis(orient) || orient === 'angle';
|
|
64258
|
-
});
|
|
64259
|
-
const dimensionInfo = [];
|
|
64260
|
-
const getDimensionInfoByValue = (_b = this.chart) === null || _b === void 0 ? void 0 : _b.getModelOption().getDimensionInfoByValue;
|
|
64261
|
-
if (getDimensionInfoByValue) {
|
|
64262
|
-
dimAxes.forEach(a => {
|
|
64263
|
-
const info = getDimensionInfoByValue(a, v);
|
|
64264
|
-
if (info) {
|
|
64265
|
-
dimensionInfo.push(info);
|
|
64266
|
-
}
|
|
64267
|
-
});
|
|
64268
|
-
}
|
|
64269
|
-
this._callback.call(null, {
|
|
64270
|
-
action: 'enter',
|
|
64271
|
-
dimensionInfo
|
|
64272
|
-
});
|
|
64273
|
-
return dimensionInfo;
|
|
64274
|
-
}
|
|
64275
|
-
}
|
|
64276
|
-
|
|
64277
|
-
class DimensionClickEvent extends DimensionEvent {
|
|
64278
|
-
constructor() {
|
|
64279
|
-
super(...arguments);
|
|
64280
|
-
this.onClick = (params) => {
|
|
64281
|
-
if (!params) {
|
|
64282
|
-
return;
|
|
64283
|
-
}
|
|
64284
|
-
const x = params.event.viewX;
|
|
64285
|
-
const y = params.event.viewY;
|
|
64286
|
-
const targetDimensionInfo = this.getTargetDimensionInfo(x, y);
|
|
64287
|
-
if (!targetDimensionInfo) {
|
|
64288
|
-
return;
|
|
64289
|
-
}
|
|
64290
|
-
this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'click', dimensionInfo: targetDimensionInfo.slice() }));
|
|
64291
|
-
};
|
|
64292
|
-
}
|
|
64293
|
-
register(eType, handler) {
|
|
64294
|
-
this._callback = handler.callback;
|
|
64295
|
-
this._eventDispatcher.register('pointertap', {
|
|
64296
|
-
query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
|
|
64297
|
-
callback: this.onClick
|
|
64298
|
-
});
|
|
64299
|
-
}
|
|
64300
|
-
unregister() {
|
|
64301
|
-
this._eventDispatcher.unregister('pointertap', {
|
|
64302
|
-
query: null,
|
|
64303
|
-
callback: this.onClick
|
|
64304
|
-
});
|
|
64642
|
+
positionToDataX(xPos) {
|
|
64643
|
+
if (!this._scaleX) {
|
|
64644
|
+
return null;
|
|
64645
|
+
}
|
|
64646
|
+
return this._scaleX.invert(xPos);
|
|
64305
64647
|
}
|
|
64306
|
-
|
|
64307
|
-
|
|
64308
|
-
|
|
64309
|
-
|
|
64310
|
-
|
|
64311
|
-
return regionList === null || regionList === void 0 ? void 0 : regionList.some(region => {
|
|
64312
|
-
const rect = region.getLayoutRect();
|
|
64313
|
-
const startPoint = region.getLayoutStartPoint();
|
|
64314
|
-
return isInBound(pos, { x: startPoint.x, y: startPoint.y }, { x: rect.width + startPoint.x, y: rect.height + startPoint.y });
|
|
64315
|
-
});
|
|
64316
|
-
};
|
|
64317
|
-
const isSameDimensionInfo = (a, b) => {
|
|
64318
|
-
var _a, _b;
|
|
64319
|
-
if (a === b) {
|
|
64320
|
-
return true;
|
|
64648
|
+
positionToDataY(yPos) {
|
|
64649
|
+
if (!this._scaleY) {
|
|
64650
|
+
return null;
|
|
64651
|
+
}
|
|
64652
|
+
return this._scaleY.invert(yPos);
|
|
64321
64653
|
}
|
|
64322
|
-
|
|
64323
|
-
|
|
64654
|
+
getRegionRectLeft() {
|
|
64655
|
+
if (!this._xAxisHelper) {
|
|
64656
|
+
return Number.NaN;
|
|
64657
|
+
}
|
|
64658
|
+
const { getScale } = this._xAxisHelper;
|
|
64659
|
+
return getScale(0).range()[0];
|
|
64324
64660
|
}
|
|
64325
|
-
|
|
64326
|
-
|
|
64661
|
+
getRegionRectRight() {
|
|
64662
|
+
if (!this._xAxisHelper) {
|
|
64663
|
+
return Number.NaN;
|
|
64664
|
+
}
|
|
64665
|
+
const { getScale } = this._xAxisHelper;
|
|
64666
|
+
return getScale(0).range()[1];
|
|
64327
64667
|
}
|
|
64328
|
-
|
|
64329
|
-
|
|
64668
|
+
afterInitMark() {
|
|
64669
|
+
super.afterInitMark();
|
|
64670
|
+
this.setFieldX(this._fieldX);
|
|
64671
|
+
this.setFieldY(this._fieldY);
|
|
64672
|
+
this._buildScaleConfig();
|
|
64330
64673
|
}
|
|
64331
|
-
|
|
64332
|
-
|
|
64333
|
-
|
|
64334
|
-
const range = spec.tooltipFilterRange;
|
|
64335
|
-
const rangeValue = typeof range === 'function' ? range({ scale }) : range;
|
|
64336
|
-
const rangeArr = (isValidNumber$1(rangeValue) ? [-rangeValue, rangeValue] : rangeValue);
|
|
64337
|
-
return rangeArr;
|
|
64338
|
-
};
|
|
64339
|
-
const getDimensionData = (value, axis, coordinate, getDimensionField) => {
|
|
64340
|
-
var _a;
|
|
64341
|
-
const scale = axis.getScale();
|
|
64342
|
-
const isDiscreteAxis = isDiscrete(scale.type);
|
|
64343
|
-
const data = [];
|
|
64344
|
-
const seriesList = axis.getOption().getChart().getSeriesInIndex(axis.getSpecInfo().seriesIndexes);
|
|
64345
|
-
for (const series of seriesList) {
|
|
64346
|
-
if (series.coordinate === coordinate) {
|
|
64347
|
-
const dimensionField = array(getDimensionField(series));
|
|
64348
|
-
const viewData = (_a = series.getViewData()) === null || _a === void 0 ? void 0 : _a.latestData;
|
|
64349
|
-
if (dimensionField && viewData) {
|
|
64350
|
-
if (isDiscreteAxis) {
|
|
64351
|
-
const datums = [];
|
|
64352
|
-
const datumIdList = [];
|
|
64353
|
-
viewData.forEach((datum, i) => {
|
|
64354
|
-
var _a;
|
|
64355
|
-
if (((_a = datum[dimensionField[0]]) === null || _a === void 0 ? void 0 : _a.toString()) === (value === null || value === void 0 ? void 0 : value.toString())) {
|
|
64356
|
-
datums.push(datum);
|
|
64357
|
-
datumIdList.push(i);
|
|
64358
|
-
}
|
|
64359
|
-
});
|
|
64360
|
-
data.push({
|
|
64361
|
-
series,
|
|
64362
|
-
datum: datums,
|
|
64363
|
-
key: getDimensionDataKey(series, datumIdList)
|
|
64364
|
-
});
|
|
64365
|
-
}
|
|
64366
|
-
else {
|
|
64367
|
-
if (isValid$1(dimensionField[1])) {
|
|
64368
|
-
const datums = [];
|
|
64369
|
-
const datumIdList = [];
|
|
64370
|
-
viewData.forEach((datum, i) => {
|
|
64371
|
-
var _a;
|
|
64372
|
-
if (((_a = datum[dimensionField[0]]) === null || _a === void 0 ? void 0 : _a.toString()) === (value === null || value === void 0 ? void 0 : value.toString()) ||
|
|
64373
|
-
(isValid$1(datum[dimensionField[0]]) &&
|
|
64374
|
-
isValid$1(datum[dimensionField[1]]) &&
|
|
64375
|
-
value >= datum[dimensionField[0]] &&
|
|
64376
|
-
value < datum[dimensionField[1]])) {
|
|
64377
|
-
datums.push(datum);
|
|
64378
|
-
datumIdList.push(i);
|
|
64379
|
-
}
|
|
64380
|
-
});
|
|
64381
|
-
data.push({
|
|
64382
|
-
series,
|
|
64383
|
-
datum: datums,
|
|
64384
|
-
key: getDimensionDataKey(series, datumIdList)
|
|
64385
|
-
});
|
|
64386
|
-
}
|
|
64387
|
-
else {
|
|
64388
|
-
const spec = axis.getSpec();
|
|
64389
|
-
const rangeArr = resolveTooltipFilterRange(spec, scale);
|
|
64390
|
-
let datums = [];
|
|
64391
|
-
let datumIdList = [];
|
|
64392
|
-
if (rangeArr) {
|
|
64393
|
-
viewData.forEach((datum, i) => {
|
|
64394
|
-
if (isValid$1(datum[dimensionField[0]])) {
|
|
64395
|
-
const delta = datum[dimensionField[0]] - value;
|
|
64396
|
-
if (delta >= rangeArr[0] && delta <= rangeArr[1]) {
|
|
64397
|
-
datums.push(datum);
|
|
64398
|
-
datumIdList.push(i);
|
|
64399
|
-
}
|
|
64400
|
-
}
|
|
64401
|
-
});
|
|
64402
|
-
}
|
|
64403
|
-
else {
|
|
64404
|
-
let minDelta = Infinity;
|
|
64405
|
-
let deltaSign = 0;
|
|
64406
|
-
viewData.forEach((datum, i) => {
|
|
64407
|
-
if (isValid$1(datum[dimensionField[0]])) {
|
|
64408
|
-
const delta = Math.abs(datum[dimensionField[0]] - value);
|
|
64409
|
-
const sign = Math.sign(datum[dimensionField[0]] - value);
|
|
64410
|
-
if (delta < minDelta) {
|
|
64411
|
-
minDelta = delta;
|
|
64412
|
-
datums = [datum];
|
|
64413
|
-
datumIdList = [i];
|
|
64414
|
-
deltaSign = sign;
|
|
64415
|
-
}
|
|
64416
|
-
else if (delta === minDelta && sign === deltaSign) {
|
|
64417
|
-
datums.push(datum);
|
|
64418
|
-
datumIdList.push(i);
|
|
64419
|
-
}
|
|
64420
|
-
}
|
|
64421
|
-
});
|
|
64422
|
-
}
|
|
64423
|
-
data.push({
|
|
64424
|
-
series,
|
|
64425
|
-
datum: datums,
|
|
64426
|
-
key: getDimensionDataKey(series, datumIdList)
|
|
64427
|
-
});
|
|
64428
|
-
}
|
|
64429
|
-
}
|
|
64430
|
-
}
|
|
64674
|
+
getDimensionField() {
|
|
64675
|
+
if (this._direction === "horizontal") {
|
|
64676
|
+
return this._specYField;
|
|
64431
64677
|
}
|
|
64678
|
+
return this._specXField;
|
|
64432
64679
|
}
|
|
64433
|
-
|
|
64434
|
-
|
|
64435
|
-
|
|
64436
|
-
|
|
64437
|
-
|
|
64438
|
-
.getAllComponents()
|
|
64439
|
-
.filter(c => c.specKey === 'axes' && filter(c) && isInRegionBound(chart, c, pos));
|
|
64440
|
-
if (!axesComponents.length) {
|
|
64441
|
-
return null;
|
|
64442
|
-
}
|
|
64443
|
-
return axesComponents;
|
|
64444
|
-
};
|
|
64445
|
-
|
|
64446
|
-
class DimensionHoverEvent extends DimensionEvent {
|
|
64447
|
-
constructor() {
|
|
64448
|
-
super(...arguments);
|
|
64449
|
-
this._cacheDimensionInfo = null;
|
|
64450
|
-
this.onMouseMove = (params) => {
|
|
64451
|
-
if (!params || DimensionHoverEvent._disableDimensionEvent) {
|
|
64452
|
-
return;
|
|
64453
|
-
}
|
|
64454
|
-
const x = params.event.viewX;
|
|
64455
|
-
const y = params.event.viewY;
|
|
64456
|
-
const targetDimensionInfo = this.getTargetDimensionInfo(x, y);
|
|
64457
|
-
if (targetDimensionInfo === null && this._cacheDimensionInfo !== null) {
|
|
64458
|
-
this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: this._cacheDimensionInfo.slice() }));
|
|
64459
|
-
this._cacheDimensionInfo = targetDimensionInfo;
|
|
64460
|
-
}
|
|
64461
|
-
else if (targetDimensionInfo !== null &&
|
|
64462
|
-
(this._cacheDimensionInfo === null ||
|
|
64463
|
-
targetDimensionInfo.length !== this._cacheDimensionInfo.length ||
|
|
64464
|
-
targetDimensionInfo.some((info, i) => !isSameDimensionInfo(info, this._cacheDimensionInfo[i])))) {
|
|
64465
|
-
this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'enter', dimensionInfo: targetDimensionInfo.slice() }));
|
|
64466
|
-
this._cacheDimensionInfo = targetDimensionInfo;
|
|
64467
|
-
}
|
|
64468
|
-
else if (targetDimensionInfo !== null) {
|
|
64469
|
-
this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'move', dimensionInfo: targetDimensionInfo.slice() }));
|
|
64470
|
-
}
|
|
64471
|
-
};
|
|
64472
|
-
this.onMouseOut = (params) => {
|
|
64473
|
-
if (!params || DimensionHoverEvent._disableDimensionEvent) {
|
|
64474
|
-
return;
|
|
64475
|
-
}
|
|
64476
|
-
this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: this._cacheDimensionInfo ? this._cacheDimensionInfo.slice() : [] }));
|
|
64477
|
-
this._cacheDimensionInfo = null;
|
|
64478
|
-
};
|
|
64680
|
+
getDimensionContinuousField() {
|
|
64681
|
+
if (this._direction === "horizontal") {
|
|
64682
|
+
return [this.fieldY[0], this.fieldY2];
|
|
64683
|
+
}
|
|
64684
|
+
return [this.fieldX[0], this.fieldX2];
|
|
64479
64685
|
}
|
|
64480
|
-
|
|
64481
|
-
this.
|
|
64686
|
+
getMeasureField() {
|
|
64687
|
+
if (this._direction === "horizontal") {
|
|
64688
|
+
return this._specXField;
|
|
64689
|
+
}
|
|
64690
|
+
return this._specYField;
|
|
64482
64691
|
}
|
|
64483
|
-
|
|
64484
|
-
|
|
64485
|
-
this.
|
|
64486
|
-
|
|
64487
|
-
|
|
64488
|
-
|
|
64489
|
-
|
|
64490
|
-
|
|
64491
|
-
|
|
64492
|
-
|
|
64493
|
-
|
|
64494
|
-
this._eventDispatcher.register('pointerdown', {
|
|
64495
|
-
query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
|
|
64496
|
-
callback: this.onMouseMove
|
|
64692
|
+
initEvent() {
|
|
64693
|
+
super.initEvent();
|
|
64694
|
+
if (this.sortDataByAxis) {
|
|
64695
|
+
this.event.on(exports.ChartEvent.scaleDomainUpdate, {
|
|
64696
|
+
filter: param => {
|
|
64697
|
+
var _a;
|
|
64698
|
+
return param.model.id ===
|
|
64699
|
+
((_a = (this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper)) === null || _a === void 0 ? void 0 : _a.getAxisId());
|
|
64700
|
+
}
|
|
64701
|
+
}, () => {
|
|
64702
|
+
this._sortDataInAxisDomain();
|
|
64497
64703
|
});
|
|
64498
64704
|
}
|
|
64499
64705
|
}
|
|
64500
|
-
|
|
64501
|
-
|
|
64502
|
-
|
|
64503
|
-
|
|
64504
|
-
|
|
64505
|
-
|
|
64506
|
-
|
|
64507
|
-
|
|
64508
|
-
|
|
64706
|
+
_sortDataInAxisDomain() {
|
|
64707
|
+
var _a, _b, _c;
|
|
64708
|
+
if ((_b = (_a = this.getViewData()) === null || _a === void 0 ? void 0 : _a.latestData) === null || _b === void 0 ? void 0 : _b.length) {
|
|
64709
|
+
sortDataInAxisHelper(this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper, this._direction === "horizontal" ? this._fieldY[0] : this._fieldX[0], this.getViewData().latestData);
|
|
64710
|
+
(_c = this._data) === null || _c === void 0 ? void 0 : _c.updateData(true);
|
|
64711
|
+
}
|
|
64712
|
+
}
|
|
64713
|
+
getInvalidCheckFields() {
|
|
64714
|
+
const fields = [];
|
|
64715
|
+
if (this._xAxisHelper &&
|
|
64716
|
+
this._xAxisHelper.isContinuous &&
|
|
64717
|
+
this._xAxisHelper.getAxisType() !== ComponentTypeEnum.geoCoordinate) {
|
|
64718
|
+
const xFields = this._xAxisHelper.getFields ? this._xAxisHelper.getFields() : this._specXField;
|
|
64719
|
+
xFields.forEach(f => {
|
|
64720
|
+
fields.push(f);
|
|
64721
|
+
});
|
|
64722
|
+
}
|
|
64723
|
+
if (this._yAxisHelper &&
|
|
64724
|
+
this._yAxisHelper.isContinuous &&
|
|
64725
|
+
this._yAxisHelper.getAxisType() !== ComponentTypeEnum.geoCoordinate) {
|
|
64726
|
+
const yFields = this._yAxisHelper.getFields ? this._yAxisHelper.getFields() : this._specYField;
|
|
64727
|
+
yFields.forEach(f => {
|
|
64728
|
+
fields.push(f);
|
|
64509
64729
|
});
|
|
64510
64730
|
}
|
|
64731
|
+
return fields;
|
|
64732
|
+
}
|
|
64733
|
+
reInit(spec) {
|
|
64734
|
+
if (this._positionXEncoder) {
|
|
64735
|
+
this._positionXEncoder = null;
|
|
64736
|
+
}
|
|
64737
|
+
if (this._positionYEncoder) {
|
|
64738
|
+
this._positionYEncoder = null;
|
|
64739
|
+
}
|
|
64740
|
+
super.reInit(spec);
|
|
64511
64741
|
}
|
|
64512
64742
|
}
|
|
64513
|
-
DimensionHoverEvent._disableDimensionEvent = false;
|
|
64514
|
-
|
|
64515
|
-
exports.DimensionEventEnum = void 0;
|
|
64516
|
-
(function (DimensionEventEnum) {
|
|
64517
|
-
DimensionEventEnum["dimensionHover"] = "dimensionHover";
|
|
64518
|
-
DimensionEventEnum["dimensionClick"] = "dimensionClick";
|
|
64519
|
-
})(exports.DimensionEventEnum || (exports.DimensionEventEnum = {}));
|
|
64520
64743
|
|
|
64521
64744
|
const lineLikeSeriesMark = {
|
|
64522
64745
|
["point"]: { name: "point", type: "symbol" },
|
|
@@ -71217,116 +71440,6 @@
|
|
|
71217
71440
|
Factory.registerInteractionTrigger(DimensionHover.type, DimensionHover);
|
|
71218
71441
|
};
|
|
71219
71442
|
|
|
71220
|
-
const registerDimensionEvents = () => {
|
|
71221
|
-
Factory.registerComposedEvent(exports.DimensionEventEnum.dimensionHover, DimensionHoverEvent);
|
|
71222
|
-
Factory.registerComposedEvent(exports.DimensionEventEnum.dimensionClick, DimensionClickEvent);
|
|
71223
|
-
};
|
|
71224
|
-
|
|
71225
|
-
const discreteXAxisGetDimensionField = (series) => series.fieldX[0];
|
|
71226
|
-
const discreteYAxisGetDimensionField = (series) => series.fieldY[0];
|
|
71227
|
-
const continuousXAxisGetDimensionField = (series) => {
|
|
71228
|
-
var _a;
|
|
71229
|
-
return [
|
|
71230
|
-
series.fieldX[0],
|
|
71231
|
-
(_a = series.fieldX2) !== null && _a !== void 0 ? _a : series.fieldX[1]
|
|
71232
|
-
];
|
|
71233
|
-
};
|
|
71234
|
-
const continuousYAxisGetDimensionField = (series) => {
|
|
71235
|
-
var _a;
|
|
71236
|
-
return [
|
|
71237
|
-
series.fieldY[0],
|
|
71238
|
-
(_a = series.fieldY2) !== null && _a !== void 0 ? _a : series.fieldY[1]
|
|
71239
|
-
];
|
|
71240
|
-
};
|
|
71241
|
-
const getDimensionFieldFunc = (isXAxis, isDiscreteAxis) => isXAxis
|
|
71242
|
-
? isDiscreteAxis
|
|
71243
|
-
? discreteXAxisGetDimensionField
|
|
71244
|
-
: continuousXAxisGetDimensionField
|
|
71245
|
-
: isDiscreteAxis
|
|
71246
|
-
? discreteYAxisGetDimensionField
|
|
71247
|
-
: continuousYAxisGetDimensionField;
|
|
71248
|
-
const getCartesianDimensionInfo = (chart, pos, isTooltip) => {
|
|
71249
|
-
var _a, _b;
|
|
71250
|
-
if (!chart) {
|
|
71251
|
-
return null;
|
|
71252
|
-
}
|
|
71253
|
-
const { x, y } = pos;
|
|
71254
|
-
const xAxisList = (_a = getAxis(chart, (cmp) => isXAxis(cmp.getOrient()), pos)) !== null && _a !== void 0 ? _a : [];
|
|
71255
|
-
const yAxisList = (_b = getAxis(chart, (cmp) => isYAxis(cmp.getOrient()), pos)) !== null && _b !== void 0 ? _b : [];
|
|
71256
|
-
if (!xAxisList.length && !yAxisList.length) {
|
|
71257
|
-
return null;
|
|
71258
|
-
}
|
|
71259
|
-
const bandAxisSet = new Set();
|
|
71260
|
-
const linearAxisSet = new Set();
|
|
71261
|
-
const forceAxisSet = new Set();
|
|
71262
|
-
[xAxisList, yAxisList].forEach(axisList => axisList.forEach(axis => {
|
|
71263
|
-
const isDiscreteAxis = isDiscrete(axis.getScale().type);
|
|
71264
|
-
if (isDiscreteAxis) {
|
|
71265
|
-
bandAxisSet.add(axis);
|
|
71266
|
-
}
|
|
71267
|
-
else {
|
|
71268
|
-
linearAxisSet.add(axis);
|
|
71269
|
-
}
|
|
71270
|
-
if (isTooltip && axis.getSpec().hasDimensionTooltip) {
|
|
71271
|
-
forceAxisSet.add(axis);
|
|
71272
|
-
}
|
|
71273
|
-
}));
|
|
71274
|
-
const targetAxisInfo = [];
|
|
71275
|
-
const addAxisDimensionInfo = (orient) => {
|
|
71276
|
-
const isXAxis = orient === 'x';
|
|
71277
|
-
const posValue = isXAxis ? x : y;
|
|
71278
|
-
const axisList = isXAxis ? xAxisList : yAxisList;
|
|
71279
|
-
axisList.forEach(axis => {
|
|
71280
|
-
if (forceAxisSet.size > 0) {
|
|
71281
|
-
if (forceAxisSet.has(axis)) {
|
|
71282
|
-
const info = getDimensionInfoByPosition(axis, posValue, getDimensionFieldFunc(isXAxis, isDiscrete(axis.getScale().type)));
|
|
71283
|
-
info && targetAxisInfo.push(info);
|
|
71284
|
-
}
|
|
71285
|
-
}
|
|
71286
|
-
else {
|
|
71287
|
-
const hasDiscreteAxis = bandAxisSet.size > 0;
|
|
71288
|
-
if ((hasDiscreteAxis ? bandAxisSet : linearAxisSet).has(axis)) {
|
|
71289
|
-
const info = getDimensionInfoByPosition(axis, posValue, getDimensionFieldFunc(isXAxis, hasDiscreteAxis));
|
|
71290
|
-
info && targetAxisInfo.push(info);
|
|
71291
|
-
}
|
|
71292
|
-
}
|
|
71293
|
-
});
|
|
71294
|
-
};
|
|
71295
|
-
if (chart.getSpec().direction === "horizontal") {
|
|
71296
|
-
addAxisDimensionInfo('y');
|
|
71297
|
-
if (targetAxisInfo.length === 0) {
|
|
71298
|
-
addAxisDimensionInfo('x');
|
|
71299
|
-
}
|
|
71300
|
-
}
|
|
71301
|
-
else {
|
|
71302
|
-
addAxisDimensionInfo('x');
|
|
71303
|
-
if (targetAxisInfo.length === 0) {
|
|
71304
|
-
addAxisDimensionInfo('y');
|
|
71305
|
-
}
|
|
71306
|
-
}
|
|
71307
|
-
if (!targetAxisInfo.length) {
|
|
71308
|
-
return null;
|
|
71309
|
-
}
|
|
71310
|
-
return targetAxisInfo;
|
|
71311
|
-
};
|
|
71312
|
-
const getDimensionInfoByPosition = (axis, posValue, getDimensionField) => {
|
|
71313
|
-
const value = axis.positionToData(posValue, true);
|
|
71314
|
-
return isNil$1(value) ? null : getDimensionInfoByValue(axis, value, getDimensionField);
|
|
71315
|
-
};
|
|
71316
|
-
const getDimensionInfoByValue = (axis, value, getDimensionField) => {
|
|
71317
|
-
const scale = axis.getScale();
|
|
71318
|
-
if (isNil$1(value)) {
|
|
71319
|
-
return null;
|
|
71320
|
-
}
|
|
71321
|
-
const domain = scale.domain();
|
|
71322
|
-
let index = domain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
|
|
71323
|
-
if (index < 0) {
|
|
71324
|
-
index = undefined;
|
|
71325
|
-
}
|
|
71326
|
-
const data = getDimensionData(value, axis, 'cartesian', getDimensionField !== null && getDimensionField !== void 0 ? getDimensionField : (isXAxis(axis.getOrient()) ? discreteXAxisGetDimensionField : discreteYAxisGetDimensionField));
|
|
71327
|
-
return { index, value, position: scale.scale(value), axis, data };
|
|
71328
|
-
};
|
|
71329
|
-
|
|
71330
71443
|
const layoutByValue$1 = (stateByField, series, layoutStartPoint, enableRemain = false) => {
|
|
71331
71444
|
if (!layoutStartPoint) {
|
|
71332
71445
|
layoutStartPoint = { x: 0, y: 0 };
|
|
@@ -71772,6 +71885,9 @@
|
|
|
71772
71885
|
}
|
|
71773
71886
|
shouldHandleTooltip(params, info) {
|
|
71774
71887
|
var _a, _b;
|
|
71888
|
+
if (!this.component.enable) {
|
|
71889
|
+
return false;
|
|
71890
|
+
}
|
|
71775
71891
|
if (isNil$1(info)) {
|
|
71776
71892
|
return false;
|
|
71777
71893
|
}
|
|
@@ -93082,106 +93198,6 @@
|
|
|
93082
93198
|
}
|
|
93083
93199
|
}
|
|
93084
93200
|
|
|
93085
|
-
const angleStandardize = (angle, range) => {
|
|
93086
|
-
const unit = Math.PI * 2;
|
|
93087
|
-
const min = minInArray(range);
|
|
93088
|
-
const max = maxInArray(range);
|
|
93089
|
-
if (angle < min) {
|
|
93090
|
-
angle += Math.ceil((min - angle) / unit) * unit;
|
|
93091
|
-
}
|
|
93092
|
-
else if (angle > max) {
|
|
93093
|
-
angle -= Math.ceil((angle - max) / unit) * unit;
|
|
93094
|
-
}
|
|
93095
|
-
return angle;
|
|
93096
|
-
};
|
|
93097
|
-
const getPolarDimensionInfo = (chart, pos) => {
|
|
93098
|
-
if (!chart) {
|
|
93099
|
-
return null;
|
|
93100
|
-
}
|
|
93101
|
-
const angleAxisList = getAxis(chart, (cmp) => cmp.getOrient() === 'angle', pos);
|
|
93102
|
-
const radiusAxisList = getAxis(chart, (cmp) => cmp.getOrient() === 'radius', pos);
|
|
93103
|
-
if ((!angleAxisList || !angleAxisList.length) && (!radiusAxisList || !radiusAxisList.length)) {
|
|
93104
|
-
return null;
|
|
93105
|
-
}
|
|
93106
|
-
const targetAxisInfo = [];
|
|
93107
|
-
const getDimensionField = (series) => series.getDimensionField()[0];
|
|
93108
|
-
const { x, y } = pos;
|
|
93109
|
-
if (angleAxisList) {
|
|
93110
|
-
angleAxisList.forEach(axis => {
|
|
93111
|
-
var _a;
|
|
93112
|
-
const angleScale = axis.getScale();
|
|
93113
|
-
if (angleScale && isDiscrete(angleScale.type)) {
|
|
93114
|
-
const angleDomain = angleScale.domain();
|
|
93115
|
-
const angleRange = angleScale.range();
|
|
93116
|
-
const center = axis.getCenter();
|
|
93117
|
-
const vector = {
|
|
93118
|
-
x: x - axis.getLayoutStartPoint().x - center.x,
|
|
93119
|
-
y: y - axis.getLayoutStartPoint().y - center.y
|
|
93120
|
-
};
|
|
93121
|
-
let angle = vectorAngle({ x: 1, y: 0 }, vector);
|
|
93122
|
-
angle = angleStandardize(angle, angleRange);
|
|
93123
|
-
const radius = distance(vector);
|
|
93124
|
-
const radiusScale = (_a = radiusAxisList[0]) === null || _a === void 0 ? void 0 : _a.getScale();
|
|
93125
|
-
const radiusRange = radiusScale === null || radiusScale === void 0 ? void 0 : radiusScale.range();
|
|
93126
|
-
if ((angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[0])) * (angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[1])) > 0 ||
|
|
93127
|
-
(radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[0])) * (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[1])) > 0) {
|
|
93128
|
-
return;
|
|
93129
|
-
}
|
|
93130
|
-
const value = axis.invert(angle);
|
|
93131
|
-
if (isNil$1(value)) {
|
|
93132
|
-
return;
|
|
93133
|
-
}
|
|
93134
|
-
let index = angleDomain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
|
|
93135
|
-
if (index < 0) {
|
|
93136
|
-
index = undefined;
|
|
93137
|
-
}
|
|
93138
|
-
const data = getDimensionData(value, axis, 'polar', getDimensionField);
|
|
93139
|
-
targetAxisInfo.push({ index, value, position: angleScale.scale(value), axis, data });
|
|
93140
|
-
}
|
|
93141
|
-
});
|
|
93142
|
-
}
|
|
93143
|
-
if (radiusAxisList) {
|
|
93144
|
-
radiusAxisList.forEach(axis => {
|
|
93145
|
-
var _a;
|
|
93146
|
-
const radiusScale = axis.getScale();
|
|
93147
|
-
const radiusRange = radiusScale === null || radiusScale === void 0 ? void 0 : radiusScale.range();
|
|
93148
|
-
if (radiusScale && isDiscrete(radiusScale.type)) {
|
|
93149
|
-
const center = axis.getCenter();
|
|
93150
|
-
const vector = {
|
|
93151
|
-
x: x - axis.getLayoutStartPoint().x - center.x,
|
|
93152
|
-
y: y - axis.getLayoutStartPoint().y - center.y
|
|
93153
|
-
};
|
|
93154
|
-
let angle = vectorAngle({ x: 1, y: 0 }, vector);
|
|
93155
|
-
if (angle < -Math.PI / 2) {
|
|
93156
|
-
angle = Math.PI * 2 + angle;
|
|
93157
|
-
}
|
|
93158
|
-
const radius = distance(vector);
|
|
93159
|
-
const angleScale = (_a = angleAxisList[0]) === null || _a === void 0 ? void 0 : _a.getScale();
|
|
93160
|
-
const angleRange = angleScale === null || angleScale === void 0 ? void 0 : angleScale.range();
|
|
93161
|
-
if ((angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[0])) * (angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[1])) > 0 ||
|
|
93162
|
-
(radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[0])) * (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[1])) > 0) {
|
|
93163
|
-
return;
|
|
93164
|
-
}
|
|
93165
|
-
const value = radiusScale.invert(radius);
|
|
93166
|
-
if (isNil$1(value)) {
|
|
93167
|
-
return;
|
|
93168
|
-
}
|
|
93169
|
-
const domain = radiusScale.domain();
|
|
93170
|
-
let index = domain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
|
|
93171
|
-
if (index < 0) {
|
|
93172
|
-
index = undefined;
|
|
93173
|
-
}
|
|
93174
|
-
const data = getDimensionData(value, axis, 'polar', getDimensionField);
|
|
93175
|
-
targetAxisInfo.push({ index, value, position: radiusScale.scale(value), axis, data });
|
|
93176
|
-
}
|
|
93177
|
-
});
|
|
93178
|
-
}
|
|
93179
|
-
if (!targetAxisInfo.length) {
|
|
93180
|
-
return null;
|
|
93181
|
-
}
|
|
93182
|
-
return targetAxisInfo;
|
|
93183
|
-
};
|
|
93184
|
-
|
|
93185
93201
|
class RoseChart extends BaseChart {
|
|
93186
93202
|
constructor() {
|
|
93187
93203
|
super(...arguments);
|
|
@@ -96069,6 +96085,7 @@
|
|
|
96069
96085
|
this.specKey = 'tooltip';
|
|
96070
96086
|
this.layoutType = 'none';
|
|
96071
96087
|
this._isReleased = false;
|
|
96088
|
+
this.enable = true;
|
|
96072
96089
|
this._alwaysShow = false;
|
|
96073
96090
|
this._eventList = [];
|
|
96074
96091
|
this._isTooltipShown = false;
|
|
@@ -103241,14 +103258,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
103241
103258
|
});
|
|
103242
103259
|
brush.addEventListener(IOperateType.drawStart, (e) => {
|
|
103243
103260
|
if (this._spec.disableDimensionHoverWhenBrushing) {
|
|
103244
|
-
this.
|
|
103261
|
+
this._option.globalInstance.disableDimensionHoverEvent(true);
|
|
103245
103262
|
}
|
|
103246
103263
|
this._setRegionMarkPickable(region, true);
|
|
103247
103264
|
this._emitEvent(exports.ChartEvent.brushStart, region, e);
|
|
103248
103265
|
});
|
|
103249
103266
|
brush.addEventListener(IOperateType.moveStart, (e) => {
|
|
103250
103267
|
if (this._spec.disableDimensionHoverWhenBrushing) {
|
|
103251
|
-
this.
|
|
103268
|
+
this._option.globalInstance.disableDimensionHoverEvent(true);
|
|
103252
103269
|
}
|
|
103253
103270
|
this._setRegionMarkPickable(region, true);
|
|
103254
103271
|
this._emitEvent(exports.ChartEvent.brushStart, region, e);
|
|
@@ -103265,7 +103282,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
103265
103282
|
});
|
|
103266
103283
|
brush.addEventListener(IOperateType.brushClear, (e) => {
|
|
103267
103284
|
if (this._spec.disableDimensionHoverWhenBrushing) {
|
|
103268
|
-
this.
|
|
103285
|
+
this._option.globalInstance.disableDimensionHoverEvent(false);
|
|
103269
103286
|
}
|
|
103270
103287
|
this._setRegionMarkPickable(region, true);
|
|
103271
103288
|
this._initMarkBrushState(componentIndex, '');
|
|
@@ -103273,7 +103290,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
103273
103290
|
});
|
|
103274
103291
|
brush.addEventListener(IOperateType.drawEnd, (e) => {
|
|
103275
103292
|
var _a;
|
|
103276
|
-
this.
|
|
103293
|
+
if (this._spec.disableDimensionHoverWhenBrushing) {
|
|
103294
|
+
this._option.globalInstance.disableDimensionHoverEvent(false);
|
|
103295
|
+
}
|
|
103277
103296
|
this._setRegionMarkPickable(region, true);
|
|
103278
103297
|
const { operateMask } = e.detail;
|
|
103279
103298
|
const { updateElementsState = true } = this._spec;
|
|
@@ -103297,7 +103316,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
103297
103316
|
}
|
|
103298
103317
|
});
|
|
103299
103318
|
brush.addEventListener(IOperateType.moveEnd, (e) => {
|
|
103300
|
-
this.
|
|
103319
|
+
if (this._spec.disableDimensionHoverWhenBrushing) {
|
|
103320
|
+
this._option.globalInstance.disableDimensionHoverEvent(false);
|
|
103321
|
+
}
|
|
103301
103322
|
this._setRegionMarkPickable(region, true);
|
|
103302
103323
|
const { operateMask } = e.detail;
|
|
103303
103324
|
const { updateElementsState = true } = this._spec;
|
|
@@ -103643,22 +103664,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
103643
103664
|
this._brushComponents = null;
|
|
103644
103665
|
}
|
|
103645
103666
|
}
|
|
103646
|
-
disableDimensionHover() {
|
|
103647
|
-
DimensionHoverEvent.disableDimensionEvent(true);
|
|
103648
|
-
this._option
|
|
103649
|
-
.getChart()
|
|
103650
|
-
.getComponentsByKey('crosshair')
|
|
103651
|
-
.forEach(crosshair => (crosshair.enable = false));
|
|
103652
|
-
this._option.globalInstance.setTooltipHandler((() => { }));
|
|
103653
|
-
}
|
|
103654
|
-
enableDimensionHover() {
|
|
103655
|
-
DimensionHoverEvent.disableDimensionEvent(false);
|
|
103656
|
-
this._option
|
|
103657
|
-
.getChart()
|
|
103658
|
-
.getComponentsByKey('crosshair')
|
|
103659
|
-
.forEach(crosshair => (crosshair.enable = true));
|
|
103660
|
-
this._option.globalInstance.setTooltipHandler(undefined);
|
|
103661
|
-
}
|
|
103662
103667
|
clearBrushStateAndMask() {
|
|
103663
103668
|
this._relativeRegions.forEach((region, componentIndex) => {
|
|
103664
103669
|
this._initMarkBrushState(componentIndex, '');
|