From 2cd00a775aab2c8977f811ccc9612980d4d10f1e Mon Sep 17 00:00:00 2001 From: Aaron <943720372@qq.com> Date: Tue, 25 Apr 2023 14:20:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20labelFilter=20=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E4=B8=8E=20labelFormatter=20=E4=BF=9D=E6=8C=81=E4=B8=80?= =?UTF-8?q?=E8=87=B4=20(#4911)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: refactor labelFilter to has same pramameters with labelFormatter * test: add test case --- .../static/aaplLineBasicSampleLabelFilter.png | Bin 0 -> 23455 bytes .../aapl-line-basic-sample-label-filter.ts | 38 +++++++++++ __tests__/plots/static/index.ts | 1 + src/component/axis.ts | 61 +++++++++++++----- 4 files changed, 83 insertions(+), 17 deletions(-) create mode 100644 __tests__/integration/snapshots/static/aaplLineBasicSampleLabelFilter.png create mode 100644 __tests__/plots/static/aapl-line-basic-sample-label-filter.ts diff --git a/__tests__/integration/snapshots/static/aaplLineBasicSampleLabelFilter.png b/__tests__/integration/snapshots/static/aaplLineBasicSampleLabelFilter.png new file mode 100644 index 0000000000000000000000000000000000000000..387c47941f68bcc97dcc636c9b689fe9ae9eaeb0 GIT binary patch literal 23455 zcmce;_gfR~^9C9~KtaStQKSe2lr9J;9UFuqU3yWPbSa^QCWr_MNRTeQgM?lZO0Xc( zHS`ifhtNWAA#gUlpYL_fUvT7yT)WrqQ|6huXXc(+BekEaFwotk1A#yc5Y;ETAP{8; z2t+Y;o(8xh`EOzl_@Q~FuJQzQO8(1gE{q3(xImC6%KE-vSFwHp?6%GAn*_JsM3KLg zQJ7GD+bd5$KQ%Th3O&Dm=dBdP2}_q#1ECM?8k~hbeGN~fH$hmr#MfP&kk)VF$_WkO zK9ArMDE*`Ry8o-E$AZu4gF;rV>P249#6IF~XKA{hUGMQ2o)@Pe(I;^gSjzvO|3a4I zKilZAyuAQFBPhX6yx^L8&x3f*-*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?EBExO+8$HI365oK^4@Z`}ygB6E7d2ZL|V;X&29>|2>*n~0nbP+VevpXvu-*#{P z(n44qRX*FUS3B8lR3j)+M-#+HNHKEOOz$*Z@t5j*yLlXebWd-D9z9#82Zovf7ZzeY zdRC?~y#pCHtJ4pTQ+>PHnIY4QXiULlO?Ia4lOJ*A&slTwv*eUa&)j|xeP2HxzC3J8 zx%hdCg6qs2^zA3$s5H!$R&kgW7QZkHcdJweSGF`YeKqVo5D4&g*nai}cXjE~^N|8c zv6&!y%p{t)It`r%ppU@*SKAibq9;Pgm393mKGuWo9Rnc_&UyRz$%9vXmJP-11FZGTH6dO z!$m63l2GLmbxuA9raXTOuu(Q6?&Qvt(#2ao~3zg3y2$uVmIU3YUA$EXB z4+89mf5;d@38M>$bV+u5bG^R0n`|tvThv~H GC;SIaDT&Si literal 0 HcmV?d00001 diff --git a/__tests__/plots/static/aapl-line-basic-sample-label-filter.ts b/__tests__/plots/static/aapl-line-basic-sample-label-filter.ts new file mode 100644 index 0000000000..026c5703cd --- /dev/null +++ b/__tests__/plots/static/aapl-line-basic-sample-label-filter.ts @@ -0,0 +1,38 @@ +import { G2Spec } from '../../../src'; + +export function aaplLineBasicSampleLabelFilter(): G2Spec { + return { + type: 'line', + data: { + type: 'fetch', + value: 'data/aapl.csv', + }, + encode: { + x: 'date', + y: 'close', + }, + transform: [ + { + type: 'sample', + thresholds: 100, + strategy: 'lttb', + }, + ], + axis: { + x: { + labelFormatter: (d, i) => { + return ( + d.getFullYear().toString() + (i % 2 === 0 ? '(even)' : '(odd)') + ); + }, + }, + y: { + labelFilter: (d) => { + return d % 100 === 0; + }, + }, + }, + }; +} + +aaplLineBasicSampleLabelFilter.maxError = 100; diff --git a/__tests__/plots/static/index.ts b/__tests__/plots/static/index.ts index f065aa27ff..6b8843eda4 100644 --- a/__tests__/plots/static/index.ts +++ b/__tests__/plots/static/index.ts @@ -47,6 +47,7 @@ export { flarePointCirclePackCustom } from './flare-point-circle-pack-custom'; export { aaplLineBasic } from './aapl-line-basic'; export { aaplLineBasicLabelOverlapHide } from './aapl-line-basic-label-overlap-hide'; export { aaplLineBasicSample } from './aapl-line-basic-sample'; +export { aaplLineBasicSampleLabelFilter } from './aapl-line-basic-sample-label-filter'; export { aaplLineAreaBasicSample } from './aapl-line-area-basic-sample'; export { aaplLinePointBasicSample } from './aapl-line-point-basic-sample'; export { unemploymentLineMultiSeries } from './unemployment-line-multi-series'; diff --git a/src/component/axis.ts b/src/component/axis.ts index a875a9dcc3..ef264da409 100644 --- a/src/component/axis.ts +++ b/src/component/axis.ts @@ -1,4 +1,5 @@ import { Coordinate } from '@antv/coord'; +import type { DisplayObject } from '@antv/g'; import { Axis as AxisComponent } from '@antv/gui'; import { Linear as LinearScale } from '@antv/scale'; import { deepMix } from '@antv/util'; @@ -23,15 +24,22 @@ import { radiusOf, } from '../utils/coordinate'; import { capitalizeFirst } from '../utils/helper'; -import { adaptor, isVertical, isHorizontal, titleContent } from './utils'; +import { adaptor, isVertical, titleContent } from './utils'; export type AxisOptions = { position?: GCP; zIndex?: number; title?: string | string[]; direction?: 'left' | 'center' | 'right'; - labelFormatter?: (d: any, index: number, array: any) => string; - tickFilter?: (datum: any, index: number, array: any) => boolean; + labelFormatter?: (datum: any, index: number, array: any[]) => string; + labelFilter?: (datum: any, index: number, array: any[]) => boolean; + tickFormatter?: ( + datum: any, + index: number, + array: any[], + vector: [number, number], + ) => DisplayObject; + tickFilter?: (datum: any, index: number, array: any[]) => boolean; tickMethod?: ( start: number | Date, end: number | Date, @@ -121,7 +129,7 @@ function createInset(position, coordinate) { /** * Calc ticks based on scale and coordinate. */ -function getTicks( +function getData( scale: Scale, domain: any[], tickCount: number, @@ -140,11 +148,11 @@ function getTicks( const ticks = ticksOf(scale, domain, tickMethod); const filteredTicks = tickFilter ? ticks.filter(tickFilter) : ticks; - const labelFormatter = scale.getFormatter?.() || defaultTickFormatter; - const toString = (d) => (typeof d === 'object' ? d : String(d)); + const toString = (d) => (typeof d === 'object' && !!d ? d : String(d)); + const labelFormatter = + defaultTickFormatter || scale.getFormatter?.() || toString; const applyInset = createInset(position, coordinate); const applyFisheye = createFisheye(position, coordinate); - if (isPolar(coordinate) || isTranspose(coordinate)) { const axisTicks = filteredTicks.map((d, i, array) => { const offset = scale.getBandWidth?.(d) / 2 || 0; @@ -353,7 +361,7 @@ const ArcAxisComponent: GCC = (options) => { size, position, orientation, - labelFormatter = (d) => `${d}`, + labelFormatter, tickFilter, tickCount, tickMethod, @@ -365,7 +373,7 @@ const ArcAxisComponent: GCC = (options) => { return ({ scales: [scale], value, coordinate, theme }) => { const { bbox } = value; const { domain } = scale.getOptions(); - const ticks = getTicks( + const data = getData( scale, domain, tickCount, @@ -391,7 +399,7 @@ const ArcAxisComponent: GCC = (options) => { style: adaptor( deepMix({}, axisTheme, defaultStyle, { type: 'arc', - data: ticks, + data, titleText: titleContent(title), grid, ...rest, @@ -456,7 +464,7 @@ const LinearAxisComponent: GCC = (options) => { const { direction = 'left', important = {}, - labelFormatter = (d) => `${d}`, + labelFormatter, order, orientation, position, @@ -500,7 +508,7 @@ const LinearAxisComponent: GCC = (options) => { const finalAxisStyle = { ...internalAxisStyle, type: 'linear' as const, - data: getTicks( + data: getData( scale, domain, tickCount, @@ -520,7 +528,6 @@ const LinearAxisComponent: GCC = (options) => { ...overrideStyle, ...important, }; - return new AxisComponent({ className: 'axis', style: adaptor(finalAxisStyle), @@ -532,10 +539,30 @@ const axisFactor: ( axis: typeof ArcAxisComponent | typeof LinearAxisComponent, ) => GCC = (axis) => { return (options) => { - const { labelFormatter: f = (d) => `${d}` } = options; - const labelFormatter = typeof f === 'string' ? format(f) : f; - const normalizedOptions = { ...options, labelFormatter }; - return (...args) => axis(normalizedOptions)(...args); + const { + labelFormatter: useDefinedLabelFormatter, + labelFilter: userDefinedLabelFilter = () => true, + } = options; + + return (context) => { + const { + scales: [scale], + } = context; + const ticks = scale.getTicks?.() || scale.getOptions().domain; + const labelFormatter = + typeof useDefinedLabelFormatter === 'string' + ? format(useDefinedLabelFormatter) + : useDefinedLabelFormatter; + const labelFilter = (datum: any, index: number, array: any[]) => + userDefinedLabelFilter(ticks[index], index, ticks); + + const normalizedOptions = { + ...options, + labelFormatter, + labelFilter, + }; + return axis(normalizedOptions)(context); + }; }; };