@visactor/vtable 0.13.4-alpha.4 → 0.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/axis/get-axis-attributes.d.ts +0 -7
- package/cjs/components/axis/get-axis-attributes.js +17 -13
- package/cjs/components/axis/get-axis-attributes.js.map +1 -1
- package/cjs/components/legend/continue-legend/continue-legend.js +0 -1
- package/cjs/components/legend/continue-legend/continue-legend.js.map +1 -1
- package/cjs/components/legend/discrete-legend/discrete-legend.js +0 -1
- package/cjs/components/legend/discrete-legend/discrete-legend.js.map +1 -1
- package/cjs/components/title/title.js +6 -7
- package/cjs/components/title/title.js.map +1 -1
- package/cjs/core/BaseTable.js +1 -2
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/dataset/dataset.d.ts +1 -0
- package/cjs/dataset/dataset.js +43 -3
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/dataset/util/zero-align.js.map +1 -0
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/chart-helper/get-axis-config.js +35 -71
- package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
- package/cjs/layout/chart-helper/get-axis-domain.d.ts +1 -1
- package/cjs/layout/chart-helper/get-axis-domain.js +8 -18
- package/cjs/layout/chart-helper/get-axis-domain.js.map +1 -1
- package/cjs/layout/chart-helper/get-chart-spec.js +17 -33
- package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +2 -2
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/cjs/scenegraph/layout/update-height.js +4 -2
- package/cjs/scenegraph/layout/update-height.js.map +1 -1
- package/dist/vtable.js +341 -387
- package/dist/vtable.min.js +2 -2
- package/es/components/axis/get-axis-attributes.d.ts +0 -7
- package/es/components/axis/get-axis-attributes.js +1 -1
- package/es/components/axis/get-axis-attributes.js.map +1 -1
- package/es/components/legend/continue-legend/continue-legend.js +0 -1
- package/es/components/legend/continue-legend/continue-legend.js.map +1 -1
- package/es/components/legend/discrete-legend/discrete-legend.js +0 -1
- package/es/components/legend/discrete-legend/discrete-legend.js.map +1 -1
- package/es/components/title/title.js +6 -6
- package/es/components/title/title.js.map +1 -1
- package/es/core/BaseTable.js +1 -2
- package/es/core/BaseTable.js.map +1 -1
- package/es/dataset/dataset.d.ts +1 -0
- package/es/dataset/dataset.js +46 -2
- package/es/dataset/dataset.js.map +1 -1
- package/es/dataset/util/zero-align.js.map +1 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/chart-helper/get-axis-config.js +33 -72
- package/es/layout/chart-helper/get-axis-config.js.map +1 -1
- package/es/layout/chart-helper/get-axis-domain.d.ts +1 -1
- package/es/layout/chart-helper/get-axis-domain.js +8 -20
- package/es/layout/chart-helper/get-axis-domain.js.map +1 -1
- package/es/layout/chart-helper/get-chart-spec.js +12 -33
- package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.js +2 -2
- package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/es/scenegraph/layout/update-height.js +4 -2
- package/es/scenegraph/layout/update-height.js.map +1 -1
- package/package.json +3 -3
- package/cjs/layout/chart-helper/zero-align.js.map +0 -1
- package/es/layout/chart-helper/zero-align.js.map +0 -1
- /package/cjs/{layout/chart-helper → dataset/util}/zero-align.d.ts +0 -0
- /package/cjs/{layout/chart-helper → dataset/util}/zero-align.js +0 -0
- /package/es/{layout/chart-helper → dataset/util}/zero-align.d.ts +0 -0
- /package/es/{layout/chart-helper → dataset/util}/zero-align.js +0 -0
package/dist/vtable.js
CHANGED
|
@@ -40385,21 +40385,11 @@
|
|
|
40385
40385
|
}
|
|
40386
40386
|
|
|
40387
40387
|
const DEFAULT_CONTINUOUS_TICK_COUNT = 5;
|
|
40388
|
-
function getAxisDomainRangeAndLabels(min, max, axisOption, isZeroAlign,
|
|
40388
|
+
function getAxisDomainRangeAndLabels(min, max, axisOption, isZeroAlign, skipTick) {
|
|
40389
40389
|
if (axisOption?.zero) {
|
|
40390
40390
|
min = Math.min(min, 0);
|
|
40391
40391
|
max = Math.max(max, 0);
|
|
40392
40392
|
}
|
|
40393
|
-
if (axisOption?.expand) {
|
|
40394
|
-
const domainMin = min;
|
|
40395
|
-
const domainMax = max;
|
|
40396
|
-
if (isValid$6(axisOption.expand.min)) {
|
|
40397
|
-
min = domainMin - (domainMax - domainMin) * axisOption.expand.min;
|
|
40398
|
-
}
|
|
40399
|
-
if (isValid$6(axisOption.expand.max)) {
|
|
40400
|
-
max = domainMax + (domainMax - domainMin) * axisOption.expand.max;
|
|
40401
|
-
}
|
|
40402
|
-
}
|
|
40403
40393
|
if (isNumber$6(axisOption?.min)) {
|
|
40404
40394
|
min = axisOption.min;
|
|
40405
40395
|
}
|
|
@@ -40419,16 +40409,8 @@
|
|
|
40419
40409
|
scale = new LinearScale();
|
|
40420
40410
|
}
|
|
40421
40411
|
scale.domain([min, max], !!axisOption?.nice);
|
|
40422
|
-
if (axisOption?.nice) {
|
|
40412
|
+
if (axisOption?.nice && !isZeroAlign) {
|
|
40423
40413
|
let tickCount = axisOption.tick?.forceTickCount ?? axisOption.tick?.tickCount ?? 10;
|
|
40424
|
-
if (isFunction$1(tickCount)) {
|
|
40425
|
-
tickCount = tickCount({
|
|
40426
|
-
axisLength,
|
|
40427
|
-
labelStyle: axisOption?.label?.style ?? {
|
|
40428
|
-
fontSize: THEME_CONSTANTS.LABEL_FONT_SIZE
|
|
40429
|
-
}
|
|
40430
|
-
});
|
|
40431
|
-
}
|
|
40432
40414
|
if (axisOption.niceType === 'accurateFirst') {
|
|
40433
40415
|
tickCount = Math.max(10, tickCount);
|
|
40434
40416
|
}
|
|
@@ -40455,206 +40437,6 @@
|
|
|
40455
40437
|
};
|
|
40456
40438
|
}
|
|
40457
40439
|
|
|
40458
|
-
function isValidAlignDomain(domain) {
|
|
40459
|
-
return domain.length === 2 && isValidNumber$1(domain[0]) && isValidNumber$1(domain[1]) && domain[1] >= domain[0];
|
|
40460
|
-
}
|
|
40461
|
-
function getScaleInfo(domain) {
|
|
40462
|
-
const total = domain[1] - domain[0];
|
|
40463
|
-
const includeZero = domain[1] * domain[0] < 0;
|
|
40464
|
-
let negative = domain[0] <= 0 ? 0 - domain[0] : 0;
|
|
40465
|
-
let positive = domain[1] > 0 ? domain[1] - 0 : 0;
|
|
40466
|
-
if (total === 0) {
|
|
40467
|
-
if (domain[0] < 0) {
|
|
40468
|
-
negative = 1;
|
|
40469
|
-
positive = 0;
|
|
40470
|
-
}
|
|
40471
|
-
else if (domain[0] > 0) {
|
|
40472
|
-
negative = 0;
|
|
40473
|
-
positive = 1;
|
|
40474
|
-
}
|
|
40475
|
-
}
|
|
40476
|
-
else {
|
|
40477
|
-
negative = negative / total;
|
|
40478
|
-
positive = positive / total;
|
|
40479
|
-
}
|
|
40480
|
-
return {
|
|
40481
|
-
total,
|
|
40482
|
-
negative,
|
|
40483
|
-
positive,
|
|
40484
|
-
includeZero,
|
|
40485
|
-
domain,
|
|
40486
|
-
extendable_min: true,
|
|
40487
|
-
extendable_max: true
|
|
40488
|
-
};
|
|
40489
|
-
}
|
|
40490
|
-
function inDifferentCrossZero(info1, info2) {
|
|
40491
|
-
const { positive: positive1, negative: negative1, extendable_min: s1Extendable_min, extendable_max: s1Extendable_max, domain: domain1 } = info1;
|
|
40492
|
-
const { positive: positive2, negative: negative2, extendable_min: s2Extendable_min, extendable_max: s2Extendable_max, domain: domain2 } = info2;
|
|
40493
|
-
if (positive2 > 0) {
|
|
40494
|
-
if (!s2Extendable_min) {
|
|
40495
|
-
return false;
|
|
40496
|
-
}
|
|
40497
|
-
let comp = negative1 / positive1;
|
|
40498
|
-
if (s1Extendable_max) {
|
|
40499
|
-
comp = negative1 / Math.max(positive1, positive2);
|
|
40500
|
-
domain1[1] = -domain1[0] / comp;
|
|
40501
|
-
}
|
|
40502
|
-
domain2[0] = -domain2[1] * comp;
|
|
40503
|
-
}
|
|
40504
|
-
else if (negative2 > 0) {
|
|
40505
|
-
if (!s2Extendable_max) {
|
|
40506
|
-
return false;
|
|
40507
|
-
}
|
|
40508
|
-
let comp = positive1 / negative1;
|
|
40509
|
-
if (s1Extendable_min) {
|
|
40510
|
-
comp = positive1 / Math.max(negative1, negative1);
|
|
40511
|
-
domain1[0] = -domain1[1] / comp;
|
|
40512
|
-
}
|
|
40513
|
-
domain2[1] = -domain2[0] * comp;
|
|
40514
|
-
}
|
|
40515
|
-
return true;
|
|
40516
|
-
}
|
|
40517
|
-
function inOnlyZeroDomain(info1, info2) {
|
|
40518
|
-
const { extendable_min: s1Extendable_min, extendable_max: s1Extendable_max, domain: domain1 } = info1;
|
|
40519
|
-
const { positive: positive2, negative: negative2, domain: domain2 } = info2;
|
|
40520
|
-
if (positive2 === 0 && negative2 === 0) {
|
|
40521
|
-
return false;
|
|
40522
|
-
}
|
|
40523
|
-
if (positive2 > 0 && !s1Extendable_max) {
|
|
40524
|
-
return false;
|
|
40525
|
-
}
|
|
40526
|
-
if (negative2 > 0 && !s1Extendable_min) {
|
|
40527
|
-
return false;
|
|
40528
|
-
}
|
|
40529
|
-
domain1[0] = domain2[0];
|
|
40530
|
-
domain1[1] = domain2[1];
|
|
40531
|
-
return true;
|
|
40532
|
-
}
|
|
40533
|
-
function inAllCrossZero(info1, info2) {
|
|
40534
|
-
const { positive: positive1, negative: negative1, extendable_max: s1Extendable_max, domain: domain1 } = info1;
|
|
40535
|
-
const { positive: positive2, negative: negative2, extendable_min: s2Extendable_min, domain: domain2 } = info2;
|
|
40536
|
-
if (s1Extendable_max && s2Extendable_min) {
|
|
40537
|
-
const comp = Math.max(negative1, negative2) / Math.max(positive1, positive2);
|
|
40538
|
-
domain1[1] = -domain1[0] / comp;
|
|
40539
|
-
domain2[0] = -domain2[1] * comp;
|
|
40540
|
-
}
|
|
40541
|
-
else if (s2Extendable_min) {
|
|
40542
|
-
const comp = negative1 / positive1;
|
|
40543
|
-
domain2[0] = -domain2[1] * comp;
|
|
40544
|
-
}
|
|
40545
|
-
else if (s1Extendable_max) {
|
|
40546
|
-
const comp = negative2 / positive2;
|
|
40547
|
-
domain1[1] = -domain1[0] / comp;
|
|
40548
|
-
}
|
|
40549
|
-
else {
|
|
40550
|
-
return false;
|
|
40551
|
-
}
|
|
40552
|
-
return true;
|
|
40553
|
-
}
|
|
40554
|
-
function inNoCrossDifferentSide(info1, info2) {
|
|
40555
|
-
const { extendable_min: s1Extendable_min, domain: domain1 } = info1;
|
|
40556
|
-
const { extendable_max: s2Extendable_max, domain: domain2 } = info2;
|
|
40557
|
-
if (!s1Extendable_min || !s2Extendable_max) {
|
|
40558
|
-
return false;
|
|
40559
|
-
}
|
|
40560
|
-
domain1[0] = -domain1[1];
|
|
40561
|
-
domain2[1] = -domain2[0];
|
|
40562
|
-
return true;
|
|
40563
|
-
}
|
|
40564
|
-
function getNewRangeToAlign(range1, range2) {
|
|
40565
|
-
const domain1 = [range1.min, range1.max];
|
|
40566
|
-
const domain2 = [range2.min, range2.max];
|
|
40567
|
-
if (!isValidAlignDomain(domain1) || !isValidAlignDomain(domain2)) {
|
|
40568
|
-
return undefined;
|
|
40569
|
-
}
|
|
40570
|
-
const info1 = getScaleInfo(domain1);
|
|
40571
|
-
const info2 = getScaleInfo(domain2);
|
|
40572
|
-
const { positive: positive1, negative: negative1, extendable_min: s1Extendable_min, extendable_max: s1Extendable_max, includeZero: includeZero1 } = info1;
|
|
40573
|
-
const { positive: positive2, negative: negative2, extendable_min: s2Extendable_min, extendable_max: s2Extendable_max, includeZero: includeZero2 } = info2;
|
|
40574
|
-
if (positive1 === 0 && negative1 === 0) {
|
|
40575
|
-
if (!inOnlyZeroDomain(info1, info2)) {
|
|
40576
|
-
return undefined;
|
|
40577
|
-
}
|
|
40578
|
-
}
|
|
40579
|
-
else if (positive2 === 0 && negative2 === 0) {
|
|
40580
|
-
if (!inOnlyZeroDomain(info2, info1)) {
|
|
40581
|
-
return undefined;
|
|
40582
|
-
}
|
|
40583
|
-
}
|
|
40584
|
-
else if (!includeZero1 && !includeZero2) {
|
|
40585
|
-
if (negative1 === 0 && positive2 === 0) {
|
|
40586
|
-
if (!inNoCrossDifferentSide(info1, info2)) {
|
|
40587
|
-
return undefined;
|
|
40588
|
-
}
|
|
40589
|
-
}
|
|
40590
|
-
else if (negative2 === 0 && positive1 === 0) {
|
|
40591
|
-
if (!inNoCrossDifferentSide(info2, info1)) {
|
|
40592
|
-
return undefined;
|
|
40593
|
-
}
|
|
40594
|
-
}
|
|
40595
|
-
if (negative1 === 0 && negative2 === 0) {
|
|
40596
|
-
if (domain1[0] === 0 && domain2[0] > 0) {
|
|
40597
|
-
if (!s2Extendable_min) {
|
|
40598
|
-
return undefined;
|
|
40599
|
-
}
|
|
40600
|
-
domain2[0] = 0;
|
|
40601
|
-
}
|
|
40602
|
-
else if (domain2[0] === 0 && domain1[0] > 0) {
|
|
40603
|
-
if (!s1Extendable_min) {
|
|
40604
|
-
return undefined;
|
|
40605
|
-
}
|
|
40606
|
-
domain1[0] = 0;
|
|
40607
|
-
}
|
|
40608
|
-
else {
|
|
40609
|
-
return undefined;
|
|
40610
|
-
}
|
|
40611
|
-
}
|
|
40612
|
-
if (positive1 === 0 && positive2 === 0) {
|
|
40613
|
-
if (domain1[1] === 0 && domain2[1] > 0) {
|
|
40614
|
-
if (!s2Extendable_max) {
|
|
40615
|
-
return undefined;
|
|
40616
|
-
}
|
|
40617
|
-
domain2[1] = 0;
|
|
40618
|
-
}
|
|
40619
|
-
else if (domain2[1] === 0 && domain1[1] > 0) {
|
|
40620
|
-
if (!s1Extendable_max) {
|
|
40621
|
-
return undefined;
|
|
40622
|
-
}
|
|
40623
|
-
domain1[1] = 0;
|
|
40624
|
-
}
|
|
40625
|
-
else {
|
|
40626
|
-
return undefined;
|
|
40627
|
-
}
|
|
40628
|
-
}
|
|
40629
|
-
}
|
|
40630
|
-
else if (includeZero1 && !includeZero2) {
|
|
40631
|
-
if (!inDifferentCrossZero(info1, info2)) {
|
|
40632
|
-
return undefined;
|
|
40633
|
-
}
|
|
40634
|
-
}
|
|
40635
|
-
else if (includeZero2 && !includeZero1) {
|
|
40636
|
-
if (!inDifferentCrossZero(info2, info1)) {
|
|
40637
|
-
return undefined;
|
|
40638
|
-
}
|
|
40639
|
-
}
|
|
40640
|
-
else {
|
|
40641
|
-
if (negative1 === negative2) {
|
|
40642
|
-
return undefined;
|
|
40643
|
-
}
|
|
40644
|
-
else if (negative1 > negative2) {
|
|
40645
|
-
if (!inAllCrossZero(info1, info2)) {
|
|
40646
|
-
return undefined;
|
|
40647
|
-
}
|
|
40648
|
-
}
|
|
40649
|
-
else {
|
|
40650
|
-
if (!inAllCrossZero(info2, info1)) {
|
|
40651
|
-
return undefined;
|
|
40652
|
-
}
|
|
40653
|
-
}
|
|
40654
|
-
}
|
|
40655
|
-
return { range1: domain1, range2: domain2 };
|
|
40656
|
-
}
|
|
40657
|
-
|
|
40658
40440
|
function getAxisConfigInPivotChart(col, row, layout) {
|
|
40659
40441
|
if (!layout._table.isPivotChart()) {
|
|
40660
40442
|
return undefined;
|
|
@@ -40664,22 +40446,23 @@
|
|
|
40664
40446
|
row === layout.columnHeaderLevelCount - 1 &&
|
|
40665
40447
|
col >= layout.rowHeaderLevelCount &&
|
|
40666
40448
|
col < layout.colCount - layout.rightFrozenColCount) {
|
|
40667
|
-
const
|
|
40668
|
-
if (
|
|
40449
|
+
const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col, row + 1, 'top', layout);
|
|
40450
|
+
if (axisOption?.visible === false) {
|
|
40669
40451
|
return;
|
|
40670
40452
|
}
|
|
40671
|
-
const
|
|
40672
|
-
|
|
40673
|
-
|
|
40674
|
-
|
|
40675
|
-
|
|
40676
|
-
|
|
40677
|
-
|
|
40678
|
-
|
|
40679
|
-
|
|
40680
|
-
}
|
|
40681
|
-
}
|
|
40453
|
+
const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, layout.columnHeaderLevelCount - 1);
|
|
40454
|
+
const colPath = layout.getColKeysPath(col, row);
|
|
40455
|
+
const range = getAxisRange(layout.dataset.collectedValues, indicatorKeys, isZeroAlign, colPath, seriesIndice ?? 1);
|
|
40456
|
+
if (!range) {
|
|
40457
|
+
return;
|
|
40458
|
+
}
|
|
40459
|
+
if (isPercent) {
|
|
40460
|
+
range.min = range.min < 0 ? -1 : 0;
|
|
40461
|
+
range.max = range.max > 0 ? 1 : 0;
|
|
40682
40462
|
}
|
|
40463
|
+
const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign);
|
|
40464
|
+
range.min = !isNaN(niceRange[0]) ? niceRange[0] : 0;
|
|
40465
|
+
range.max = !isNaN(niceRange[1]) ? niceRange[1] : 1;
|
|
40683
40466
|
if (isNumber$6(axisOption?.min)) {
|
|
40684
40467
|
range.min = axisOption.min;
|
|
40685
40468
|
if (range.min > 0) {
|
|
@@ -40706,7 +40489,16 @@
|
|
|
40706
40489
|
else if (row === layout.rowCount - layout.bottomFrozenRowCount &&
|
|
40707
40490
|
col >= layout.rowHeaderLevelCount &&
|
|
40708
40491
|
col < layout.colCount - layout.rightFrozenColCount) {
|
|
40492
|
+
const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col, row - 1, 'bottom', layout);
|
|
40493
|
+
if (axisOption?.visible === false) {
|
|
40494
|
+
return;
|
|
40495
|
+
}
|
|
40709
40496
|
const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);
|
|
40497
|
+
const colPath = layout.getColKeysPath(col, row);
|
|
40498
|
+
const range = getAxisRange(layout.dataset.collectedValues, indicatorKeys, isZeroAlign, colPath, seriesIndice ?? 0);
|
|
40499
|
+
if (!range) {
|
|
40500
|
+
return;
|
|
40501
|
+
}
|
|
40710
40502
|
let indicatorInfo = null;
|
|
40711
40503
|
indicatorKeys?.forEach(key => {
|
|
40712
40504
|
const info = layout.getIndicatorInfo(key);
|
|
@@ -40714,22 +40506,13 @@
|
|
|
40714
40506
|
indicatorInfo = info;
|
|
40715
40507
|
}
|
|
40716
40508
|
});
|
|
40717
|
-
|
|
40718
|
-
|
|
40719
|
-
|
|
40720
|
-
}
|
|
40721
|
-
const { range, ticks, axisOption, isZeroAlign } = axisRange;
|
|
40722
|
-
if (isZeroAlign) {
|
|
40723
|
-
const subAxisRange = getRange$1('top', col, row - 1, col, row, col, row, 1, layout);
|
|
40724
|
-
if (subAxisRange) {
|
|
40725
|
-
const { range: subRange } = subAxisRange;
|
|
40726
|
-
const align = getNewRangeToAlign(range, subRange);
|
|
40727
|
-
if (align) {
|
|
40728
|
-
range.min = align.range1[0];
|
|
40729
|
-
range.max = align.range1[1];
|
|
40730
|
-
}
|
|
40731
|
-
}
|
|
40509
|
+
if (isPercent) {
|
|
40510
|
+
range.min = range.min < 0 ? -1 : 0;
|
|
40511
|
+
range.max = range.max > 0 ? 1 : 0;
|
|
40732
40512
|
}
|
|
40513
|
+
const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign);
|
|
40514
|
+
range.min = !isNaN(niceRange[0]) ? niceRange[0] : 0;
|
|
40515
|
+
range.max = !isNaN(niceRange[1]) ? niceRange[1] : 1;
|
|
40733
40516
|
if (isNumber$6(axisOption?.min)) {
|
|
40734
40517
|
range.min = axisOption.min;
|
|
40735
40518
|
if (range.min > 0) {
|
|
@@ -40786,7 +40569,16 @@
|
|
|
40786
40569
|
if (col === layout.rowHeaderLevelCount - 1 &&
|
|
40787
40570
|
row >= layout.columnHeaderLevelCount &&
|
|
40788
40571
|
row < layout.rowCount - layout.bottomFrozenRowCount) {
|
|
40572
|
+
const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col + 1, row, 'left', layout);
|
|
40573
|
+
if (axisOption?.visible === false) {
|
|
40574
|
+
return;
|
|
40575
|
+
}
|
|
40789
40576
|
const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);
|
|
40577
|
+
const rowPath = layout.getRowKeysPath(col, row);
|
|
40578
|
+
const range = getAxisRange(layout.dataset.collectedValues, indicatorKeys, isZeroAlign, rowPath, seriesIndice ?? 0);
|
|
40579
|
+
if (!range) {
|
|
40580
|
+
return;
|
|
40581
|
+
}
|
|
40790
40582
|
let indicatorInfo = null;
|
|
40791
40583
|
indicatorKeys?.forEach(key => {
|
|
40792
40584
|
const info = layout.getIndicatorInfo(key);
|
|
@@ -40794,22 +40586,13 @@
|
|
|
40794
40586
|
indicatorInfo = info;
|
|
40795
40587
|
}
|
|
40796
40588
|
});
|
|
40797
|
-
|
|
40798
|
-
|
|
40799
|
-
|
|
40800
|
-
}
|
|
40801
|
-
const { range, ticks, axisOption, isZeroAlign } = axisRange;
|
|
40802
|
-
if (isZeroAlign) {
|
|
40803
|
-
const subAxisRange = getRange$1('right', col + 1, row, col, row, col, row, 1, layout);
|
|
40804
|
-
if (subAxisRange) {
|
|
40805
|
-
const { range: subRange } = subAxisRange;
|
|
40806
|
-
const align = getNewRangeToAlign(range, subRange);
|
|
40807
|
-
if (align) {
|
|
40808
|
-
range.min = align.range1[0];
|
|
40809
|
-
range.max = align.range1[1];
|
|
40810
|
-
}
|
|
40811
|
-
}
|
|
40589
|
+
if (isPercent) {
|
|
40590
|
+
range.min = range.min < 0 ? -1 : 0;
|
|
40591
|
+
range.max = range.max > 0 ? 1 : 0;
|
|
40812
40592
|
}
|
|
40593
|
+
const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign);
|
|
40594
|
+
range.min = !isNaN(niceRange[0]) ? niceRange[0] : 0;
|
|
40595
|
+
range.max = !isNaN(niceRange[1]) ? niceRange[1] : 1;
|
|
40813
40596
|
if (isNumber$6(axisOption?.min)) {
|
|
40814
40597
|
range.min = axisOption.min;
|
|
40815
40598
|
if (range.min > 0) {
|
|
@@ -40841,22 +40624,23 @@
|
|
|
40841
40624
|
else if (col === layout.colCount - layout.rightFrozenColCount &&
|
|
40842
40625
|
row >= layout.columnHeaderLevelCount &&
|
|
40843
40626
|
row < layout.rowCount - layout.bottomFrozenRowCount) {
|
|
40844
|
-
const
|
|
40845
|
-
if (
|
|
40627
|
+
const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col - 1, row, 'right', layout);
|
|
40628
|
+
if (axisOption?.visible === false) {
|
|
40846
40629
|
return;
|
|
40847
40630
|
}
|
|
40848
|
-
const
|
|
40849
|
-
|
|
40850
|
-
|
|
40851
|
-
|
|
40852
|
-
|
|
40853
|
-
|
|
40854
|
-
|
|
40855
|
-
|
|
40856
|
-
|
|
40857
|
-
}
|
|
40858
|
-
}
|
|
40631
|
+
const indicatorKeys = layout.getIndicatorKeyInChartSpec(layout.rowHeaderLevelCount - 1, row);
|
|
40632
|
+
const rowPath = layout.getRowKeysPath(col, row);
|
|
40633
|
+
const range = getAxisRange(layout.dataset.collectedValues, indicatorKeys, isZeroAlign, rowPath, seriesIndice ?? 1);
|
|
40634
|
+
if (!range) {
|
|
40635
|
+
return;
|
|
40636
|
+
}
|
|
40637
|
+
if (isPercent) {
|
|
40638
|
+
range.min = range.min < 0 ? -1 : 0;
|
|
40639
|
+
range.max = range.max > 0 ? 1 : 0;
|
|
40859
40640
|
}
|
|
40641
|
+
const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign);
|
|
40642
|
+
range.min = !isNaN(niceRange[0]) ? niceRange[0] : 0;
|
|
40643
|
+
range.max = !isNaN(niceRange[1]) ? niceRange[1] : 1;
|
|
40860
40644
|
if (isNumber$6(axisOption?.min)) {
|
|
40861
40645
|
range.min = axisOption.min;
|
|
40862
40646
|
if (range.min > 0) {
|
|
@@ -40997,7 +40781,9 @@
|
|
|
40997
40781
|
if (!defaultKey) {
|
|
40998
40782
|
return null;
|
|
40999
40783
|
}
|
|
41000
|
-
const data = collectedValues[defaultKey]
|
|
40784
|
+
const data = collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
|
|
40785
|
+
? collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
|
|
40786
|
+
: collectedValues[defaultKey];
|
|
41001
40787
|
const range = merge$1({}, data?.[colPath ?? ''] ?? { min: 0, max: 1 });
|
|
41002
40788
|
if (range.positiveMax && range.positiveMax > range.max) {
|
|
41003
40789
|
range.max = range.positiveMax;
|
|
@@ -41015,49 +40801,6 @@
|
|
|
41015
40801
|
}
|
|
41016
40802
|
return range;
|
|
41017
40803
|
}
|
|
41018
|
-
function getRange$1(position, colForAxisOption, rowForAxisOption, colForIndicatorKey, rowForIndicatorKey, col, row, defaultSeriesIndice, layout) {
|
|
41019
|
-
const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(colForAxisOption, rowForAxisOption, position, layout);
|
|
41020
|
-
if (axisOption?.visible === false) {
|
|
41021
|
-
return undefined;
|
|
41022
|
-
}
|
|
41023
|
-
const indicatorKeys = layout.getIndicatorKeyInChartSpec(colForIndicatorKey, rowForIndicatorKey);
|
|
41024
|
-
let path;
|
|
41025
|
-
if (position === 'top' || position === 'bottom') {
|
|
41026
|
-
path = layout.getColKeysPath(col, row);
|
|
41027
|
-
}
|
|
41028
|
-
else {
|
|
41029
|
-
path = layout.getRowKeysPath(col, row);
|
|
41030
|
-
}
|
|
41031
|
-
const range = getAxisRange(layout.dataset.collectedValues, indicatorKeys, isZeroAlign, path, seriesIndice ?? defaultSeriesIndice);
|
|
41032
|
-
if (!range) {
|
|
41033
|
-
return undefined;
|
|
41034
|
-
}
|
|
41035
|
-
if (isPercent) {
|
|
41036
|
-
range.min = range.min < 0 ? -1 : 0;
|
|
41037
|
-
range.max = range.max > 0 ? 1 : 0;
|
|
41038
|
-
}
|
|
41039
|
-
const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign, layout._table.getColWidth(col));
|
|
41040
|
-
range.min = !isNaN(niceRange[0]) ? niceRange[0] : 0;
|
|
41041
|
-
range.max = !isNaN(niceRange[1]) ? niceRange[1] : 1;
|
|
41042
|
-
if (isNumber$6(axisOption?.min)) {
|
|
41043
|
-
range.min = axisOption.min;
|
|
41044
|
-
if (range.min > 0) {
|
|
41045
|
-
axisOption.zero = false;
|
|
41046
|
-
}
|
|
41047
|
-
}
|
|
41048
|
-
if (isNumber$6(axisOption?.max)) {
|
|
41049
|
-
range.max = axisOption.max;
|
|
41050
|
-
if (range.max < 0) {
|
|
41051
|
-
axisOption.zero = false;
|
|
41052
|
-
}
|
|
41053
|
-
}
|
|
41054
|
-
return {
|
|
41055
|
-
axisOption,
|
|
41056
|
-
isZeroAlign,
|
|
41057
|
-
range,
|
|
41058
|
-
ticks
|
|
41059
|
-
};
|
|
41060
|
-
}
|
|
41061
40804
|
|
|
41062
40805
|
function computeAxisComponentWidth(config, table) {
|
|
41063
40806
|
const attribute = merge$1({}, commonAxis, config);
|
|
@@ -41669,6 +41412,9 @@
|
|
|
41669
41412
|
let rowStart = 0;
|
|
41670
41413
|
let rowEnd = 0;
|
|
41671
41414
|
if (row < scene.table.columnHeaderLevelCount) {
|
|
41415
|
+
scene.colHeaderGroup.setAttribute('height', scene.colHeaderGroup.attribute.height + detaY);
|
|
41416
|
+
scene.rowHeaderGroup.setAttribute('y', scene.colHeaderGroup.attribute.y + detaY);
|
|
41417
|
+
scene.bodyGroup.setAttribute('y', scene.bodyGroup.attribute.y + detaY);
|
|
41672
41418
|
rowStart = row + 1;
|
|
41673
41419
|
rowEnd = scene.table.columnHeaderLevelCount - 1;
|
|
41674
41420
|
}
|
|
@@ -44283,7 +44029,7 @@
|
|
|
44283
44029
|
stroke: false,
|
|
44284
44030
|
x: padding[3],
|
|
44285
44031
|
y: padding[0],
|
|
44286
|
-
canvas: table.canvas
|
|
44032
|
+
canvas: table.canvas,
|
|
44287
44033
|
mode: table.options.mode,
|
|
44288
44034
|
modeParams: table.options.modeParams,
|
|
44289
44035
|
spec: chartSpec,
|
|
@@ -54039,9 +53785,6 @@
|
|
|
54039
53785
|
adjustTableSize(attrs) {
|
|
54040
53786
|
let width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;
|
|
54041
53787
|
let height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;
|
|
54042
|
-
if (width <= 0 || height <= 0) {
|
|
54043
|
-
return;
|
|
54044
|
-
}
|
|
54045
53788
|
const rectWidth = this.table.tableNoFrameWidth;
|
|
54046
53789
|
const rectHeight = this.table.tableNoFrameHeight;
|
|
54047
53790
|
const padding = getQuadProps(attrs.padding ?? this.option.padding ?? 10);
|
|
@@ -54349,9 +54092,6 @@
|
|
|
54349
54092
|
adjustTableSize(attrs) {
|
|
54350
54093
|
let width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;
|
|
54351
54094
|
let height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;
|
|
54352
|
-
if (width <= 0 || height <= 0) {
|
|
54353
|
-
return;
|
|
54354
|
-
}
|
|
54355
54095
|
const rectWidth = this.table.tableNoFrameWidth;
|
|
54356
54096
|
const rectHeight = this.table.tableNoFrameHeight;
|
|
54357
54097
|
const padding = getQuadProps(attrs.padding ?? this.option.padding ?? 10);
|
|
@@ -54501,7 +54241,7 @@
|
|
|
54501
54241
|
return TABLE_EVENT_TYPE;
|
|
54502
54242
|
}
|
|
54503
54243
|
options;
|
|
54504
|
-
version = "0.13.4
|
|
54244
|
+
version = "0.13.4";
|
|
54505
54245
|
pagination;
|
|
54506
54246
|
id = `VTable${Date.now()}`;
|
|
54507
54247
|
headerStyleCache;
|
|
@@ -56636,7 +56376,6 @@
|
|
|
56636
56376
|
if (this.options.mode !== 'node') {
|
|
56637
56377
|
return;
|
|
56638
56378
|
}
|
|
56639
|
-
this.render();
|
|
56640
56379
|
const stage = this.scenegraph.stage;
|
|
56641
56380
|
if (stage) {
|
|
56642
56381
|
const contentWidth = this.tableX + this.getAllColsWidth();
|
|
@@ -56824,17 +56563,20 @@
|
|
|
56824
56563
|
const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);
|
|
56825
56564
|
const colPath = layout.getColKeysPath(col, row);
|
|
56826
56565
|
indicatorKeys.forEach((key, index) => {
|
|
56827
|
-
const {
|
|
56828
|
-
|
|
56829
|
-
|
|
56830
|
-
|
|
56831
|
-
|
|
56832
|
-
|
|
56833
|
-
|
|
56834
|
-
|
|
56835
|
-
|
|
56836
|
-
|
|
56837
|
-
|
|
56566
|
+
const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col, row, index === 0 ? 'bottom' : 'top', layout);
|
|
56567
|
+
const range = getAxisRange(layout.dataset.collectedValues, indicatorKeys, isZeroAlign, colPath, seriesIndice ?? index);
|
|
56568
|
+
if (isPercent) {
|
|
56569
|
+
range.min = range.min < 0 ? -1 : 0;
|
|
56570
|
+
range.max = range.max > 0 ? 1 : 0;
|
|
56571
|
+
}
|
|
56572
|
+
if (axisOption?.zero || range.min === range.max) {
|
|
56573
|
+
range.min = Math.min(range.min, 0);
|
|
56574
|
+
range.max = Math.max(range.max, 0);
|
|
56575
|
+
}
|
|
56576
|
+
if (axisOption?.nice) {
|
|
56577
|
+
const { range: axisRange } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign);
|
|
56578
|
+
range.min = axisRange[0];
|
|
56579
|
+
range.max = axisRange[1];
|
|
56838
56580
|
}
|
|
56839
56581
|
if (isNumber$6(axisOption?.min)) {
|
|
56840
56582
|
range.min = axisOption.min;
|
|
@@ -56882,17 +56624,20 @@
|
|
|
56882
56624
|
const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);
|
|
56883
56625
|
const rowPath = layout.getRowKeysPath(col, row);
|
|
56884
56626
|
indicatorKeys.forEach((key, index) => {
|
|
56885
|
-
const {
|
|
56886
|
-
|
|
56887
|
-
|
|
56888
|
-
|
|
56889
|
-
|
|
56890
|
-
|
|
56891
|
-
|
|
56892
|
-
|
|
56893
|
-
|
|
56894
|
-
|
|
56895
|
-
|
|
56627
|
+
const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col, row, index === 0 ? 'left' : 'right', layout);
|
|
56628
|
+
const range = getAxisRange(layout.dataset.collectedValues, indicatorKeys, isZeroAlign, rowPath, seriesIndice ?? index);
|
|
56629
|
+
if (isPercent) {
|
|
56630
|
+
range.min = range.min < 0 ? -1 : 0;
|
|
56631
|
+
range.max = range.max > 0 ? 1 : 0;
|
|
56632
|
+
}
|
|
56633
|
+
if (axisOption?.zero || range.min === range.max) {
|
|
56634
|
+
range.min = Math.min(range.min, 0);
|
|
56635
|
+
range.max = Math.max(range.max, 0);
|
|
56636
|
+
}
|
|
56637
|
+
if (axisOption?.nice) {
|
|
56638
|
+
const { range: axisRange } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign);
|
|
56639
|
+
range.min = axisRange[0];
|
|
56640
|
+
range.max = axisRange[1];
|
|
56896
56641
|
}
|
|
56897
56642
|
if (isNumber$6(axisOption?.min)) {
|
|
56898
56643
|
range.min = axisOption.min;
|
|
@@ -56963,34 +56708,6 @@
|
|
|
56963
56708
|
}
|
|
56964
56709
|
return chartSpec.data.id;
|
|
56965
56710
|
}
|
|
56966
|
-
function getRange(col, row, index, position, indicatorKeys, path, layout) {
|
|
56967
|
-
const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col, row, position, layout);
|
|
56968
|
-
const range = getAxisRange(layout.dataset.collectedValues, indicatorKeys, isZeroAlign, path, seriesIndice ?? index);
|
|
56969
|
-
if (isPercent) {
|
|
56970
|
-
range.min = range.min < 0 ? -1 : 0;
|
|
56971
|
-
range.max = range.max > 0 ? 1 : 0;
|
|
56972
|
-
}
|
|
56973
|
-
if (axisOption?.zero || range.min === range.max) {
|
|
56974
|
-
range.min = Math.min(range.min, 0);
|
|
56975
|
-
range.max = Math.max(range.max, 0);
|
|
56976
|
-
}
|
|
56977
|
-
if (axisOption?.nice) {
|
|
56978
|
-
const { range: axisRange } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign, layout._table.getColWidth(col));
|
|
56979
|
-
range.min = axisRange[0];
|
|
56980
|
-
range.max = axisRange[1];
|
|
56981
|
-
}
|
|
56982
|
-
if (isNumber$6(axisOption?.min)) {
|
|
56983
|
-
range.min = axisOption.min;
|
|
56984
|
-
}
|
|
56985
|
-
if (isNumber$6(axisOption?.max)) {
|
|
56986
|
-
range.max = axisOption.max;
|
|
56987
|
-
}
|
|
56988
|
-
return {
|
|
56989
|
-
range,
|
|
56990
|
-
isZeroAlign,
|
|
56991
|
-
axisOption
|
|
56992
|
-
};
|
|
56993
|
-
}
|
|
56994
56711
|
|
|
56995
56712
|
let seqId = 0;
|
|
56996
56713
|
class SimpleHeaderLayoutMap {
|
|
@@ -57720,9 +57437,7 @@
|
|
|
57720
57437
|
constructor(titleOption, table) {
|
|
57721
57438
|
this.table = table;
|
|
57722
57439
|
this._titleOption = titleOption;
|
|
57723
|
-
|
|
57724
|
-
this._titleComponent = this._createOrUpdateTitleComponent(this._getTitleAttrs());
|
|
57725
|
-
}
|
|
57440
|
+
this._titleComponent = this._createOrUpdateTitleComponent(this._getTitleAttrs());
|
|
57726
57441
|
}
|
|
57727
57442
|
_createOrUpdateTitleComponent(attrs) {
|
|
57728
57443
|
if (this._titleComponent) {
|
|
@@ -57773,8 +57488,8 @@
|
|
|
57773
57488
|
this._adjustTableSize(this._titleComponent.attribute);
|
|
57774
57489
|
}
|
|
57775
57490
|
_adjustTableSize(attrs) {
|
|
57776
|
-
const width = isFinite(this._titleComponent
|
|
57777
|
-
const height = isFinite(this._titleComponent
|
|
57491
|
+
const width = isFinite(this._titleComponent.AABBBounds.width()) ? this._titleComponent.AABBBounds.width() : 0;
|
|
57492
|
+
const height = isFinite(this._titleComponent.AABBBounds.height()) ? this._titleComponent.AABBBounds.height() : 0;
|
|
57778
57493
|
if (this._titleOption.orient === 'left') {
|
|
57779
57494
|
this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);
|
|
57780
57495
|
this.table.tableX += Math.ceil(width);
|
|
@@ -57807,8 +57522,7 @@
|
|
|
57807
57522
|
this.isReleased = true;
|
|
57808
57523
|
}
|
|
57809
57524
|
_getTitleAttrs() {
|
|
57810
|
-
const
|
|
57811
|
-
const padding = getQuadProps(this._titleOption.padding ?? defaultPadding);
|
|
57525
|
+
const padding = getQuadProps(this._titleOption.padding ?? 10);
|
|
57812
57526
|
const realWidth = this._titleOption.width ??
|
|
57813
57527
|
Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width) - padding[1] - padding[3];
|
|
57814
57528
|
const realHeight = this._titleOption.height ??
|
|
@@ -61053,6 +60767,206 @@
|
|
|
61053
60767
|
};
|
|
61054
60768
|
}
|
|
61055
60769
|
|
|
60770
|
+
function isValidAlignDomain(domain) {
|
|
60771
|
+
return domain.length === 2 && isValidNumber$1(domain[0]) && isValidNumber$1(domain[1]) && domain[1] >= domain[0];
|
|
60772
|
+
}
|
|
60773
|
+
function getScaleInfo(domain) {
|
|
60774
|
+
const total = domain[1] - domain[0];
|
|
60775
|
+
const includeZero = domain[1] * domain[0] < 0;
|
|
60776
|
+
let negative = domain[0] <= 0 ? 0 - domain[0] : 0;
|
|
60777
|
+
let positive = domain[1] > 0 ? domain[1] - 0 : 0;
|
|
60778
|
+
if (total === 0) {
|
|
60779
|
+
if (domain[0] < 0) {
|
|
60780
|
+
negative = 1;
|
|
60781
|
+
positive = 0;
|
|
60782
|
+
}
|
|
60783
|
+
else if (domain[0] > 0) {
|
|
60784
|
+
negative = 0;
|
|
60785
|
+
positive = 1;
|
|
60786
|
+
}
|
|
60787
|
+
}
|
|
60788
|
+
else {
|
|
60789
|
+
negative = negative / total;
|
|
60790
|
+
positive = positive / total;
|
|
60791
|
+
}
|
|
60792
|
+
return {
|
|
60793
|
+
total,
|
|
60794
|
+
negative,
|
|
60795
|
+
positive,
|
|
60796
|
+
includeZero,
|
|
60797
|
+
domain,
|
|
60798
|
+
extendable_min: true,
|
|
60799
|
+
extendable_max: true
|
|
60800
|
+
};
|
|
60801
|
+
}
|
|
60802
|
+
function inDifferentCrossZero(info1, info2) {
|
|
60803
|
+
const { positive: positive1, negative: negative1, extendable_min: s1Extendable_min, extendable_max: s1Extendable_max, domain: domain1 } = info1;
|
|
60804
|
+
const { positive: positive2, negative: negative2, extendable_min: s2Extendable_min, extendable_max: s2Extendable_max, domain: domain2 } = info2;
|
|
60805
|
+
if (positive2 > 0) {
|
|
60806
|
+
if (!s2Extendable_min) {
|
|
60807
|
+
return false;
|
|
60808
|
+
}
|
|
60809
|
+
let comp = negative1 / positive1;
|
|
60810
|
+
if (s1Extendable_max) {
|
|
60811
|
+
comp = negative1 / Math.max(positive1, positive2);
|
|
60812
|
+
domain1[1] = -domain1[0] / comp;
|
|
60813
|
+
}
|
|
60814
|
+
domain2[0] = -domain2[1] * comp;
|
|
60815
|
+
}
|
|
60816
|
+
else if (negative2 > 0) {
|
|
60817
|
+
if (!s2Extendable_max) {
|
|
60818
|
+
return false;
|
|
60819
|
+
}
|
|
60820
|
+
let comp = positive1 / negative1;
|
|
60821
|
+
if (s1Extendable_min) {
|
|
60822
|
+
comp = positive1 / Math.max(negative1, negative1);
|
|
60823
|
+
domain1[0] = -domain1[1] / comp;
|
|
60824
|
+
}
|
|
60825
|
+
domain2[1] = -domain2[0] * comp;
|
|
60826
|
+
}
|
|
60827
|
+
return true;
|
|
60828
|
+
}
|
|
60829
|
+
function inOnlyZeroDomain(info1, info2) {
|
|
60830
|
+
const { extendable_min: s1Extendable_min, extendable_max: s1Extendable_max, domain: domain1 } = info1;
|
|
60831
|
+
const { positive: positive2, negative: negative2, domain: domain2 } = info2;
|
|
60832
|
+
if (positive2 === 0 && negative2 === 0) {
|
|
60833
|
+
return false;
|
|
60834
|
+
}
|
|
60835
|
+
if (positive2 > 0 && !s1Extendable_max) {
|
|
60836
|
+
return false;
|
|
60837
|
+
}
|
|
60838
|
+
if (negative2 > 0 && !s1Extendable_min) {
|
|
60839
|
+
return false;
|
|
60840
|
+
}
|
|
60841
|
+
domain1[0] = domain2[0];
|
|
60842
|
+
domain1[1] = domain2[1];
|
|
60843
|
+
return true;
|
|
60844
|
+
}
|
|
60845
|
+
function inAllCrossZero(info1, info2) {
|
|
60846
|
+
const { positive: positive1, negative: negative1, extendable_max: s1Extendable_max, domain: domain1 } = info1;
|
|
60847
|
+
const { positive: positive2, negative: negative2, extendable_min: s2Extendable_min, domain: domain2 } = info2;
|
|
60848
|
+
if (s1Extendable_max && s2Extendable_min) {
|
|
60849
|
+
const comp = Math.max(negative1, negative2) / Math.max(positive1, positive2);
|
|
60850
|
+
domain1[1] = -domain1[0] / comp;
|
|
60851
|
+
domain2[0] = -domain2[1] * comp;
|
|
60852
|
+
}
|
|
60853
|
+
else if (s2Extendable_min) {
|
|
60854
|
+
const comp = negative1 / positive1;
|
|
60855
|
+
domain2[0] = -domain2[1] * comp;
|
|
60856
|
+
}
|
|
60857
|
+
else if (s1Extendable_max) {
|
|
60858
|
+
const comp = negative2 / positive2;
|
|
60859
|
+
domain1[1] = -domain1[0] / comp;
|
|
60860
|
+
}
|
|
60861
|
+
else {
|
|
60862
|
+
return false;
|
|
60863
|
+
}
|
|
60864
|
+
return true;
|
|
60865
|
+
}
|
|
60866
|
+
function inNoCrossDifferentSide(info1, info2) {
|
|
60867
|
+
const { extendable_min: s1Extendable_min, domain: domain1 } = info1;
|
|
60868
|
+
const { extendable_max: s2Extendable_max, domain: domain2 } = info2;
|
|
60869
|
+
if (!s1Extendable_min || !s2Extendable_max) {
|
|
60870
|
+
return false;
|
|
60871
|
+
}
|
|
60872
|
+
domain1[0] = -domain1[1];
|
|
60873
|
+
domain2[1] = -domain2[0];
|
|
60874
|
+
return true;
|
|
60875
|
+
}
|
|
60876
|
+
function getNewRangeToAlign(range1, range2) {
|
|
60877
|
+
const domain1 = [range1.min, range1.max];
|
|
60878
|
+
const domain2 = [range2.min, range2.max];
|
|
60879
|
+
if (!isValidAlignDomain(domain1) || !isValidAlignDomain(domain2)) {
|
|
60880
|
+
return undefined;
|
|
60881
|
+
}
|
|
60882
|
+
const info1 = getScaleInfo(domain1);
|
|
60883
|
+
const info2 = getScaleInfo(domain2);
|
|
60884
|
+
const { positive: positive1, negative: negative1, extendable_min: s1Extendable_min, extendable_max: s1Extendable_max, includeZero: includeZero1 } = info1;
|
|
60885
|
+
const { positive: positive2, negative: negative2, extendable_min: s2Extendable_min, extendable_max: s2Extendable_max, includeZero: includeZero2 } = info2;
|
|
60886
|
+
if (positive1 === 0 && negative1 === 0) {
|
|
60887
|
+
if (!inOnlyZeroDomain(info1, info2)) {
|
|
60888
|
+
return undefined;
|
|
60889
|
+
}
|
|
60890
|
+
}
|
|
60891
|
+
else if (positive2 === 0 && negative2 === 0) {
|
|
60892
|
+
if (!inOnlyZeroDomain(info2, info1)) {
|
|
60893
|
+
return undefined;
|
|
60894
|
+
}
|
|
60895
|
+
}
|
|
60896
|
+
else if (!includeZero1 && !includeZero2) {
|
|
60897
|
+
if (negative1 === 0 && positive2 === 0) {
|
|
60898
|
+
if (!inNoCrossDifferentSide(info1, info2)) {
|
|
60899
|
+
return undefined;
|
|
60900
|
+
}
|
|
60901
|
+
}
|
|
60902
|
+
else if (negative2 === 0 && positive1 === 0) {
|
|
60903
|
+
if (!inNoCrossDifferentSide(info2, info1)) {
|
|
60904
|
+
return undefined;
|
|
60905
|
+
}
|
|
60906
|
+
}
|
|
60907
|
+
if (negative1 === 0 && negative2 === 0) {
|
|
60908
|
+
if (domain1[0] === 0 && domain2[0] > 0) {
|
|
60909
|
+
if (!s2Extendable_min) {
|
|
60910
|
+
return undefined;
|
|
60911
|
+
}
|
|
60912
|
+
domain2[0] = 0;
|
|
60913
|
+
}
|
|
60914
|
+
else if (domain2[0] === 0 && domain1[0] > 0) {
|
|
60915
|
+
if (!s1Extendable_min) {
|
|
60916
|
+
return undefined;
|
|
60917
|
+
}
|
|
60918
|
+
domain1[0] = 0;
|
|
60919
|
+
}
|
|
60920
|
+
else {
|
|
60921
|
+
return undefined;
|
|
60922
|
+
}
|
|
60923
|
+
}
|
|
60924
|
+
if (positive1 === 0 && positive2 === 0) {
|
|
60925
|
+
if (domain1[1] === 0 && domain2[1] > 0) {
|
|
60926
|
+
if (!s2Extendable_max) {
|
|
60927
|
+
return undefined;
|
|
60928
|
+
}
|
|
60929
|
+
domain2[1] = 0;
|
|
60930
|
+
}
|
|
60931
|
+
else if (domain2[1] === 0 && domain1[1] > 0) {
|
|
60932
|
+
if (!s1Extendable_max) {
|
|
60933
|
+
return undefined;
|
|
60934
|
+
}
|
|
60935
|
+
domain1[1] = 0;
|
|
60936
|
+
}
|
|
60937
|
+
else {
|
|
60938
|
+
return undefined;
|
|
60939
|
+
}
|
|
60940
|
+
}
|
|
60941
|
+
}
|
|
60942
|
+
else if (includeZero1 && !includeZero2) {
|
|
60943
|
+
if (!inDifferentCrossZero(info1, info2)) {
|
|
60944
|
+
return undefined;
|
|
60945
|
+
}
|
|
60946
|
+
}
|
|
60947
|
+
else if (includeZero2 && !includeZero1) {
|
|
60948
|
+
if (!inDifferentCrossZero(info2, info1)) {
|
|
60949
|
+
return undefined;
|
|
60950
|
+
}
|
|
60951
|
+
}
|
|
60952
|
+
else {
|
|
60953
|
+
if (negative1 === negative2) {
|
|
60954
|
+
return undefined;
|
|
60955
|
+
}
|
|
60956
|
+
else if (negative1 > negative2) {
|
|
60957
|
+
if (!inAllCrossZero(info1, info2)) {
|
|
60958
|
+
return undefined;
|
|
60959
|
+
}
|
|
60960
|
+
}
|
|
60961
|
+
else {
|
|
60962
|
+
if (!inAllCrossZero(info2, info1)) {
|
|
60963
|
+
return undefined;
|
|
60964
|
+
}
|
|
60965
|
+
}
|
|
60966
|
+
}
|
|
60967
|
+
return { range1: domain1, range2: domain2 };
|
|
60968
|
+
}
|
|
60969
|
+
|
|
61056
60970
|
class Dataset {
|
|
61057
60971
|
dataConfig;
|
|
61058
60972
|
records;
|
|
@@ -61166,6 +61080,7 @@
|
|
|
61166
61080
|
}
|
|
61167
61081
|
typeof window !== 'undefined' ? window.performance.now() : 0;
|
|
61168
61082
|
if (this.dataConfig?.isPivotChart) {
|
|
61083
|
+
this.dealWithZeroAlign();
|
|
61169
61084
|
this.cacheDeminsionCollectedValues();
|
|
61170
61085
|
}
|
|
61171
61086
|
}
|
|
@@ -61498,6 +61413,7 @@
|
|
|
61498
61413
|
this.processCollectedValuesWithSumBy();
|
|
61499
61414
|
this.processCollectedValuesWithSortBy();
|
|
61500
61415
|
if (this.dataConfig?.isPivotChart) {
|
|
61416
|
+
this.dealWithZeroAlign();
|
|
61501
61417
|
this.cacheDeminsionCollectedValues();
|
|
61502
61418
|
}
|
|
61503
61419
|
}
|
|
@@ -61962,6 +61878,44 @@
|
|
|
61962
61878
|
tree.forEach((treeNode) => getPath(treeNode, []));
|
|
61963
61879
|
return result;
|
|
61964
61880
|
}
|
|
61881
|
+
dealWithZeroAlign() {
|
|
61882
|
+
const indicatorsToAlign = [];
|
|
61883
|
+
for (let i = 0; i < this.aggregationRules.length; i++) {
|
|
61884
|
+
const rule = this.aggregationRules[i];
|
|
61885
|
+
if (isArray$5(rule.field) && rule.field.length === 2) {
|
|
61886
|
+
indicatorsToAlign.push(rule.field);
|
|
61887
|
+
}
|
|
61888
|
+
}
|
|
61889
|
+
indicatorsToAlign.forEach(indicatorToAlign => {
|
|
61890
|
+
const indicator1 = indicatorToAlign[0];
|
|
61891
|
+
const indicator2 = indicatorToAlign[1];
|
|
61892
|
+
const collectedValue1 = this.collectedValues[indicator1];
|
|
61893
|
+
const collectedValue2 = this.collectedValues[indicator2];
|
|
61894
|
+
this.collectedValues[indicator1 + '_align'] = {};
|
|
61895
|
+
this.collectedValues[indicator2 + '_align'] = {};
|
|
61896
|
+
const toAlignCollectedValue = collectedValue1 || collectedValue2;
|
|
61897
|
+
for (const key in toAlignCollectedValue) {
|
|
61898
|
+
const range1 = collectedValue1?.[key] ?? { min: 0, max: 1 };
|
|
61899
|
+
const range2 = collectedValue2?.[key] ?? { min: 0, max: 1 };
|
|
61900
|
+
const newRanges = getNewRangeToAlign(range1, range2);
|
|
61901
|
+
if (!newRanges) {
|
|
61902
|
+
this.collectedValues[indicator1 + '_align'][key] = {
|
|
61903
|
+
min: range1.min,
|
|
61904
|
+
max: range1.max
|
|
61905
|
+
};
|
|
61906
|
+
this.collectedValues[indicator2 + '_align'][key] = {
|
|
61907
|
+
min: range2.min,
|
|
61908
|
+
max: range2.max
|
|
61909
|
+
};
|
|
61910
|
+
}
|
|
61911
|
+
else {
|
|
61912
|
+
const { range1: newRange1, range2: newRange2 } = newRanges;
|
|
61913
|
+
this.collectedValues[indicator1 + '_align'][key] = { min: newRange1[0], max: newRange1[1] };
|
|
61914
|
+
this.collectedValues[indicator2 + '_align'][key] = { min: newRange2[0], max: newRange2[1] };
|
|
61915
|
+
}
|
|
61916
|
+
}
|
|
61917
|
+
});
|
|
61918
|
+
}
|
|
61965
61919
|
cacheDeminsionCollectedValues() {
|
|
61966
61920
|
for (const key in this.collectValuesBy) {
|
|
61967
61921
|
if (this.collectValuesBy[key].type === 'xField' || this.collectValuesBy[key].type === 'yField') {
|
|
@@ -64222,7 +64176,7 @@
|
|
|
64222
64176
|
return new Tag(params ? params.attribute : {});
|
|
64223
64177
|
}
|
|
64224
64178
|
|
|
64225
|
-
const version = "0.13.4
|
|
64179
|
+
const version = "0.13.4";
|
|
64226
64180
|
function getIcons() {
|
|
64227
64181
|
return get$1();
|
|
64228
64182
|
}
|