From f32e45abd4b3fe7a3422cef99a19beedb8f79aa5 Mon Sep 17 00:00:00 2001 From: LcpMarvel Date: Mon, 8 Apr 2024 00:12:06 +0800 Subject: [PATCH 1/3] fix: make sure vertical continuous legend emits correct value --- .../components/legend/continuous-5.ts | 33 +++++++------- src/ui/legend/continuous.ts | 44 ++++++++++++++++--- 2 files changed, 57 insertions(+), 20 deletions(-) diff --git a/__tests__/integration/components/legend/continuous-5.ts b/__tests__/integration/components/legend/continuous-5.ts index 765c232ad..a8453f26c 100644 --- a/__tests__/integration/components/legend/continuous-5.ts +++ b/__tests__/integration/components/legend/continuous-5.ts @@ -16,23 +16,27 @@ export const Continuous5 = () => { }; const conditions = [ - { labelDirection: 'positive' }, - { labelDirection: 'negative' }, - { labelDirection: 'positive', titleText: 'title' }, - { labelDirection: 'negative', titleText: 'title' }, - { labelDirection: 'positive', showHandle: false }, - { labelDirection: 'negative', showHandle: false }, - { labelDirection: 'positive', showTick: true }, - { labelDirection: 'negative', showTick: true }, - { labelDirection: 'positive', titleText: 'title', showTick: true }, - { labelDirection: 'negative', titleText: 'title', showTick: true }, - { labelDirection: 'positive', showHandle: false, showTick: true }, - { labelDirection: 'negative', showHandle: false, showTick: true }, + { labelDirection: 'positive', block: true }, + { labelDirection: 'negative', block: true }, + { labelDirection: 'positive', block: true, titleText: 'title' }, + { labelDirection: 'negative', block: true, titleText: 'title' }, + { labelDirection: 'positive', block: true, showHandle: false }, + { labelDirection: 'negative', block: true, showHandle: false }, + { labelDirection: 'positive', block: true, showTick: true }, + { labelDirection: 'negative', block: true, showTick: true }, + { labelDirection: 'positive', block: true, titleText: 'title', showTick: true }, + { labelDirection: 'negative', block: true, titleText: 'title', showTick: true }, + { labelDirection: 'positive', block: true, showHandle: false, showTick: true }, + { labelDirection: 'negative', block: true, showHandle: false, showTick: true }, + { labelDirection: 'positive', block: true }, + { labelDirection: 'negative', block: false }, ] as const; + const half = conditions.length / 2; + conditions.forEach((con, i) => { - const y = Math.floor(i / 6) * (shape.height + 5); - const x = (i % 6) * (shape.width + 5); + const y = Math.floor(i / half) * (shape.height + 5); + const x = (i % half) * (shape.width + 5); group.appendChild( new Rect({ @@ -47,7 +51,6 @@ export const Continuous5 = () => { group.appendChild( new Continuous({ style: { - block: true, data: new Array(10).fill(0).map((d: any, i: number) => ({ value: i * 100 })), handleFormatter: () => '', handleMarkerSize: 30, diff --git a/src/ui/legend/continuous.ts b/src/ui/legend/continuous.ts index eea1a5bbd..63ef33db5 100644 --- a/src/ui/legend/continuous.ts +++ b/src/ui/legend/continuous.ts @@ -570,11 +570,13 @@ export class Continuous extends Component { data.map(({ value }) => value), value ); - this.showIndicator((range[0] + range[1]) / 2, `${range[0]}-${range[1]}`); + + const selection = this.getRealSelection(range); + this.showIndicator((range[0] + range[1]) / 2, `${selection[0]}-${selection[1]}`); this.dispatchIndicated(value, range); } else { const safetyValue = this.getTickValue(value); - this.showIndicator(safetyValue); + this.showIndicator(safetyValue, `${this.getRealValue(safetyValue)}`); this.dispatchIndicated(safetyValue); } }; @@ -708,18 +710,50 @@ export class Continuous extends Component { return scale.map(value); } + private getRealSelection(range: number[]) { + const { max } = this.range; + const [start, end] = range; + + return this.ifHorizontal([start, end], [max - end, max - start]); + } + + private getRealValue(value: number) { + const { max } = this.range; + + return this.ifHorizontal(value, max - value); + } + private dispatchSelection() { + const selection = this.getRealSelection(this.selection); + const evt = new CustomEvent('valuechange', { detail: { - value: this.selection, + value: selection, }, }); this.dispatchEvent(evt as any); } - private dispatchIndicated(value: number, range?: unknown) { + private dispatchIndicated(value: number, range?: number[]) { + const { max } = this.range; + + const detail = this.ifHorizontal( + () => { + return { + value, + range, + }; + }, + () => { + return { + value: max - value, + range: range ? this.getRealSelection(range) : undefined, + }; + } + ); + const evt = new CustomEvent('indicate', { - detail: { value, range }, + detail, }); this.dispatchEvent(evt as any); } From 5a57ccb9af451f45ccb6d3d20780038841e5fc2c Mon Sep 17 00:00:00 2001 From: "yuqi.pyq" Date: Thu, 9 May 2024 11:55:39 +0800 Subject: [PATCH 2/3] chore: update snapshots --- .../integration/snapshots/Continuous4.svg | 120 +- .../integration/snapshots/Continuous5.svg | 1522 ++++++++++++++--- .../snapshots/ContinuousD3ColorLegend.svg | 74 +- package.json | 2 +- src/ui/legend/continuous.ts | 8 +- 5 files changed, 1403 insertions(+), 323 deletions(-) diff --git a/__tests__/integration/snapshots/Continuous4.svg b/__tests__/integration/snapshots/Continuous4.svg index 764b858b7..cf2ebe385 100644 --- a/__tests__/integration/snapshots/Continuous4.svg +++ b/__tests__/integration/snapshots/Continuous4.svg @@ -3399,7 +3399,7 @@ @@ -3427,7 +3427,7 @@ @@ -3455,7 +3455,7 @@ @@ -3483,7 +3483,7 @@ @@ -3511,7 +3511,7 @@ @@ -3539,7 +3539,7 @@ @@ -3567,7 +3567,7 @@ @@ -3595,7 +3595,7 @@ @@ -3623,7 +3623,7 @@ @@ -3651,7 +3651,7 @@ @@ -4121,7 +4121,7 @@ @@ -4149,7 +4149,7 @@ @@ -4177,7 +4177,7 @@ @@ -4205,7 +4205,7 @@ @@ -4233,7 +4233,7 @@ @@ -4261,7 +4261,7 @@ @@ -4289,7 +4289,7 @@ @@ -4317,7 +4317,7 @@ @@ -4345,7 +4345,7 @@ @@ -4373,7 +4373,7 @@ @@ -4868,7 +4868,7 @@ @@ -4896,7 +4896,7 @@ @@ -4924,7 +4924,7 @@ @@ -4952,7 +4952,7 @@ @@ -4980,7 +4980,7 @@ @@ -5008,7 +5008,7 @@ @@ -5036,7 +5036,7 @@ @@ -5064,7 +5064,7 @@ @@ -5092,7 +5092,7 @@ @@ -5120,7 +5120,7 @@ @@ -5615,7 +5615,7 @@ @@ -5643,7 +5643,7 @@ @@ -5671,7 +5671,7 @@ @@ -5699,7 +5699,7 @@ @@ -5727,7 +5727,7 @@ @@ -5755,7 +5755,7 @@ @@ -5783,7 +5783,7 @@ @@ -5811,7 +5811,7 @@ @@ -5839,7 +5839,7 @@ @@ -5867,7 +5867,7 @@ @@ -6349,7 +6349,7 @@ @@ -6377,7 +6377,7 @@ @@ -6405,7 +6405,7 @@ @@ -6433,7 +6433,7 @@ @@ -6461,7 +6461,7 @@ @@ -6489,7 +6489,7 @@ @@ -6517,7 +6517,7 @@ @@ -6545,7 +6545,7 @@ @@ -6573,7 +6573,7 @@ @@ -6601,7 +6601,7 @@ @@ -6926,7 +6926,7 @@ @@ -6954,7 +6954,7 @@ @@ -6982,7 +6982,7 @@ @@ -7010,7 +7010,7 @@ @@ -7038,7 +7038,7 @@ @@ -7066,7 +7066,7 @@ @@ -7094,7 +7094,7 @@ @@ -7122,7 +7122,7 @@ @@ -7150,7 +7150,7 @@ @@ -7178,7 +7178,7 @@ diff --git a/__tests__/integration/snapshots/Continuous5.svg b/__tests__/integration/snapshots/Continuous5.svg index 57e07b7d4..1dfb0e984 100644 --- a/__tests__/integration/snapshots/Continuous5.svg +++ b/__tests__/integration/snapshots/Continuous5.svg @@ -36,10 +36,38 @@ + + + + + + + + + + + + + + + + + + + + + @@ -173,12 +201,18 @@ > + + + @@ -202,29 +236,17 @@ - - - - - - - + @@ -248,17 +270,17 @@ - + @@ -282,20 +304,17 @@ - + @@ -319,46 +338,61 @@ + + + - + + + + + + + - - - - - - - - - @@ -433,7 +467,7 @@ @@ -460,7 +494,7 @@ @@ -487,7 +521,7 @@ @@ -514,7 +548,7 @@ @@ -541,7 +575,7 @@ @@ -568,7 +602,7 @@ @@ -595,7 +629,7 @@ @@ -622,7 +656,7 @@ @@ -649,7 +683,7 @@ @@ -676,7 +710,7 @@ @@ -1480,7 +1514,7 @@ @@ -1507,7 +1541,7 @@ @@ -1534,7 +1568,7 @@ @@ -1561,7 +1595,7 @@ @@ -1588,7 +1622,7 @@ @@ -1615,7 +1649,7 @@ @@ -1642,7 +1676,7 @@ @@ -1669,7 +1703,7 @@ @@ -1696,7 +1730,7 @@ @@ -1723,7 +1757,7 @@ @@ -2527,7 +2561,7 @@ @@ -2554,7 +2588,7 @@ @@ -2581,7 +2615,7 @@ @@ -2608,7 +2642,7 @@ @@ -2635,7 +2669,7 @@ @@ -2662,7 +2696,7 @@ @@ -2689,7 +2723,7 @@ @@ -2716,7 +2750,7 @@ @@ -2743,7 +2777,7 @@ @@ -2770,7 +2804,7 @@ @@ -3189,9 +3223,9 @@ @@ -3235,13 +3269,13 @@ id="g-svg-603" fill="url(#g-pattern-5)" class="ribbon-ribbon" - d="M 0,377 L 0,0 L 70.84,0 L 70.84,377 Z" + d="M 0,377 L 0,0 L 70.83999999999992,0 L 70.83999999999992,377 Z" /> @@ -3267,7 +3301,7 @@ fill="none" x1="0" y1="0" - x2="-70.84" + x2="-70.83999999999992" y2="0" class="axis-tick-item" stroke-width="1" @@ -3287,7 +3321,7 @@ fill="none" x1="0" y1="0" - x2="-70.84" + x2="-70.83999999999992" y2="0" class="axis-tick-item" stroke-width="1" @@ -3307,7 +3341,7 @@ fill="none" x1="0" y1="0" - x2="-70.84" + x2="-70.83999999999992" y2="0" class="axis-tick-item" stroke-width="1" @@ -3327,7 +3361,7 @@ fill="none" x1="0" y1="0" - x2="-70.84" + x2="-70.83999999999992" y2="0" class="axis-tick-item" stroke-width="1" @@ -3347,7 +3381,7 @@ fill="none" x1="0" y1="0" - x2="-70.84" + x2="-70.83999999999992" y2="0" class="axis-tick-item" stroke-width="1" @@ -3367,7 +3401,7 @@ fill="none" x1="0" y1="0" - x2="-70.84" + x2="-70.83999999999992" y2="0" class="axis-tick-item" stroke-width="1" @@ -3387,7 +3421,7 @@ fill="none" x1="0" y1="0" - x2="-70.84" + x2="-70.83999999999992" y2="0" class="axis-tick-item" stroke-width="1" @@ -3407,7 +3441,7 @@ fill="none" x1="0" y1="0" - x2="-70.84" + x2="-70.83999999999992" y2="0" class="axis-tick-item" stroke-width="1" @@ -3427,7 +3461,7 @@ fill="none" x1="0" y1="0" - x2="-70.84" + x2="-70.83999999999992" y2="0" class="axis-tick-item" stroke-width="1" @@ -3447,7 +3481,7 @@ fill="none" x1="0" y1="0" - x2="-70.84" + x2="-70.83999999999992" y2="0" class="axis-tick-item" stroke-width="1" @@ -3460,7 +3494,7 @@ @@ -3487,7 +3521,7 @@ @@ -3514,7 +3548,7 @@ @@ -3541,7 +3575,7 @@ @@ -3568,7 +3602,7 @@ @@ -3595,7 +3629,7 @@ @@ -3622,7 +3656,7 @@ @@ -3649,7 +3683,7 @@ @@ -3676,7 +3710,7 @@ @@ -3703,7 +3737,7 @@ @@ -3901,8 +3935,8 @@ @@ -4172,7 +4206,7 @@ @@ -4199,7 +4233,7 @@ @@ -4226,7 +4260,7 @@ @@ -4253,7 +4287,7 @@ @@ -4280,7 +4314,7 @@ @@ -4307,7 +4341,7 @@ @@ -4334,7 +4368,7 @@ @@ -4361,7 +4395,7 @@ @@ -4388,7 +4422,7 @@ @@ -4415,7 +4449,7 @@ @@ -4613,8 +4647,8 @@ @@ -4682,15 +4716,15 @@ @@ -4716,7 +4750,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999997" + x2="-70.84" y2="0" class="axis-tick-item" stroke-width="1" @@ -4736,7 +4770,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999997" + x2="-70.84" y2="0" class="axis-tick-item" stroke-width="1" @@ -4756,7 +4790,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999997" + x2="-70.84" y2="0" class="axis-tick-item" stroke-width="1" @@ -4776,7 +4810,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999997" + x2="-70.84" y2="0" class="axis-tick-item" stroke-width="1" @@ -4796,7 +4830,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999997" + x2="-70.84" y2="0" class="axis-tick-item" stroke-width="1" @@ -4816,7 +4850,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999997" + x2="-70.84" y2="0" class="axis-tick-item" stroke-width="1" @@ -4836,7 +4870,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999997" + x2="-70.84" y2="0" class="axis-tick-item" stroke-width="1" @@ -4856,7 +4890,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999997" + x2="-70.84" y2="0" class="axis-tick-item" stroke-width="1" @@ -4876,7 +4910,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999997" + x2="-70.84" y2="0" class="axis-tick-item" stroke-width="1" @@ -4896,7 +4930,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999997" + x2="-70.84" y2="0" class="axis-tick-item" stroke-width="1" @@ -4909,7 +4943,7 @@ @@ -4936,7 +4970,7 @@ @@ -4963,7 +4997,7 @@ @@ -4990,7 +5024,7 @@ @@ -5017,7 +5051,7 @@ @@ -5044,7 +5078,7 @@ @@ -5071,7 +5105,7 @@ @@ -5098,7 +5132,7 @@ @@ -5125,7 +5159,7 @@ @@ -5152,7 +5186,7 @@ @@ -5350,8 +5384,8 @@ @@ -5419,15 +5453,15 @@ @@ -5453,7 +5487,7 @@ fill="none" x1="0" y1="0" - x2="-70.84000000000003" + x2="-70.83999999999997" y2="0" class="axis-tick-item" stroke-width="1" @@ -5473,7 +5507,7 @@ fill="none" x1="0" y1="0" - x2="-70.84000000000003" + x2="-70.83999999999997" y2="0" class="axis-tick-item" stroke-width="1" @@ -5493,7 +5527,7 @@ fill="none" x1="0" y1="0" - x2="-70.84000000000003" + x2="-70.83999999999997" y2="0" class="axis-tick-item" stroke-width="1" @@ -5513,7 +5547,7 @@ fill="none" x1="0" y1="0" - x2="-70.84000000000003" + x2="-70.83999999999997" y2="0" class="axis-tick-item" stroke-width="1" @@ -5533,7 +5567,7 @@ fill="none" x1="0" y1="0" - x2="-70.84000000000003" + x2="-70.83999999999997" y2="0" class="axis-tick-item" stroke-width="1" @@ -5553,7 +5587,7 @@ fill="none" x1="0" y1="0" - x2="-70.84000000000003" + x2="-70.83999999999997" y2="0" class="axis-tick-item" stroke-width="1" @@ -5573,7 +5607,7 @@ fill="none" x1="0" y1="0" - x2="-70.84000000000003" + x2="-70.83999999999997" y2="0" class="axis-tick-item" stroke-width="1" @@ -5593,7 +5627,7 @@ fill="none" x1="0" y1="0" - x2="-70.84000000000003" + x2="-70.83999999999997" y2="0" class="axis-tick-item" stroke-width="1" @@ -5613,7 +5647,7 @@ fill="none" x1="0" y1="0" - x2="-70.84000000000003" + x2="-70.83999999999997" y2="0" class="axis-tick-item" stroke-width="1" @@ -5633,7 +5667,7 @@ fill="none" x1="0" y1="0" - x2="-70.84000000000003" + x2="-70.83999999999997" y2="0" class="axis-tick-item" stroke-width="1" @@ -5646,7 +5680,7 @@ @@ -5673,7 +5707,7 @@ @@ -5700,7 +5734,7 @@ @@ -5727,7 +5761,7 @@ @@ -5754,7 +5788,7 @@ @@ -5781,7 +5815,7 @@ @@ -5808,7 +5842,7 @@ @@ -5835,7 +5869,7 @@ @@ -5862,7 +5896,7 @@ @@ -5889,7 +5923,7 @@ @@ -6099,8 +6133,8 @@ @@ -6370,7 +6404,7 @@ @@ -6397,7 +6431,7 @@ @@ -6424,7 +6458,7 @@ @@ -6451,7 +6485,7 @@ @@ -6478,7 +6512,7 @@ @@ -6505,7 +6539,7 @@ @@ -6532,7 +6566,7 @@ @@ -6559,7 +6593,7 @@ @@ -6586,7 +6620,7 @@ @@ -6613,7 +6647,7 @@ @@ -6666,8 +6700,8 @@ @@ -6712,13 +6746,13 @@ id="g-svg-1219" fill="url(#g-pattern-9)" class="ribbon-ribbon" - d="M 0,377 L 0,0 L 70.83999999999992,0 L 70.83999999999992,377 Z" + d="M 0,377 L 0,0 L 70.84000000000003,0 L 70.84000000000003,377 Z" /> @@ -6744,7 +6778,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999992" + x2="-70.84000000000003" y2="0" class="axis-tick-item" stroke-width="1" @@ -6764,7 +6798,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999992" + x2="-70.84000000000003" y2="0" class="axis-tick-item" stroke-width="1" @@ -6784,7 +6818,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999992" + x2="-70.84000000000003" y2="0" class="axis-tick-item" stroke-width="1" @@ -6804,7 +6838,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999992" + x2="-70.84000000000003" y2="0" class="axis-tick-item" stroke-width="1" @@ -6824,7 +6858,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999992" + x2="-70.84000000000003" y2="0" class="axis-tick-item" stroke-width="1" @@ -6844,7 +6878,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999992" + x2="-70.84000000000003" y2="0" class="axis-tick-item" stroke-width="1" @@ -6864,7 +6898,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999992" + x2="-70.84000000000003" y2="0" class="axis-tick-item" stroke-width="1" @@ -6884,7 +6918,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999992" + x2="-70.84000000000003" y2="0" class="axis-tick-item" stroke-width="1" @@ -6904,7 +6938,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999992" + x2="-70.84000000000003" y2="0" class="axis-tick-item" stroke-width="1" @@ -6924,7 +6958,7 @@ fill="none" x1="0" y1="0" - x2="-70.83999999999992" + x2="-70.84000000000003" y2="0" class="axis-tick-item" stroke-width="1" @@ -6937,7 +6971,7 @@ @@ -6964,7 +6998,7 @@ @@ -6991,7 +7025,7 @@ @@ -7018,7 +7052,7 @@ @@ -7045,7 +7079,7 @@ @@ -7072,7 +7106,7 @@ @@ -7099,7 +7133,7 @@ @@ -7126,7 +7160,7 @@ @@ -7153,7 +7187,7 @@ @@ -7180,7 +7214,7 @@ @@ -7229,6 +7263,1052 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + 100 + + + + + + + 200 + + + + + + + 300 + + + + + + + 400 + + + + + + + 500 + + + + + + + 600 + + + + + + + 700 + + + + + + + 800 + + + + + + + 900 + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + 900 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + 100 + + + + + + + 200 + + + + + + + 300 + + + + + + + 400 + + + + + + + 500 + + + + + + + 600 + + + + + + + 700 + + + + + + + 800 + + + + + + + 900 + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + 900 + + + + + + + + + + + + + + + diff --git a/__tests__/integration/snapshots/ContinuousD3ColorLegend.svg b/__tests__/integration/snapshots/ContinuousD3ColorLegend.svg index 4f2751de2..648987dbe 100644 --- a/__tests__/integration/snapshots/ContinuousD3ColorLegend.svg +++ b/__tests__/integration/snapshots/ContinuousD3ColorLegend.svg @@ -139,8 +139,8 @@ - - + + @@ -410,7 +410,7 @@ @@ -438,7 +438,7 @@ @@ -466,7 +466,7 @@ @@ -494,7 +494,7 @@ @@ -522,7 +522,7 @@ @@ -550,7 +550,7 @@ @@ -578,7 +578,7 @@ @@ -629,7 +629,7 @@ @@ -904,7 +904,7 @@ @@ -932,7 +932,7 @@ @@ -960,7 +960,7 @@ @@ -988,7 +988,7 @@ @@ -1016,7 +1016,7 @@ @@ -1044,7 +1044,7 @@ @@ -1072,7 +1072,7 @@ @@ -1123,7 +1123,7 @@ @@ -1398,7 +1398,7 @@ @@ -1426,7 +1426,7 @@ @@ -1454,7 +1454,7 @@ @@ -1482,7 +1482,7 @@ @@ -1510,7 +1510,7 @@ @@ -1538,7 +1538,7 @@ @@ -1566,7 +1566,7 @@ @@ -1617,7 +1617,7 @@ @@ -1892,7 +1892,7 @@ @@ -1920,7 +1920,7 @@ @@ -1948,7 +1948,7 @@ @@ -1976,7 +1976,7 @@ @@ -2004,7 +2004,7 @@ @@ -2032,7 +2032,7 @@ @@ -2060,7 +2060,7 @@ diff --git a/package.json b/package.json index 503407240..dd1cee6b4 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "component" ], "dependencies": { - "@antv/g": "^6.0.4", + "@antv/g": "^6.0.5", "@antv/scale": "^0.4.3", "@antv/util": "^3.3.5", "svg-path-parser": "^1.1.0" diff --git a/src/ui/legend/continuous.ts b/src/ui/legend/continuous.ts index 63ef33db5..f106e0729 100644 --- a/src/ui/legend/continuous.ts +++ b/src/ui/legend/continuous.ts @@ -2,7 +2,7 @@ import { CustomEvent } from '@antv/g'; import { Linear } from '@antv/scale'; import { clamp, isUndefined } from '@antv/util'; import { Component } from '../../core'; -import type { BaseStyleProps, DisplayObject, TextStyleProps } from '../../shapes'; +import type { DisplayObject, TextStyleProps } from '../../shapes'; import { Group } from '../../shapes'; import { Point } from '../../types'; import { @@ -517,7 +517,7 @@ export class Continuous extends Component { else if (labelPosition === 'top') spacing = labelSpacing; } - return { offset, spacing: labelSpacing, tickLength }; + return { offset, spacing, tickLength }; } private adjustLabel() { @@ -592,6 +592,7 @@ export class Continuous extends Component { const safeValue = clamp(value, min, max); const offset = this.getOffset(safeValue); const pos: Point = this.ifHorizontal([offset + x, y], [x, offset + y]); + this.indicator.update({ x: pos[0], y: pos[1], @@ -688,9 +689,8 @@ export class Continuous extends Component { /** * 事件触发的位置对应的value值 - * @param limit {boolean} 我也忘了要干啥了 */ - private getValueByCanvasPoint(e: any, limit: boolean = false) { + private getValueByCanvasPoint(e: any) { const { min, max } = this.range; const [x, y] = this.ribbon.node().getPosition(); const startPos = this.ifHorizontal(x, y); From 0f66baf0968b4d26f32e9748f352b1343bcee7ef Mon Sep 17 00:00:00 2001 From: "yuqi.pyq" Date: Thu, 9 May 2024 12:54:49 +0800 Subject: [PATCH 3/3] chore: bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dd1cee6b4..7fbe9e26c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@antv/component", - "version": "2.0.0", + "version": "2.0.1", "description": "Visualization components for AntV, based on G.", "license": "MIT", "main": "lib/index.js",