@visactor/vchart-extension 1.15.5-alpha.8 → 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +143 -814
- package/build/index.min.js +2 -2
- package/cjs/charts/conversion-funnel/conversion-funnel.js +3 -2
- package/cjs/charts/conversion-funnel/conversion-funnel.js.map +1 -1
- package/cjs/components/bar-link/index.js +1 -2
- package/cjs/components/series-break/series-break.js +2 -2
- package/cjs/components/series-break/series-break.js.map +1 -1
- package/cjs/components/series-break/util.js +6 -6
- package/cjs/components/series-break/util.js.map +1 -1
- package/cjs/components/series-label/type.js +2 -1
- package/cjs/index.d.ts +0 -1
- package/cjs/index.js +3 -3
- package/cjs/index.js.map +1 -1
- package/esm/charts/conversion-funnel/conversion-funnel.js +4 -3
- package/esm/charts/conversion-funnel/conversion-funnel.js.map +1 -1
- package/esm/components/bar-link/index.js +1 -2
- package/esm/components/series-break/series-break.js +2 -2
- package/esm/components/series-break/series-break.js.map +1 -1
- package/esm/components/series-break/util.js +6 -6
- package/esm/components/series-break/util.js.map +1 -1
- package/esm/components/series-label/type.js +2 -1
- package/esm/index.d.ts +0 -1
- package/esm/index.js +0 -2
- package/esm/index.js.map +1 -1
- package/package.json +10 -11
- package/cjs/charts/ranking-list/constant.d.ts +0 -2
- package/cjs/charts/ranking-list/constant.js +0 -74
- package/cjs/charts/ranking-list/constant.js.map +0 -1
- package/cjs/charts/ranking-list/interface.d.ts +0 -73
- package/cjs/charts/ranking-list/interface.js +0 -6
- package/cjs/charts/ranking-list/interface.js.map +0 -1
- package/cjs/charts/ranking-list/ranking-list-transformer.d.ts +0 -458
- package/cjs/charts/ranking-list/ranking-list-transformer.js +0 -376
- package/cjs/charts/ranking-list/ranking-list-transformer.js.map +0 -1
- package/cjs/charts/ranking-list/ranking-list.d.ts +0 -16
- package/cjs/charts/ranking-list/ranking-list.js +0 -34
- package/cjs/charts/ranking-list/ranking-list.js.map +0 -1
- package/cjs/charts/ranking-list/utils.d.ts +0 -7
- package/cjs/charts/ranking-list/utils.js +0 -51
- package/cjs/charts/ranking-list/utils.js.map +0 -1
- package/esm/charts/ranking-list/constant.d.ts +0 -2
- package/esm/charts/ranking-list/constant.js +0 -70
- package/esm/charts/ranking-list/constant.js.map +0 -1
- package/esm/charts/ranking-list/interface.d.ts +0 -73
- package/esm/charts/ranking-list/interface.js +0 -2
- package/esm/charts/ranking-list/interface.js.map +0 -1
- package/esm/charts/ranking-list/ranking-list-transformer.d.ts +0 -458
- package/esm/charts/ranking-list/ranking-list-transformer.js +0 -376
- package/esm/charts/ranking-list/ranking-list-transformer.js.map +0 -1
- package/esm/charts/ranking-list/ranking-list.d.ts +0 -16
- package/esm/charts/ranking-list/ranking-list.js +0 -27
- package/esm/charts/ranking-list/ranking-list.js.map +0 -1
- package/esm/charts/ranking-list/utils.d.ts +0 -7
- package/esm/charts/ranking-list/utils.js +0 -41
- package/esm/charts/ranking-list/utils.js.map +0 -1
package/build/index.js
CHANGED
|
@@ -338,678 +338,6 @@
|
|
|
338
338
|
}
|
|
339
339
|
};
|
|
340
340
|
|
|
341
|
-
const defaultSpec = {
|
|
342
|
-
width: 400,
|
|
343
|
-
height: 225,
|
|
344
|
-
labelLayout: 'top',
|
|
345
|
-
bar: {
|
|
346
|
-
height: 100,
|
|
347
|
-
style: {
|
|
348
|
-
cornerRadius: 5
|
|
349
|
-
}
|
|
350
|
-
},
|
|
351
|
-
barBackground: {
|
|
352
|
-
type: 'rect',
|
|
353
|
-
style: {
|
|
354
|
-
fill: 'rgba(255,255,255,0.1)',
|
|
355
|
-
cornerRadius: 5
|
|
356
|
-
}
|
|
357
|
-
},
|
|
358
|
-
rankingIcon: {
|
|
359
|
-
visible: true,
|
|
360
|
-
style: {
|
|
361
|
-
fill: 'rgba(253,253,253,0.5)',
|
|
362
|
-
size: 12
|
|
363
|
-
}
|
|
364
|
-
},
|
|
365
|
-
nameLabel: {
|
|
366
|
-
visible: true,
|
|
367
|
-
style: {
|
|
368
|
-
fontSize: 20,
|
|
369
|
-
fontWeight: 'normal',
|
|
370
|
-
fill: 'rgba(255,255,255,0.7)',
|
|
371
|
-
textBaseline: 'middle'
|
|
372
|
-
}
|
|
373
|
-
},
|
|
374
|
-
orderLabel: {
|
|
375
|
-
visible: true,
|
|
376
|
-
style: {
|
|
377
|
-
fontSize: 20,
|
|
378
|
-
fontWeight: 'normal',
|
|
379
|
-
fill: 'rgba(255,255,255,0.7)',
|
|
380
|
-
textBaseline: 'middle'
|
|
381
|
-
}
|
|
382
|
-
},
|
|
383
|
-
valueLabel: {
|
|
384
|
-
visible: true,
|
|
385
|
-
style: {
|
|
386
|
-
fontSize: 14,
|
|
387
|
-
fontWeight: 'normal',
|
|
388
|
-
fill: 'rgba(255,255,255,1)',
|
|
389
|
-
textBaseline: 'middle'
|
|
390
|
-
}
|
|
391
|
-
},
|
|
392
|
-
pageSize: 5,
|
|
393
|
-
scrollSize: 1,
|
|
394
|
-
animationAppear: {
|
|
395
|
-
enable: true,
|
|
396
|
-
type: 'grow',
|
|
397
|
-
duration: 1000,
|
|
398
|
-
easing: 'linear'
|
|
399
|
-
},
|
|
400
|
-
animationUpdate: {
|
|
401
|
-
enable: true,
|
|
402
|
-
type: 'grow',
|
|
403
|
-
duration: 1000,
|
|
404
|
-
easing: 'linear'
|
|
405
|
-
},
|
|
406
|
-
animationNormal: {
|
|
407
|
-
interval: 1000
|
|
408
|
-
}
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
const applyVisible = (spec, keyList) => {
|
|
412
|
-
keyList.forEach(key => {
|
|
413
|
-
var _a, _b, _c, _d, _e, _f;
|
|
414
|
-
if (vutils.isArray(spec[key])) {
|
|
415
|
-
spec[key].forEach((s, i) => {
|
|
416
|
-
var _a, _b, _c;
|
|
417
|
-
spec[key][i] = Object.assign(Object.assign({}, s), { style: Object.assign(Object.assign({}, s === null || s === void 0 ? void 0 : s.style), { visible: (_c = (_b = (_a = s === null || s === void 0 ? void 0 : s.style) === null || _a === void 0 ? void 0 : _a.visible) !== null && _b !== void 0 ? _b : s === null || s === void 0 ? void 0 : s.visible) !== null && _c !== void 0 ? _c : true }) });
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
else {
|
|
421
|
-
spec[key] = Object.assign(Object.assign({}, spec[key]), { style: Object.assign(Object.assign({}, (_a = spec[key]) === null || _a === void 0 ? void 0 : _a.style), { visible: (_f = (_d = (_c = (_b = spec[key]) === null || _b === void 0 ? void 0 : _b.style) === null || _c === void 0 ? void 0 : _c.visible) !== null && _d !== void 0 ? _d : (_e = spec[key]) === null || _e === void 0 ? void 0 : _e.visible) !== null && _f !== void 0 ? _f : true }) });
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
};
|
|
425
|
-
const mergeObjects = (objA, objB) => {
|
|
426
|
-
function recursiveMerge(target, source) {
|
|
427
|
-
for (const key in source) {
|
|
428
|
-
if (typeof source[key] === 'object' && source[key] !== null) {
|
|
429
|
-
if (!target.hasOwnProperty(key)) {
|
|
430
|
-
target[key] = Array.isArray(source[key]) ? [] : {};
|
|
431
|
-
}
|
|
432
|
-
recursiveMerge(target[key], source[key]);
|
|
433
|
-
}
|
|
434
|
-
else if (!target.hasOwnProperty(key) && typeof target === 'object') {
|
|
435
|
-
target[key] = source[key];
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
return target;
|
|
439
|
-
}
|
|
440
|
-
return recursiveMerge(objA, objB);
|
|
441
|
-
};
|
|
442
|
-
const computeDataRange = (data, field) => {
|
|
443
|
-
let dataMin, dataMax;
|
|
444
|
-
const datumX = data.map(d => d[field]).filter(d => typeof d !== 'undefined' && d !== null);
|
|
445
|
-
if (datumX.length === 0) {
|
|
446
|
-
dataMin = 0;
|
|
447
|
-
dataMax = 1;
|
|
448
|
-
}
|
|
449
|
-
else {
|
|
450
|
-
dataMin = Math.min(...datumX) - (Math.max(...datumX) - Math.min(...datumX)) / 3;
|
|
451
|
-
dataMax = (Math.max(...datumX) - dataMin) / 0.8 + dataMin;
|
|
452
|
-
const delta_value = 10;
|
|
453
|
-
const data = dataMin;
|
|
454
|
-
if (dataMin === dataMax) {
|
|
455
|
-
dataMin = data - delta_value;
|
|
456
|
-
dataMax = (4 * data + delta_value) / 4;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
return { min: dataMin, max: dataMax };
|
|
460
|
-
};
|
|
461
|
-
|
|
462
|
-
const DATA_KEY = 'dataKey';
|
|
463
|
-
const ORDER_KEY = 'VCHART_ORDER';
|
|
464
|
-
const SUPPLY_DATA_KEY = 'SUPPLY_DATA_KEY';
|
|
465
|
-
const NAME_LABEL_PADDING_RIGHT = 10;
|
|
466
|
-
const NAME_ORDER_PADDING_RIGHT = 5;
|
|
467
|
-
const NAME_SYMBOL_PADDING_RIGHT = 8;
|
|
468
|
-
const CHART_PADDING_LEFT = 5;
|
|
469
|
-
const CHART_PADDING_RIGHT = 5;
|
|
470
|
-
const VALUE_LABEL_PADDING_LEFT = 5;
|
|
471
|
-
const LABEL_PADDING_BOTTOM = 5;
|
|
472
|
-
class RankingListChartSpecTransformer extends vchart.CommonChartSpecTransformer {
|
|
473
|
-
constructor() {
|
|
474
|
-
super(...arguments);
|
|
475
|
-
this.formatMap = {};
|
|
476
|
-
this.paginateDataArr = (spec) => {
|
|
477
|
-
const { scrollSize = 1, pageSize = 5 } = spec;
|
|
478
|
-
const arr = this.originalData;
|
|
479
|
-
const result = {};
|
|
480
|
-
let pageOrder = 0;
|
|
481
|
-
for (let i = 0; i < arr.length; i += scrollSize) {
|
|
482
|
-
pageOrder++;
|
|
483
|
-
result[`page${pageOrder}`] = arr.slice(i, i + pageSize);
|
|
484
|
-
if (i + pageSize - 1 >= arr.length - 1) {
|
|
485
|
-
arr.push(...Array.from({ length: i + pageSize - arr.length }, _ => {
|
|
486
|
-
return {
|
|
487
|
-
[spec.yField]: Math.random() * 100,
|
|
488
|
-
[spec.xField]: null,
|
|
489
|
-
[SUPPLY_DATA_KEY]: true
|
|
490
|
-
};
|
|
491
|
-
}));
|
|
492
|
-
break;
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
return {
|
|
496
|
-
orderCount: pageOrder,
|
|
497
|
-
result: result
|
|
498
|
-
};
|
|
499
|
-
};
|
|
500
|
-
this.processRankingData = (spec) => {
|
|
501
|
-
const result = [];
|
|
502
|
-
spec.data.forEach((datum, index) => (datum[ORDER_KEY] = index + 1 < 10 ? `0${index + 1}` : index + 1));
|
|
503
|
-
const pagerData = this.paginateDataArr(spec).result;
|
|
504
|
-
const orderCount = this.paginateDataArr(spec).orderCount;
|
|
505
|
-
this.orderCount = orderCount;
|
|
506
|
-
const supplyCount = spec.pageSize - pagerData[`page${orderCount}`].length;
|
|
507
|
-
pagerData[`page${orderCount}`].push(...Array.from({ length: supplyCount }, _ => {
|
|
508
|
-
return {
|
|
509
|
-
[spec.yField]: Math.random() * 100,
|
|
510
|
-
[spec.xField]: null,
|
|
511
|
-
[SUPPLY_DATA_KEY]: true
|
|
512
|
-
};
|
|
513
|
-
}));
|
|
514
|
-
Object.keys(pagerData).forEach(order => {
|
|
515
|
-
result.push({
|
|
516
|
-
data: [
|
|
517
|
-
{
|
|
518
|
-
id: 'datas',
|
|
519
|
-
values: pagerData[order].map(d => {
|
|
520
|
-
return Object.assign(Object.assign({}, d), { [DATA_KEY]: d[spec.yField] });
|
|
521
|
-
})
|
|
522
|
-
},
|
|
523
|
-
{
|
|
524
|
-
id: 'order',
|
|
525
|
-
values: [
|
|
526
|
-
{
|
|
527
|
-
order
|
|
528
|
-
}
|
|
529
|
-
]
|
|
530
|
-
}
|
|
531
|
-
]
|
|
532
|
-
});
|
|
533
|
-
});
|
|
534
|
-
return result;
|
|
535
|
-
};
|
|
536
|
-
}
|
|
537
|
-
transformSpec(spec) {
|
|
538
|
-
super.transformSpec(spec);
|
|
539
|
-
this.normalizeSpec(spec);
|
|
540
|
-
this.upgradeTextMeasure(spec);
|
|
541
|
-
this.upgradeFormatMap(spec);
|
|
542
|
-
this.processData(spec);
|
|
543
|
-
this.transformBaseSpec(spec);
|
|
544
|
-
this.transformAnimationSpec(spec);
|
|
545
|
-
this.transformAxesSpec(spec);
|
|
546
|
-
spec.extensionMark = [
|
|
547
|
-
this.generateBarBackground(spec),
|
|
548
|
-
...this.generateDecorateHaloIcons(spec),
|
|
549
|
-
this.generateRankingIcon(spec),
|
|
550
|
-
this.generateNameLabel(spec),
|
|
551
|
-
this.generateOrderLabel(spec),
|
|
552
|
-
this.generateValueLabel(spec)
|
|
553
|
-
];
|
|
554
|
-
this.transformPaddingSpec(spec);
|
|
555
|
-
super.transformSpec(spec);
|
|
556
|
-
}
|
|
557
|
-
normalizeSpec(spec) {
|
|
558
|
-
mergeObjects(spec, defaultSpec);
|
|
559
|
-
applyVisible(spec, [
|
|
560
|
-
'barBackground',
|
|
561
|
-
'rankingIcon',
|
|
562
|
-
'decorateHaloIcons',
|
|
563
|
-
'orderLabel',
|
|
564
|
-
'nameLabel',
|
|
565
|
-
'valueLabel'
|
|
566
|
-
]);
|
|
567
|
-
}
|
|
568
|
-
upgradeTextMeasure(spec) {
|
|
569
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
570
|
-
(_a = this.nameLabelTextMeasure) === null || _a === void 0 ? void 0 : _a.release();
|
|
571
|
-
(_b = this.valueLabelTextMeasure) === null || _b === void 0 ? void 0 : _b.release();
|
|
572
|
-
(_c = this.orderLabelTextMeasure) === null || _c === void 0 ? void 0 : _c.release();
|
|
573
|
-
this.nameLabelTextMeasure = new vutils.TextMeasure({
|
|
574
|
-
defaultFontParams: (_e = (_d = spec.nameLabel) === null || _d === void 0 ? void 0 : _d.style) !== null && _e !== void 0 ? _e : {}
|
|
575
|
-
});
|
|
576
|
-
this.valueLabelTextMeasure = new vutils.TextMeasure({
|
|
577
|
-
defaultFontParams: (_g = (_f = spec.valueLabel) === null || _f === void 0 ? void 0 : _f.style) !== null && _g !== void 0 ? _g : {}
|
|
578
|
-
});
|
|
579
|
-
this.orderLabelTextMeasure = new vutils.TextMeasure({
|
|
580
|
-
defaultFontParams: (_j = (_h = spec.orderLabel) === null || _h === void 0 ? void 0 : _h.style) !== null && _j !== void 0 ? _j : {}
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
upgradeFormatMap(spec) {
|
|
584
|
-
this.formatMap[spec.yField] = spec.nameLabel.formatMethod;
|
|
585
|
-
this.formatMap[spec.xField] = spec.valueLabel.formatMethod;
|
|
586
|
-
this.formatMap[ORDER_KEY] = spec.orderLabel.formatMethod;
|
|
587
|
-
}
|
|
588
|
-
processData(spec) {
|
|
589
|
-
var _a;
|
|
590
|
-
if (!((_a = spec.data[0]) === null || _a === void 0 ? void 0 : _a.values)) {
|
|
591
|
-
this.originalData = spec.data;
|
|
592
|
-
this.originalSpec = vutils.cloneDeep(spec);
|
|
593
|
-
this.dataSpecs = this.processRankingData(spec);
|
|
594
|
-
spec.data = this.dataSpecs[0].data;
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
transformBaseSpec(spec) {
|
|
598
|
-
var _a, _b, _c;
|
|
599
|
-
spec.type = 'common';
|
|
600
|
-
spec.dataKey = DATA_KEY;
|
|
601
|
-
spec.series = [
|
|
602
|
-
{
|
|
603
|
-
type: 'bar',
|
|
604
|
-
direction: 'horizontal',
|
|
605
|
-
xField: spec.xField,
|
|
606
|
-
yField: spec.yField,
|
|
607
|
-
barWidth: (_b = (_a = spec.bar) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 10,
|
|
608
|
-
bar: Object.assign(Object.assign({}, spec.bar), { style: Object.assign(Object.assign({}, (_c = spec.bar) === null || _c === void 0 ? void 0 : _c.style), { x1: 0, visible: (datum) => {
|
|
609
|
-
var _a, _b;
|
|
610
|
-
if (datum[SUPPLY_DATA_KEY]) {
|
|
611
|
-
return false;
|
|
612
|
-
}
|
|
613
|
-
return (_b = (_a = spec.bar) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : true;
|
|
614
|
-
} }) })
|
|
615
|
-
}
|
|
616
|
-
];
|
|
617
|
-
}
|
|
618
|
-
transformAnimationSpec(spec) {
|
|
619
|
-
var _a, _b, _c;
|
|
620
|
-
if (spec.animationUpdate.enable && this.orderCount > 1) {
|
|
621
|
-
spec.player = Object.assign({ specs: this.dataSpecs, auto: true, visible: false, interval: ((_b = (_a = spec.animationNormal) === null || _a === void 0 ? void 0 : _a.interval) !== null && _b !== void 0 ? _b : 1000) + ((_c = spec.animationUpdate.duration) !== null && _c !== void 0 ? _c : 1000) / 2, loop: true }, spec.player);
|
|
622
|
-
spec.animationExit = this.getAnimationExit(this.originalSpec);
|
|
623
|
-
spec.animationEnter = this.getAnimationEnter(this.originalSpec);
|
|
624
|
-
spec.animationUpdate = this.getAnimationUpdate(this.originalSpec);
|
|
625
|
-
}
|
|
626
|
-
spec.animationNormal = this.originalSpec.animationNormal;
|
|
627
|
-
spec.animationAppear = this.getAnimationAppear(this.originalSpec, 'rect');
|
|
628
|
-
}
|
|
629
|
-
transformAxesSpec(spec) {
|
|
630
|
-
const { min, max } = computeDataRange(this.originalData, spec.xField);
|
|
631
|
-
spec.axes = [
|
|
632
|
-
{
|
|
633
|
-
orient: 'left',
|
|
634
|
-
type: 'band',
|
|
635
|
-
visible: false,
|
|
636
|
-
inverse: true,
|
|
637
|
-
paddingOuter: 0.5
|
|
638
|
-
},
|
|
639
|
-
{
|
|
640
|
-
orient: 'bottom',
|
|
641
|
-
label: { visible: true },
|
|
642
|
-
type: 'linear',
|
|
643
|
-
visible: false,
|
|
644
|
-
min,
|
|
645
|
-
max
|
|
646
|
-
}
|
|
647
|
-
];
|
|
648
|
-
}
|
|
649
|
-
generateBarBackground(spec) {
|
|
650
|
-
var _a;
|
|
651
|
-
return {
|
|
652
|
-
type: spec.barBackground.type,
|
|
653
|
-
dataId: 'data',
|
|
654
|
-
visible: true,
|
|
655
|
-
dataKey: DATA_KEY,
|
|
656
|
-
zIndex: -99,
|
|
657
|
-
state: (_a = spec.barBackground) === null || _a === void 0 ? void 0 : _a.state,
|
|
658
|
-
style: Object.assign(Object.assign({ x: (datum, ctx) => spec.barBackground.type === 'symbol' ? ctx.getRegion().getLayoutRect().width / 2 : 0, y: (datum, ctx) => {
|
|
659
|
-
return (ctx.valueToY([datum[spec.yField]]) +
|
|
660
|
-
ctx.yBandwidth() / 2 -
|
|
661
|
-
(spec.barBackground.type === 'symbol' ? 0 : spec.bar.height / 2));
|
|
662
|
-
}, size: (datum, ctx) => [ctx.getRegion().getLayoutRect().width, spec.bar.height], width: (datum, ctx) => ctx.getRegion().getLayoutRect().width, height: spec.bar.height }, spec.barBackground.style), { visible: (datum) => {
|
|
663
|
-
if (datum[SUPPLY_DATA_KEY]) {
|
|
664
|
-
return false;
|
|
665
|
-
}
|
|
666
|
-
return spec.barBackground.style.visible;
|
|
667
|
-
} }),
|
|
668
|
-
animation: true,
|
|
669
|
-
animationEnter: this.getAnimationEnter(this.originalSpec),
|
|
670
|
-
animationExit: this.getAnimationExit(this.originalSpec),
|
|
671
|
-
animationAppear: this.getAnimationAppear(this.originalSpec, 'barBack'),
|
|
672
|
-
animationUpdate: this.getAnimationUpdate(this.originalSpec)
|
|
673
|
-
};
|
|
674
|
-
}
|
|
675
|
-
generateDecorateHaloIcons(spec) {
|
|
676
|
-
var _a;
|
|
677
|
-
return (_a = spec.decorateHaloIcons) === null || _a === void 0 ? void 0 : _a.map((decorateHaloIcon) => {
|
|
678
|
-
return {
|
|
679
|
-
type: 'symbol',
|
|
680
|
-
dataId: 'data',
|
|
681
|
-
visible: true,
|
|
682
|
-
dataKey: DATA_KEY,
|
|
683
|
-
state: decorateHaloIcon === null || decorateHaloIcon === void 0 ? void 0 : decorateHaloIcon.state,
|
|
684
|
-
style: Object.assign(Object.assign({ x: (datum, ctx) => {
|
|
685
|
-
if (datum[spec.xField] === undefined || datum[spec.xField] === null) {
|
|
686
|
-
return undefined;
|
|
687
|
-
}
|
|
688
|
-
return ctx.valueToX([datum[spec.xField]]);
|
|
689
|
-
}, y: (datum, ctx) => {
|
|
690
|
-
return ctx.valueToY([datum[spec.yField]]) + ctx.yBandwidth() / 2;
|
|
691
|
-
} }, decorateHaloIcon.style), { visible: (datum) => {
|
|
692
|
-
if (datum[SUPPLY_DATA_KEY]) {
|
|
693
|
-
return false;
|
|
694
|
-
}
|
|
695
|
-
return decorateHaloIcon.style.visible;
|
|
696
|
-
} }),
|
|
697
|
-
animation: true,
|
|
698
|
-
animationEnter: this.getAnimationEnter(this.originalSpec),
|
|
699
|
-
animationExit: this.getAnimationExit(this.originalSpec),
|
|
700
|
-
animationAppear: this.getAnimationAppear(this.originalSpec, 'symbol'),
|
|
701
|
-
animationUpdate: this.getAnimationUpdate(this.originalSpec)
|
|
702
|
-
};
|
|
703
|
-
});
|
|
704
|
-
}
|
|
705
|
-
generateRankingIcon(spec) {
|
|
706
|
-
return {
|
|
707
|
-
type: 'symbol',
|
|
708
|
-
dataId: 'data',
|
|
709
|
-
visible: true,
|
|
710
|
-
dataKey: DATA_KEY,
|
|
711
|
-
state: spec.rankingIcon.state,
|
|
712
|
-
style: Object.assign(Object.assign({ x: (datum) => {
|
|
713
|
-
if (spec.labelLayout === 'bothEnd') {
|
|
714
|
-
return -(NAME_LABEL_PADDING_RIGHT +
|
|
715
|
-
this.nameLabelTextMeasure.fullMeasure(this.formatDatum(spec.yField, datum)).width +
|
|
716
|
-
(spec.orderLabel.style.visible
|
|
717
|
-
? NAME_ORDER_PADDING_RIGHT +
|
|
718
|
-
this.orderLabelTextMeasure.fullMeasure(this.formatDatum(ORDER_KEY, datum)).width
|
|
719
|
-
: 0) +
|
|
720
|
-
NAME_SYMBOL_PADDING_RIGHT);
|
|
721
|
-
}
|
|
722
|
-
return CHART_PADDING_LEFT;
|
|
723
|
-
}, y: (datum, ctx) => {
|
|
724
|
-
if (spec.labelLayout === 'bothEnd') {
|
|
725
|
-
return ctx.valueToY([datum[spec.yField]]) + ctx.yBandwidth() / 2;
|
|
726
|
-
}
|
|
727
|
-
return (ctx.valueToY([datum[spec.yField]]) +
|
|
728
|
-
ctx.yBandwidth() / 2 -
|
|
729
|
-
spec.bar.height / 2 -
|
|
730
|
-
LABEL_PADDING_BOTTOM -
|
|
731
|
-
Math.max(this.nameLabelTextMeasure.fullMeasure(this.formatDatum(spec.yField, datum)).height, this.orderLabelTextMeasure.fullMeasure(this.formatDatum(ORDER_KEY, datum)).height) /
|
|
732
|
-
2);
|
|
733
|
-
} }, spec.rankingIcon.style), { lineWidth: 0, stroke: null, visible: (datum) => {
|
|
734
|
-
if (datum[SUPPLY_DATA_KEY]) {
|
|
735
|
-
return false;
|
|
736
|
-
}
|
|
737
|
-
return spec.rankingIcon.style.visible;
|
|
738
|
-
} }),
|
|
739
|
-
animation: true,
|
|
740
|
-
animationEnter: this.getAnimationEnter(this.originalSpec),
|
|
741
|
-
animationExit: this.getAnimationExit(this.originalSpec),
|
|
742
|
-
animationAppear: this.getAnimationAppear(this.originalSpec, 'text'),
|
|
743
|
-
animationUpdate: this.getAnimationUpdate(this.originalSpec)
|
|
744
|
-
};
|
|
745
|
-
}
|
|
746
|
-
generateNameLabel(spec) {
|
|
747
|
-
var _a;
|
|
748
|
-
return {
|
|
749
|
-
type: 'text',
|
|
750
|
-
dataId: 'data',
|
|
751
|
-
dataKey: DATA_KEY,
|
|
752
|
-
state: (_a = spec.nameLabel) === null || _a === void 0 ? void 0 : _a.state,
|
|
753
|
-
style: Object.assign(Object.assign({ text: (datum) => this.formatDatum(spec.yField, datum), x: () => {
|
|
754
|
-
var _a;
|
|
755
|
-
if (spec.labelLayout === 'bothEnd') {
|
|
756
|
-
return -NAME_LABEL_PADDING_RIGHT;
|
|
757
|
-
}
|
|
758
|
-
return ((spec.rankingIcon.style.visible ? NAME_SYMBOL_PADDING_RIGHT + ((_a = spec.rankingIcon.style.size) !== null && _a !== void 0 ? _a : 10) : 0) +
|
|
759
|
-
(spec.orderLabel.style.visible
|
|
760
|
-
? NAME_ORDER_PADDING_RIGHT + this.getMaxDataLabelLens(spec, ORDER_KEY, this.orderLabelTextMeasure)
|
|
761
|
-
: 0));
|
|
762
|
-
}, y: (datum, ctx) => {
|
|
763
|
-
if (spec.labelLayout === 'bothEnd') {
|
|
764
|
-
return ctx.valueToY([datum[spec.yField]]) + ctx.yBandwidth() / 2;
|
|
765
|
-
}
|
|
766
|
-
return ctx.valueToY([datum[spec.yField]]) + ctx.yBandwidth() / 2 - spec.bar.height / 2 - LABEL_PADDING_BOTTOM;
|
|
767
|
-
} }, spec.nameLabel.style), { textAlign: spec.labelLayout === 'bothEnd' ? 'right' : 'left', textBaseline: spec.labelLayout === 'bothEnd' ? 'middle' : 'bottom', visible: (datum) => {
|
|
768
|
-
if (datum[SUPPLY_DATA_KEY]) {
|
|
769
|
-
return false;
|
|
770
|
-
}
|
|
771
|
-
return spec.nameLabel.style.visible;
|
|
772
|
-
} }),
|
|
773
|
-
animation: true,
|
|
774
|
-
animationEnter: this.getAnimationEnter(this.originalSpec),
|
|
775
|
-
animationExit: this.getAnimationExit(this.originalSpec),
|
|
776
|
-
animationAppear: this.getAnimationAppear(this.originalSpec, 'text'),
|
|
777
|
-
animationUpdate: this.getAnimationUpdate(this.originalSpec)
|
|
778
|
-
};
|
|
779
|
-
}
|
|
780
|
-
generateOrderLabel(spec) {
|
|
781
|
-
var _a;
|
|
782
|
-
return {
|
|
783
|
-
type: 'text',
|
|
784
|
-
dataId: 'data',
|
|
785
|
-
dataKey: DATA_KEY,
|
|
786
|
-
state: (_a = spec.orderLabel) === null || _a === void 0 ? void 0 : _a.state,
|
|
787
|
-
style: Object.assign(Object.assign({ text: (datum) => this.formatDatum(ORDER_KEY, datum), x: (datum) => {
|
|
788
|
-
var _a;
|
|
789
|
-
if (spec.labelLayout === 'bothEnd') {
|
|
790
|
-
return -(NAME_LABEL_PADDING_RIGHT +
|
|
791
|
-
this.nameLabelTextMeasure.fullMeasure(this.formatDatum(spec.yField, datum)).width +
|
|
792
|
-
NAME_ORDER_PADDING_RIGHT);
|
|
793
|
-
}
|
|
794
|
-
else {
|
|
795
|
-
return spec.rankingIcon.style.visible ? NAME_SYMBOL_PADDING_RIGHT + ((_a = spec.rankingIcon.style.size) !== null && _a !== void 0 ? _a : 10) : 0;
|
|
796
|
-
}
|
|
797
|
-
}, y: (datum, ctx) => {
|
|
798
|
-
if (spec.labelLayout === 'bothEnd') {
|
|
799
|
-
return ctx.valueToY([datum[spec.yField]]) + ctx.yBandwidth() / 2;
|
|
800
|
-
}
|
|
801
|
-
return ctx.valueToY([datum[spec.yField]]) + ctx.yBandwidth() / 2 - spec.bar.height / 2 - LABEL_PADDING_BOTTOM;
|
|
802
|
-
} }, spec.orderLabel.style), { textAlign: spec.labelLayout === 'bothEnd' ? 'right' : 'left', textBaseline: spec.labelLayout === 'bothEnd' ? 'middle' : 'bottom', visible: (datum) => {
|
|
803
|
-
if (datum[SUPPLY_DATA_KEY]) {
|
|
804
|
-
return false;
|
|
805
|
-
}
|
|
806
|
-
return spec.orderLabel.style.visible;
|
|
807
|
-
} }),
|
|
808
|
-
animation: true,
|
|
809
|
-
animationEnter: this.getAnimationEnter(this.originalSpec),
|
|
810
|
-
animationExit: this.getAnimationExit(this.originalSpec),
|
|
811
|
-
animationAppear: this.getAnimationAppear(this.originalSpec, 'text'),
|
|
812
|
-
animationUpdate: this.getAnimationUpdate(this.originalSpec)
|
|
813
|
-
};
|
|
814
|
-
}
|
|
815
|
-
generateValueLabel(spec) {
|
|
816
|
-
var _a;
|
|
817
|
-
return {
|
|
818
|
-
type: 'text',
|
|
819
|
-
dataId: 'data',
|
|
820
|
-
visible: true,
|
|
821
|
-
dataKey: DATA_KEY,
|
|
822
|
-
state: (_a = spec.valueLabel) === null || _a === void 0 ? void 0 : _a.state,
|
|
823
|
-
style: Object.assign(Object.assign({ text: (datum) => this.formatDatum(spec.xField, datum), x: (datum, ctx) => {
|
|
824
|
-
if (spec.labelLayout === 'bothEnd') {
|
|
825
|
-
return (ctx.getRegion().getLayoutRect().width +
|
|
826
|
-
VALUE_LABEL_PADDING_LEFT);
|
|
827
|
-
}
|
|
828
|
-
else {
|
|
829
|
-
return ctx.getRegion().getLayoutRect().width;
|
|
830
|
-
}
|
|
831
|
-
}, y: (datum, ctx) => {
|
|
832
|
-
if (spec.labelLayout === 'bothEnd') {
|
|
833
|
-
return ctx.valueToY([datum[spec.yField]]) + ctx.yBandwidth() / 2;
|
|
834
|
-
}
|
|
835
|
-
return ctx.valueToY([datum[spec.yField]]) + ctx.yBandwidth() / 2 - spec.bar.height / 2 - LABEL_PADDING_BOTTOM;
|
|
836
|
-
} }, spec.valueLabel.style), { textAlign: spec.labelLayout === 'bothEnd' ? 'left' : 'right', textBaseline: spec.labelLayout === 'bothEnd' ? 'middle' : 'bottom', visible: (datum) => {
|
|
837
|
-
if (datum[SUPPLY_DATA_KEY]) {
|
|
838
|
-
return false;
|
|
839
|
-
}
|
|
840
|
-
return spec.valueLabel.style.visible;
|
|
841
|
-
} }),
|
|
842
|
-
animation: true,
|
|
843
|
-
animationEnter: this.getAnimationEnter(this.originalSpec),
|
|
844
|
-
animationExit: this.getAnimationExit(this.originalSpec),
|
|
845
|
-
animationAppear: this.getAnimationAppear(this.originalSpec, 'text'),
|
|
846
|
-
animationUpdate: this.getAnimationUpdate(this.originalSpec)
|
|
847
|
-
};
|
|
848
|
-
}
|
|
849
|
-
transformPaddingSpec(spec) {
|
|
850
|
-
var _a;
|
|
851
|
-
const maxHaloIconSize = spec.decorateHaloIcons.length > 0
|
|
852
|
-
? Math.max(...spec.decorateHaloIcons.map((icon) => { var _a, _b; return (_b = (_a = icon.style) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 18; }))
|
|
853
|
-
: 0;
|
|
854
|
-
spec.padding = Object.assign({ left: spec.labelLayout === 'bothEnd'
|
|
855
|
-
? NAME_LABEL_PADDING_RIGHT +
|
|
856
|
-
this.getMaxDataLabelLens(spec, spec.yField, this.nameLabelTextMeasure) +
|
|
857
|
-
(spec.orderLabel.style.visible
|
|
858
|
-
? NAME_ORDER_PADDING_RIGHT + this.getMaxDataLabelLens(spec, ORDER_KEY, this.orderLabelTextMeasure)
|
|
859
|
-
: 0) +
|
|
860
|
-
(spec.rankingIcon.style.visible ? NAME_SYMBOL_PADDING_RIGHT + ((_a = spec.rankingIcon.style.size) !== null && _a !== void 0 ? _a : 10) : 0) +
|
|
861
|
-
CHART_PADDING_LEFT
|
|
862
|
-
: CHART_PADDING_LEFT + maxHaloIconSize / 2, right: spec.labelLayout === 'bothEnd'
|
|
863
|
-
? VALUE_LABEL_PADDING_LEFT +
|
|
864
|
-
this.getMaxDataLabelLens(spec, spec.xField, this.valueLabelTextMeasure) +
|
|
865
|
-
CHART_PADDING_RIGHT
|
|
866
|
-
: CHART_PADDING_RIGHT + 10, top: 0, bottom: 0 }, spec.padding);
|
|
867
|
-
}
|
|
868
|
-
getMaxDataLabelLens(spec, field, textMeasure) {
|
|
869
|
-
const textWidths = this.originalData.map(datum => datum[SUPPLY_DATA_KEY] ? 0 : textMeasure.fullMeasure(this.formatDatum(field, datum)).width);
|
|
870
|
-
return Math.max(...textWidths);
|
|
871
|
-
}
|
|
872
|
-
formatDatum(field, datum) {
|
|
873
|
-
var _a;
|
|
874
|
-
if ((_a = this.formatMap) === null || _a === void 0 ? void 0 : _a[field]) {
|
|
875
|
-
return this.formatMap[field](datum[field], datum);
|
|
876
|
-
}
|
|
877
|
-
else {
|
|
878
|
-
return datum[field];
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
getLabelWidth(padding, width) {
|
|
882
|
-
return width + padding;
|
|
883
|
-
}
|
|
884
|
-
getAnimationExit(spec) {
|
|
885
|
-
var _a, _b, _c, _d, _e;
|
|
886
|
-
if (((_a = spec.animationUpdate) === null || _a === void 0 ? void 0 : _a.enable) === false) {
|
|
887
|
-
return false;
|
|
888
|
-
}
|
|
889
|
-
return {
|
|
890
|
-
type: 'moveOut',
|
|
891
|
-
options: {
|
|
892
|
-
direction: 'y',
|
|
893
|
-
orient: 'negative',
|
|
894
|
-
point: (datum, element) => {
|
|
895
|
-
const channelAttr = element.getGraphicAttribute('y');
|
|
896
|
-
const barSpace = spec.height / (spec.pageSize + 1);
|
|
897
|
-
return { y: channelAttr - barSpace * Math.min(spec.scrollSize, spec.pageSize) };
|
|
898
|
-
}
|
|
899
|
-
},
|
|
900
|
-
duration: (_c = (_b = spec.animationUpdate) === null || _b === void 0 ? void 0 : _b.duration) !== null && _c !== void 0 ? _c : 1000,
|
|
901
|
-
easing: (_e = (_d = spec.animationUpdate) === null || _d === void 0 ? void 0 : _d.easing) !== null && _e !== void 0 ? _e : 'linear'
|
|
902
|
-
};
|
|
903
|
-
}
|
|
904
|
-
getAnimationEnter(spec) {
|
|
905
|
-
var _a, _b, _c, _d, _e;
|
|
906
|
-
if (((_a = spec.animationUpdate) === null || _a === void 0 ? void 0 : _a.enable) === false) {
|
|
907
|
-
return false;
|
|
908
|
-
}
|
|
909
|
-
return {
|
|
910
|
-
type: 'moveIn',
|
|
911
|
-
options: {
|
|
912
|
-
direction: 'y',
|
|
913
|
-
orient: 'negative',
|
|
914
|
-
excludeChannels: ['y'],
|
|
915
|
-
point: (datum, element) => {
|
|
916
|
-
const channelAttr = element.getGraphicAttribute('y');
|
|
917
|
-
return { y: channelAttr + (spec.height / (spec.pageSize + 1)) * Math.min(spec.scrollSize, spec.pageSize) };
|
|
918
|
-
}
|
|
919
|
-
},
|
|
920
|
-
duration: (_c = (_b = spec.animationUpdate) === null || _b === void 0 ? void 0 : _b.duration) !== null && _c !== void 0 ? _c : 1000,
|
|
921
|
-
easing: (_e = (_d = spec.animationUpdate) === null || _d === void 0 ? void 0 : _d.easing) !== null && _e !== void 0 ? _e : 'linear'
|
|
922
|
-
};
|
|
923
|
-
}
|
|
924
|
-
getAnimationAppear(spec, markType) {
|
|
925
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
926
|
-
if (((_a = spec.animationAppear) === null || _a === void 0 ? void 0 : _a.enable) === false) {
|
|
927
|
-
return false;
|
|
928
|
-
}
|
|
929
|
-
if (markType === 'rect') {
|
|
930
|
-
return {
|
|
931
|
-
type: 'growWidthIn',
|
|
932
|
-
oneByOne: false,
|
|
933
|
-
duration: (_c = (_b = spec.animationAppear) === null || _b === void 0 ? void 0 : _b.duration) !== null && _c !== void 0 ? _c : 1000,
|
|
934
|
-
easing: (_e = (_d = spec.animationAppear) === null || _d === void 0 ? void 0 : _d.easing) !== null && _e !== void 0 ? _e : 'linear',
|
|
935
|
-
options: {}
|
|
936
|
-
};
|
|
937
|
-
}
|
|
938
|
-
else if (markType === 'symbol') {
|
|
939
|
-
return {
|
|
940
|
-
channel: {
|
|
941
|
-
x: {
|
|
942
|
-
from: 0,
|
|
943
|
-
to: (datum, element) => {
|
|
944
|
-
return element.getGraphicItem().attribute.x;
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
},
|
|
948
|
-
duration: (_g = (_f = spec.animationAppear) === null || _f === void 0 ? void 0 : _f.duration) !== null && _g !== void 0 ? _g : 1000,
|
|
949
|
-
easing: (_j = (_h = spec.animationAppear) === null || _h === void 0 ? void 0 : _h.easing) !== null && _j !== void 0 ? _j : 'linear'
|
|
950
|
-
};
|
|
951
|
-
}
|
|
952
|
-
else {
|
|
953
|
-
return {
|
|
954
|
-
channel: {
|
|
955
|
-
opacity: {
|
|
956
|
-
from: 0,
|
|
957
|
-
to: 1
|
|
958
|
-
}
|
|
959
|
-
},
|
|
960
|
-
duration: (_l = (_k = spec.animationAppear) === null || _k === void 0 ? void 0 : _k.duration) !== null && _l !== void 0 ? _l : 1000,
|
|
961
|
-
easing: (_o = (_m = spec.animationAppear) === null || _m === void 0 ? void 0 : _m.easing) !== null && _o !== void 0 ? _o : 'linear'
|
|
962
|
-
};
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
getAnimationUpdate(spec) {
|
|
966
|
-
var _a, _b, _c, _d;
|
|
967
|
-
if (spec.animationUpdate.enable === false) {
|
|
968
|
-
return false;
|
|
969
|
-
}
|
|
970
|
-
return {
|
|
971
|
-
duration: (_b = (_a = spec.animationUpdate) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 1000,
|
|
972
|
-
easing: (_d = (_c = spec.animationUpdate) === null || _c === void 0 ? void 0 : _c.easing) !== null && _d !== void 0 ? _d : 'linear'
|
|
973
|
-
};
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
class RankingList extends vchart.BaseChart {
|
|
978
|
-
constructor() {
|
|
979
|
-
super(...arguments);
|
|
980
|
-
this.type = 'rankingList';
|
|
981
|
-
this.transformerConstructor = RankingListChartSpecTransformer;
|
|
982
|
-
}
|
|
983
|
-
init() {
|
|
984
|
-
if (!this.isValid()) {
|
|
985
|
-
return;
|
|
986
|
-
}
|
|
987
|
-
super.init();
|
|
988
|
-
}
|
|
989
|
-
isValid() {
|
|
990
|
-
var _a, _b, _c, _d;
|
|
991
|
-
const { xField, yField, data } = this._spec;
|
|
992
|
-
if (!xField || !yField) {
|
|
993
|
-
(_b = (_a = this._option).onError) === null || _b === void 0 ? void 0 : _b.call(_a, 'Missing Required Config: `xField`, `yField` ');
|
|
994
|
-
return false;
|
|
995
|
-
}
|
|
996
|
-
if (!data) {
|
|
997
|
-
(_d = (_c = this._option).onError) === null || _d === void 0 ? void 0 : _d.call(_c, 'Data is required');
|
|
998
|
-
return false;
|
|
999
|
-
}
|
|
1000
|
-
return true;
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
RankingList.type = 'rankingList';
|
|
1004
|
-
RankingList.view = 'singleDefault';
|
|
1005
|
-
RankingList.transformerConstructor = RankingListChartSpecTransformer;
|
|
1006
|
-
const registerRankingList = (option) => {
|
|
1007
|
-
const vchartConstructor = (option === null || option === void 0 ? void 0 : option.VChart) || vchart.VChart;
|
|
1008
|
-
if (vchartConstructor) {
|
|
1009
|
-
vchartConstructor.useChart([RankingList, vchart.BarChart]);
|
|
1010
|
-
}
|
|
1011
|
-
};
|
|
1012
|
-
|
|
1013
341
|
const fields = (data, options) => {
|
|
1014
342
|
var _a, _b;
|
|
1015
343
|
if (!(null == options ? void 0 : options.fields)) return data;
|
|
@@ -1594,7 +922,7 @@
|
|
|
1594
922
|
rightGroup.getMarks().forEach(mark => {
|
|
1595
923
|
mark.setDataView(this._arrowData);
|
|
1596
924
|
mark.compileData();
|
|
1597
|
-
mark.
|
|
925
|
+
mark.setTransform([
|
|
1598
926
|
{
|
|
1599
927
|
type: 'filter',
|
|
1600
928
|
callback: datum => datum.position === 'right'
|
|
@@ -1607,7 +935,7 @@
|
|
|
1607
935
|
leftGroup.getMarks().forEach(mark => {
|
|
1608
936
|
mark.setDataView(this._arrowData);
|
|
1609
937
|
mark.compileData();
|
|
1610
|
-
mark.
|
|
938
|
+
mark.setTransform([
|
|
1611
939
|
{
|
|
1612
940
|
type: 'filter',
|
|
1613
941
|
callback: datum => datum.position === 'left'
|
|
@@ -1618,6 +946,7 @@
|
|
|
1618
946
|
}
|
|
1619
947
|
}
|
|
1620
948
|
const registerConversionFunnelChart = (option) => {
|
|
949
|
+
vchart.registerMarkFilterTransform();
|
|
1621
950
|
const vchartConstructor = (option === null || option === void 0 ? void 0 : option.VChart) || vchart.VChart;
|
|
1622
951
|
if (vchartConstructor) {
|
|
1623
952
|
vchartConstructor.useChart([ConversionFunnelChart]);
|
|
@@ -2077,12 +1406,15 @@
|
|
|
2077
1406
|
serviceIdentifier: injectIdentifier,
|
|
2078
1407
|
constructorArgsMetadata: constructorArgsMetadata
|
|
2079
1408
|
},
|
|
2080
|
-
|
|
1409
|
+
bindings = (this._bindingDictionary.get(injectIdentifier) || []).filter(b => b.constraint(target));
|
|
1410
|
+
if (bindings.length) {
|
|
1411
|
+
const request = {
|
|
2081
1412
|
injectIdentifier: injectIdentifier,
|
|
2082
1413
|
metadata: constructorArgsMetadata,
|
|
2083
|
-
bindings:
|
|
1414
|
+
bindings: bindings
|
|
2084
1415
|
};
|
|
2085
|
-
|
|
1416
|
+
arr.push(request);
|
|
1417
|
+
}
|
|
2086
1418
|
}
|
|
2087
1419
|
return arr;
|
|
2088
1420
|
}
|
|
@@ -9083,6 +8415,7 @@
|
|
|
9083
8415
|
contains(graphic, point, params) {
|
|
9084
8416
|
if (!graphic.AABBBounds.containsPoint(point)) return !1;
|
|
9085
8417
|
if ("imprecise" === graphic.attribute.pickMode) return !0;
|
|
8418
|
+
if (!this.canvasRenderer) return !0;
|
|
9086
8419
|
const {
|
|
9087
8420
|
pickContext: pickContext
|
|
9088
8421
|
} = null != params ? params : {};
|
|
@@ -9582,131 +8915,6 @@
|
|
|
9582
8915
|
}
|
|
9583
8916
|
};
|
|
9584
8917
|
|
|
9585
|
-
class GlyphMeta {
|
|
9586
|
-
constructor(marks, encoders, defaultEncoder, progressiveChannels) {
|
|
9587
|
-
this.channelEncoder = {}, this.marks = marks, encoders && this.registerChannelEncoder(encoders), defaultEncoder && this.registerDefaultEncoder(defaultEncoder), this.progressiveChannels && this.registerProgressiveChannels(progressiveChannels);
|
|
9588
|
-
}
|
|
9589
|
-
getMarks() {
|
|
9590
|
-
return this.marks;
|
|
9591
|
-
}
|
|
9592
|
-
registerChannelEncoder(channel, encoder) {
|
|
9593
|
-
return vutils.isString(channel) ? this.channelEncoder[channel] = encoder : Object.assign(this.channelEncoder, channel), this;
|
|
9594
|
-
}
|
|
9595
|
-
registerFunctionEncoder(encoder) {
|
|
9596
|
-
return this.functionEncoder = encoder, this;
|
|
9597
|
-
}
|
|
9598
|
-
registerDefaultEncoder(encoder) {
|
|
9599
|
-
return this.defaultEncoder = encoder, this;
|
|
9600
|
-
}
|
|
9601
|
-
registerProgressiveChannels(channels) {
|
|
9602
|
-
return this.progressiveChannels = vutils.array(channels), this;
|
|
9603
|
-
}
|
|
9604
|
-
getChannelEncoder() {
|
|
9605
|
-
return this.channelEncoder;
|
|
9606
|
-
}
|
|
9607
|
-
getFunctionEncoder() {
|
|
9608
|
-
return this.functionEncoder;
|
|
9609
|
-
}
|
|
9610
|
-
getDefaultEncoder() {
|
|
9611
|
-
return this.defaultEncoder;
|
|
9612
|
-
}
|
|
9613
|
-
getProgressiveChannels() {
|
|
9614
|
-
return this.progressiveChannels;
|
|
9615
|
-
}
|
|
9616
|
-
}
|
|
9617
|
-
|
|
9618
|
-
class Factory {
|
|
9619
|
-
static registerPlotMarks(key, mark) {
|
|
9620
|
-
Factory._plotMarks[key] = mark;
|
|
9621
|
-
}
|
|
9622
|
-
static createPlotMark(type, id) {
|
|
9623
|
-
if (!Factory._plotMarks[type]) return null;
|
|
9624
|
-
return new (Factory._plotMarks[type])(id);
|
|
9625
|
-
}
|
|
9626
|
-
static registerMark(key, mark) {
|
|
9627
|
-
Factory._marks[key] = mark;
|
|
9628
|
-
}
|
|
9629
|
-
static createMark(type, view, group) {
|
|
9630
|
-
if (!Factory._marks[type]) return null;
|
|
9631
|
-
return new (Factory._marks[type])(view, type, group);
|
|
9632
|
-
}
|
|
9633
|
-
static hasMark(type) {
|
|
9634
|
-
return !!Factory._marks[type];
|
|
9635
|
-
}
|
|
9636
|
-
static getMark(type) {
|
|
9637
|
-
return Factory._marks[type];
|
|
9638
|
-
}
|
|
9639
|
-
static registerComponent(key, component) {
|
|
9640
|
-
Factory._components[key] = component;
|
|
9641
|
-
}
|
|
9642
|
-
static createComponent(componentType, view, group, mode) {
|
|
9643
|
-
const Ctor = Factory._components[componentType];
|
|
9644
|
-
return Ctor ? new Ctor(view, group, mode) : null;
|
|
9645
|
-
}
|
|
9646
|
-
static hasComponent(componentType) {
|
|
9647
|
-
return !!Factory._components[componentType];
|
|
9648
|
-
}
|
|
9649
|
-
static registerGraphicComponent(key, creator) {
|
|
9650
|
-
Factory._graphicComponents[key] = creator;
|
|
9651
|
-
}
|
|
9652
|
-
static createGraphicComponent(componentType, attrs, options) {
|
|
9653
|
-
const compCreator = Factory._graphicComponents[componentType];
|
|
9654
|
-
return compCreator ? compCreator(attrs, options) : null;
|
|
9655
|
-
}
|
|
9656
|
-
static registerTransform(type, transform, isBuiltIn) {
|
|
9657
|
-
Factory._transforms[type] = Object.assign(transform, {
|
|
9658
|
-
type: type,
|
|
9659
|
-
isBuiltIn: !!isBuiltIn
|
|
9660
|
-
});
|
|
9661
|
-
}
|
|
9662
|
-
static getTransform(type) {
|
|
9663
|
-
return Factory._transforms[type];
|
|
9664
|
-
}
|
|
9665
|
-
static unregisterRuntimeTransforms() {
|
|
9666
|
-
Object.keys(Factory._transforms).forEach(type => {
|
|
9667
|
-
Factory._transforms[type] && !Factory._transforms[type].isBuiltIn && (Factory._transforms[type] = null);
|
|
9668
|
-
});
|
|
9669
|
-
}
|
|
9670
|
-
static registerGrammar(type, grammarClass, specKey) {
|
|
9671
|
-
Factory._grammars[type] = {
|
|
9672
|
-
grammarClass: grammarClass,
|
|
9673
|
-
specKey: null != specKey ? specKey : type
|
|
9674
|
-
};
|
|
9675
|
-
}
|
|
9676
|
-
static createGrammar(type, view, grammarType) {
|
|
9677
|
-
var _a;
|
|
9678
|
-
const Ctor = null === (_a = Factory._grammars[type]) || void 0 === _a ? void 0 : _a.grammarClass;
|
|
9679
|
-
return Ctor ? new Ctor(view, grammarType) : null;
|
|
9680
|
-
}
|
|
9681
|
-
static getGrammars() {
|
|
9682
|
-
return this._grammars;
|
|
9683
|
-
}
|
|
9684
|
-
static getGlyph(glyphType) {
|
|
9685
|
-
return Factory._glyphs[glyphType];
|
|
9686
|
-
}
|
|
9687
|
-
static createInteraction(interactionType, view, options) {
|
|
9688
|
-
const Ctor = Factory._interactions[interactionType];
|
|
9689
|
-
return Ctor ? new Ctor(view, options) : null;
|
|
9690
|
-
}
|
|
9691
|
-
static hasInteraction(interactionType) {
|
|
9692
|
-
return !!Factory._interactions[interactionType];
|
|
9693
|
-
}
|
|
9694
|
-
}
|
|
9695
|
-
Factory._plotMarks = {}, Factory._marks = {}, Factory._components = {}, Factory._graphicComponents = {}, Factory._transforms = {}, Factory._grammars = {}, Factory._glyphs = {}, Factory._animations = {}, Factory._interactions = {}, Factory._graphics = {}, Factory._stageEventPlugins = {}, Factory.registerGlyph = (glyphType, marks, encoders, defaultEncoder, progressiveChannels) => (Factory._glyphs[glyphType] = new GlyphMeta(marks, encoders, defaultEncoder, progressiveChannels), Factory._glyphs[glyphType]), Factory.registerAnimationType = (animationType, animation) => {
|
|
9696
|
-
Factory._animations[animationType] = animation;
|
|
9697
|
-
}, Factory.getAnimationType = animationType => Factory._animations[animationType], Factory.registerInteraction = (interactionType, interaction) => {
|
|
9698
|
-
Factory._interactions[interactionType] = interaction;
|
|
9699
|
-
}, Factory.registerGraphic = (graphicType, creator) => {
|
|
9700
|
-
Factory._graphics[graphicType] = creator;
|
|
9701
|
-
}, Factory.getGraphicType = graphicType => Factory._graphics[graphicType], Factory.createGraphic = (graphicType, attributes) => {
|
|
9702
|
-
const creator = Factory._graphics[graphicType];
|
|
9703
|
-
return creator ? creator(attributes) : null;
|
|
9704
|
-
}, Factory.registerDefaultLayout = layout => {
|
|
9705
|
-
Factory.defaultLayout = layout;
|
|
9706
|
-
}, Factory.getDefaultLayout = () => Factory.defaultLayout, Factory.registerStageEventPlugin = (type, Plugin) => {
|
|
9707
|
-
Factory._stageEventPlugins[type] = Plugin;
|
|
9708
|
-
}, Factory.getStageEventPlugin = type => Factory._stageEventPlugins[type];
|
|
9709
|
-
|
|
9710
8918
|
const SERIES_BREAK = 'seriesBreak';
|
|
9711
8919
|
|
|
9712
8920
|
function generateZigzagPath(start, end, size, angle, isVertical = false) {
|
|
@@ -9839,7 +9047,7 @@
|
|
|
9839
9047
|
}
|
|
9840
9048
|
}
|
|
9841
9049
|
const registerSeriesBreak = () => {
|
|
9842
|
-
Factory.registerGraphicComponent('seriesBreak', (attrs) => new SeriesBreakComponent(attrs));
|
|
9050
|
+
vchart.Factory.registerGraphicComponent('seriesBreak', (attrs) => new SeriesBreakComponent(attrs));
|
|
9843
9051
|
};
|
|
9844
9052
|
|
|
9845
9053
|
function getAllRegionBounds(regions) {
|
|
@@ -9907,9 +9115,9 @@
|
|
|
9907
9115
|
chart.getAllSeries().forEach((s) => {
|
|
9908
9116
|
if (s.type === 'bar' || s.type === 'waterfall') {
|
|
9909
9117
|
const mark = s.getMarkInName('bar');
|
|
9910
|
-
const
|
|
9911
|
-
|
|
9912
|
-
const elementBounds = element.
|
|
9118
|
+
const graphics = mark.getGraphics();
|
|
9119
|
+
graphics.forEach((element) => {
|
|
9120
|
+
const elementBounds = element.AABBBounds;
|
|
9913
9121
|
let shouldDrawBreak = false;
|
|
9914
9122
|
let startX;
|
|
9915
9123
|
let startY;
|
|
@@ -9953,9 +9161,8 @@
|
|
|
9953
9161
|
}
|
|
9954
9162
|
else if (s.type === 'line') {
|
|
9955
9163
|
const mark = s.getMarkInName(s.type);
|
|
9956
|
-
const
|
|
9957
|
-
|
|
9958
|
-
const graphicItem = element.graphicItem;
|
|
9164
|
+
const graphics = mark.getGraphics();
|
|
9165
|
+
graphics.forEach(graphicItem => {
|
|
9959
9166
|
const points = getAreaOrLinePathPoints(graphicItem, 'line');
|
|
9960
9167
|
points.forEach(linePoints => {
|
|
9961
9168
|
const intersections = getIntersectionsFromLineAndPolyline(isHorizontal
|
|
@@ -10004,9 +9211,8 @@
|
|
|
10004
9211
|
}
|
|
10005
9212
|
else if (s.type === 'area') {
|
|
10006
9213
|
const mark = s.getMarkInName('area');
|
|
10007
|
-
const
|
|
10008
|
-
|
|
10009
|
-
const graphicItem = element.graphicItem;
|
|
9214
|
+
const graphics = mark.getGraphics();
|
|
9215
|
+
graphics.forEach(graphicItem => {
|
|
10010
9216
|
const points = getAreaOrLinePathPoints(graphicItem, 'area');
|
|
10011
9217
|
points.forEach(areaPoints => {
|
|
10012
9218
|
const intersections = getIntersectionsFromLineAndPolyline(isHorizontal
|
|
@@ -10172,6 +9378,131 @@
|
|
|
10172
9378
|
return false;
|
|
10173
9379
|
};
|
|
10174
9380
|
|
|
9381
|
+
class GlyphMeta {
|
|
9382
|
+
constructor(marks, encoders, defaultEncoder, progressiveChannels) {
|
|
9383
|
+
this.channelEncoder = {}, this.marks = marks, encoders && this.registerChannelEncoder(encoders), defaultEncoder && this.registerDefaultEncoder(defaultEncoder), this.progressiveChannels && this.registerProgressiveChannels(progressiveChannels);
|
|
9384
|
+
}
|
|
9385
|
+
getMarks() {
|
|
9386
|
+
return this.marks;
|
|
9387
|
+
}
|
|
9388
|
+
registerChannelEncoder(channel, encoder) {
|
|
9389
|
+
return vutils.isString(channel) ? this.channelEncoder[channel] = encoder : Object.assign(this.channelEncoder, channel), this;
|
|
9390
|
+
}
|
|
9391
|
+
registerFunctionEncoder(encoder) {
|
|
9392
|
+
return this.functionEncoder = encoder, this;
|
|
9393
|
+
}
|
|
9394
|
+
registerDefaultEncoder(encoder) {
|
|
9395
|
+
return this.defaultEncoder = encoder, this;
|
|
9396
|
+
}
|
|
9397
|
+
registerProgressiveChannels(channels) {
|
|
9398
|
+
return this.progressiveChannels = vutils.array(channels), this;
|
|
9399
|
+
}
|
|
9400
|
+
getChannelEncoder() {
|
|
9401
|
+
return this.channelEncoder;
|
|
9402
|
+
}
|
|
9403
|
+
getFunctionEncoder() {
|
|
9404
|
+
return this.functionEncoder;
|
|
9405
|
+
}
|
|
9406
|
+
getDefaultEncoder() {
|
|
9407
|
+
return this.defaultEncoder;
|
|
9408
|
+
}
|
|
9409
|
+
getProgressiveChannels() {
|
|
9410
|
+
return this.progressiveChannels;
|
|
9411
|
+
}
|
|
9412
|
+
}
|
|
9413
|
+
|
|
9414
|
+
class Factory {
|
|
9415
|
+
static registerPlotMarks(key, mark) {
|
|
9416
|
+
Factory._plotMarks[key] = mark;
|
|
9417
|
+
}
|
|
9418
|
+
static createPlotMark(type, id) {
|
|
9419
|
+
if (!Factory._plotMarks[type]) return null;
|
|
9420
|
+
return new (Factory._plotMarks[type])(id);
|
|
9421
|
+
}
|
|
9422
|
+
static registerMark(key, mark) {
|
|
9423
|
+
Factory._marks[key] = mark;
|
|
9424
|
+
}
|
|
9425
|
+
static createMark(type, view, group) {
|
|
9426
|
+
if (!Factory._marks[type]) return null;
|
|
9427
|
+
return new (Factory._marks[type])(view, type, group);
|
|
9428
|
+
}
|
|
9429
|
+
static hasMark(type) {
|
|
9430
|
+
return !!Factory._marks[type];
|
|
9431
|
+
}
|
|
9432
|
+
static getMark(type) {
|
|
9433
|
+
return Factory._marks[type];
|
|
9434
|
+
}
|
|
9435
|
+
static registerComponent(key, component) {
|
|
9436
|
+
Factory._components[key] = component;
|
|
9437
|
+
}
|
|
9438
|
+
static createComponent(componentType, view, group, mode) {
|
|
9439
|
+
const Ctor = Factory._components[componentType];
|
|
9440
|
+
return Ctor ? new Ctor(view, group, mode) : null;
|
|
9441
|
+
}
|
|
9442
|
+
static hasComponent(componentType) {
|
|
9443
|
+
return !!Factory._components[componentType];
|
|
9444
|
+
}
|
|
9445
|
+
static registerGraphicComponent(key, creator) {
|
|
9446
|
+
Factory._graphicComponents[key] = creator;
|
|
9447
|
+
}
|
|
9448
|
+
static createGraphicComponent(componentType, attrs, options) {
|
|
9449
|
+
const compCreator = Factory._graphicComponents[componentType];
|
|
9450
|
+
return compCreator ? compCreator(attrs, options) : null;
|
|
9451
|
+
}
|
|
9452
|
+
static registerTransform(type, transform, isBuiltIn) {
|
|
9453
|
+
Factory._transforms[type] = Object.assign(transform, {
|
|
9454
|
+
type: type,
|
|
9455
|
+
isBuiltIn: !!isBuiltIn
|
|
9456
|
+
});
|
|
9457
|
+
}
|
|
9458
|
+
static getTransform(type) {
|
|
9459
|
+
return Factory._transforms[type];
|
|
9460
|
+
}
|
|
9461
|
+
static unregisterRuntimeTransforms() {
|
|
9462
|
+
Object.keys(Factory._transforms).forEach(type => {
|
|
9463
|
+
Factory._transforms[type] && !Factory._transforms[type].isBuiltIn && (Factory._transforms[type] = null);
|
|
9464
|
+
});
|
|
9465
|
+
}
|
|
9466
|
+
static registerGrammar(type, grammarClass, specKey) {
|
|
9467
|
+
Factory._grammars[type] = {
|
|
9468
|
+
grammarClass: grammarClass,
|
|
9469
|
+
specKey: null != specKey ? specKey : type
|
|
9470
|
+
};
|
|
9471
|
+
}
|
|
9472
|
+
static createGrammar(type, view, grammarType) {
|
|
9473
|
+
var _a;
|
|
9474
|
+
const Ctor = null === (_a = Factory._grammars[type]) || void 0 === _a ? void 0 : _a.grammarClass;
|
|
9475
|
+
return Ctor ? new Ctor(view, grammarType) : null;
|
|
9476
|
+
}
|
|
9477
|
+
static getGrammars() {
|
|
9478
|
+
return this._grammars;
|
|
9479
|
+
}
|
|
9480
|
+
static getGlyph(glyphType) {
|
|
9481
|
+
return Factory._glyphs[glyphType];
|
|
9482
|
+
}
|
|
9483
|
+
static createInteraction(interactionType, view, options) {
|
|
9484
|
+
const Ctor = Factory._interactions[interactionType];
|
|
9485
|
+
return Ctor ? new Ctor(view, options) : null;
|
|
9486
|
+
}
|
|
9487
|
+
static hasInteraction(interactionType) {
|
|
9488
|
+
return !!Factory._interactions[interactionType];
|
|
9489
|
+
}
|
|
9490
|
+
}
|
|
9491
|
+
Factory._plotMarks = {}, Factory._marks = {}, Factory._components = {}, Factory._graphicComponents = {}, Factory._transforms = {}, Factory._grammars = {}, Factory._glyphs = {}, Factory._animations = {}, Factory._interactions = {}, Factory._graphics = {}, Factory._stageEventPlugins = {}, Factory.registerGlyph = (glyphType, marks, encoders, defaultEncoder, progressiveChannels) => (Factory._glyphs[glyphType] = new GlyphMeta(marks, encoders, defaultEncoder, progressiveChannels), Factory._glyphs[glyphType]), Factory.registerAnimationType = (animationType, animation) => {
|
|
9492
|
+
Factory._animations[animationType] = animation;
|
|
9493
|
+
}, Factory.getAnimationType = animationType => Factory._animations[animationType], Factory.registerInteraction = (interactionType, interaction) => {
|
|
9494
|
+
Factory._interactions[interactionType] = interaction;
|
|
9495
|
+
}, Factory.registerGraphic = (graphicType, creator) => {
|
|
9496
|
+
Factory._graphics[graphicType] = creator;
|
|
9497
|
+
}, Factory.getGraphicType = graphicType => Factory._graphics[graphicType], Factory.createGraphic = (graphicType, attributes) => {
|
|
9498
|
+
const creator = Factory._graphics[graphicType];
|
|
9499
|
+
return creator ? creator(attributes) : null;
|
|
9500
|
+
}, Factory.registerDefaultLayout = layout => {
|
|
9501
|
+
Factory.defaultLayout = layout;
|
|
9502
|
+
}, Factory.getDefaultLayout = () => Factory.defaultLayout, Factory.registerStageEventPlugin = (type, Plugin) => {
|
|
9503
|
+
Factory._stageEventPlugins[type] = Plugin;
|
|
9504
|
+
}, Factory.getStageEventPlugin = type => Factory._stageEventPlugins[type];
|
|
9505
|
+
|
|
10175
9506
|
const BAR_LINK = 'barLink';
|
|
10176
9507
|
|
|
10177
9508
|
class BarLinkComponent extends AbstractComponent {
|
|
@@ -10838,7 +10169,6 @@
|
|
|
10838
10169
|
exports.DEFAULT_ARROW_TEXT_MARK_STYLE = DEFAULT_ARROW_TEXT_MARK_STYLE;
|
|
10839
10170
|
exports.DEFAULT_FUNNEL_BACKGROUND_MARK_STYLE = DEFAULT_FUNNEL_BACKGROUND_MARK_STYLE;
|
|
10840
10171
|
exports.RankingBar = RankingBar;
|
|
10841
|
-
exports.RankingList = RankingList;
|
|
10842
10172
|
exports.SERIES_BREAK = SERIES_BREAK;
|
|
10843
10173
|
exports.SeriesBreakComponent = SeriesBreakComponent;
|
|
10844
10174
|
exports.SeriesLabelComponent = SeriesLabelComponent;
|
|
@@ -10851,7 +10181,6 @@
|
|
|
10851
10181
|
exports.registerBarLink = registerBarLink;
|
|
10852
10182
|
exports.registerConversionFunnelChart = registerConversionFunnelChart;
|
|
10853
10183
|
exports.registerRankingBarChart = registerRankingBarChart;
|
|
10854
|
-
exports.registerRankingList = registerRankingList;
|
|
10855
10184
|
exports.registerSeriesBreak = registerSeriesBreak;
|
|
10856
10185
|
exports.registerSeriesLabel = registerSeriesLabel;
|
|
10857
10186
|
|