From 1446b1a4f0798304b8257c741bb3d0f1d189df2c Mon Sep 17 00:00:00 2001 From: MiniPear Date: Mon, 11 Sep 2023 20:37:52 +0800 Subject: [PATCH] fix(dual): set series of line to band scale (#5528) --- .../snapshots/static/mockIntervalLine.png | Bin 0 -> 20391 bytes __tests__/plots/static/index.ts | 1 + __tests__/plots/static/mock-interval-line.ts | 39 ++++++++++++++++++ src/interaction/tooltip.ts | 16 +++++-- src/mark/area.ts | 2 +- src/mark/line.ts | 2 +- 6 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 __tests__/integration/snapshots/static/mockIntervalLine.png create mode 100644 __tests__/plots/static/mock-interval-line.ts diff --git a/__tests__/integration/snapshots/static/mockIntervalLine.png b/__tests__/integration/snapshots/static/mockIntervalLine.png new file mode 100644 index 0000000000000000000000000000000000000000..7305104e0cfd56289da8101956edd7adb9d86573 GIT binary patch literal 20391 zcmeFZXHZk&*DtyO1w|1N=^z*omEL<(LsRL!BfTTNNdODd5s(f+iqgRVp$AYQbdVN$ zk={cM($9|X|Gjf&&b^<`r+el^W}NKJQ`UM`{jK#7uCA&`MoLc#005b?5>yia2!jED zVD1_*_(XVMY7zX8*y4pE6u89y`+~|(000(18Tv%qH)C_!?~V2$>TRily-80fqCC6K%VQmXlGg^&_s2RDkWN7rY z%q!ebnCs4c29^q|c)99SkEUi>7J7}_Yzcx1e$ve3_pFu$7aLbHI(yOuZB?P*hW4?&)t_b4 zop%rdz@2xyl5zrWZ4H$TlhW%b8~%+8A#PTjGDVz_=oZ@CZmtB?jQjO_iM;n30BGvX zsW<=lyiqbe`=l>0L!(w6d*f`6c;X>R zqWC>J0zht0e34L$k(AVS`cX`wqsi>w_hCvfw{aCrT7W!MdsB2GO)p3lS`ual8z^ZQ z792%ZiC>coDkF?P-ibLd_e8iCz!`LAr+;`8>)y_n*5gl4hixR*y!DX6c6Kr_k zfWAi))nmyJR2`K_erE(UZiH2_`&Q(g#hQI_it^BEm)S#Zs>euv54hXm1{|5_ z*S6Gtn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6Y-*Sh*&r+?xI ziAf|yOIUp^olHc0jC(X;&7!?}J(56fR5Dsyf3^kg+YiBi7w*Bb4nhy=TJ~%;j&jyx zo^9Ekd@!jBL8Cpbub+JUP-LUmt!rC5P}I4g9O+lS;%7bH{gZqtE;AE$($=K0=r+s6 z%px?;;8C;0@w5GKqJu0%PN-_A#9^_EKy+rN^cWep>0XM`n}^}nDU89ICP6@mt%;}_ zfyH@XN23Xu>#wtu09{xv7_IZKiY)`Kp0Zuf5#u(^+e8A?4EGRyd zsI1o8zC&1X)mn>lapw(tIK2$WQQEG{$I@>v z6|K|E1;-~9k2TTb{J1u| zgSF;&C=;$S&j=+HJVzQoa%uF7;}C^w+fMhG6;)(jj4o)eaRGh?$D}xUORQ2mV`nm{ z9fpA4lv~N@7RLMaa+{i1_)P(4xR?Iq(^@&dJh8jrK(}jj>S9RQ#>nYY1^+hI{vX+$ a%pL7JqA8!Wo(|@xb76ol#^(V#I_GcOvD(l8 literal 0 HcmV?d00001 diff --git a/__tests__/plots/static/index.ts b/__tests__/plots/static/index.ts index ef14049358..5f4f75e2df 100644 --- a/__tests__/plots/static/index.ts +++ b/__tests__/plots/static/index.ts @@ -283,3 +283,4 @@ export { settleWeatherCellLineXY } from './seattle-weather-cell-lineXY'; export { alphabetIntervalFunnelConnectorLabel } from './alphabet-interval-funnel-connector-label'; export { alphabetIntervalAxisOptions } from './alphabet-interval-axis-options'; export { profitIntervalAxisTransform } from './profit-interval-axis-transform'; +export { mockIntervalLine } from './mock-interval-line'; diff --git a/__tests__/plots/static/mock-interval-line.ts b/__tests__/plots/static/mock-interval-line.ts new file mode 100644 index 0000000000..04d29ce2d8 --- /dev/null +++ b/__tests__/plots/static/mock-interval-line.ts @@ -0,0 +1,39 @@ +import { G2Spec } from '../../../src'; + +export function mockIntervalLine(): G2Spec { + return { + type: 'view', + children: [ + { + type: 'interval', + data: [ + { time: '2019-03', value: 350, type: 'uv' }, + { time: '2019-04', value: 900, type: 'uv' }, + { time: '2019-05', value: 300, type: 'uv' }, + { time: '2019-06', value: 450, type: 'uv' }, + { time: '2019-07', value: 470, type: 'uv' }, + { time: '2019-03', value: 220, type: 'bill' }, + { time: '2019-04', value: 300, type: 'bill' }, + { time: '2019-05', value: 250, type: 'bill' }, + { time: '2019-06', value: 220, type: 'bill' }, + { time: '2019-07', value: 362, type: 'bill' }, + ], + encode: { x: 'time', y: 'value', color: 'type' }, + transform: [{ type: 'dodgeX' }], + axis: { y: { labelFormatter: '.0%' } }, + }, + { + type: 'line', + data: [ + { time: '2019-03', count: 800 }, + { time: '2019-04', count: 600 }, + { time: '2019-05', count: 400 }, + { time: '2019-06', count: 380 }, + { time: '2019-07', count: 220 }, + ], + encode: { x: 'time', y: 'count', color: () => 'line' }, + axis: { y: { labelFormatter: '.0%' } }, + }, + ], + }; +} diff --git a/src/interaction/tooltip.ts b/src/interaction/tooltip.ts index f23fa65dbc..e54d5221ec 100644 --- a/src/interaction/tooltip.ts +++ b/src/interaction/tooltip.ts @@ -2,7 +2,7 @@ import { Circle, DisplayObject, IElement, Line } from '@antv/g'; import { sort, group, mean, bisector, minIndex } from 'd3-array'; import { deepMix, lowerFirst, throttle } from '@antv/util'; import { Tooltip as TooltipComponent } from '@antv/gui'; -import { Constant, Identity } from '@antv/scale'; +import { Constant, Identity, Band } from '@antv/scale'; import { defined, subObject } from '../utils/helper'; import { isTranspose, isPolar } from '../utils/coordinate'; import { angle, sub } from '../utils/vector'; @@ -185,19 +185,26 @@ function singleItem(element) { } function groupNameOf(scale, datum) { - const { color: scaleColor, series: scaleSeries } = scale; + const { color: scaleColor, series: scaleSeries, facet = false } = scale; const { color, series } = datum; const invertAble = (scale) => { return ( scale && scale.invert && - !(scale instanceof Identity) && + !(scale instanceof Band) && !(scale instanceof Constant) ); }; // For non constant color channel. if (invertAble(scaleSeries)) return scaleSeries.invert(series); - if (series && series !== color) return series; + if ( + series && + scaleSeries instanceof Band && + scaleSeries.invert(series) !== color && + !facet + ) { + return scaleSeries.invert(series); + } if (invertAble(scaleColor)) { const name = scaleColor.invert(color); // For threshold scale. @@ -896,6 +903,7 @@ export function Tooltip(options) { const bbox = plotArea.getBounds(); const startX = bbox.min[0]; const startY = bbox.min[1]; + Object.assign(scale, { facet: true }); // @todo Nested structure rather than flat structure for facet? // Add listener to the root area. diff --git a/src/mark/area.ts b/src/mark/area.ts index 3e65ea21dd..9e35a83a17 100644 --- a/src/mark/area.ts +++ b/src/mark/area.ts @@ -85,7 +85,7 @@ Area.props = { { name: 'x', required: true }, { name: 'y', required: true }, { name: 'size' }, - { name: 'series', scale: 'identity' }, + { name: 'series', scale: 'band' }, ], preInference: [ ...basePreInference(), diff --git a/src/mark/line.ts b/src/mark/line.ts index 2a0f1bdd20..d7d96d2bbd 100644 --- a/src/mark/line.ts +++ b/src/mark/line.ts @@ -108,7 +108,7 @@ Line.props = { { name: 'y' }, { name: 'position', independent: true }, { name: 'size' }, - { name: 'series', scale: 'identity' }, + { name: 'series', scale: 'band' }, ], preInference: [ ...basePreInference(),