From ae3138c150a774703b9404b61d98b0b388e8f541 Mon Sep 17 00:00:00 2001 From: MiniPear Date: Mon, 11 Sep 2023 12:19:19 +0800 Subject: [PATCH] fix(pie): interaction for composite mark (#5524) --- .../mock-pie-interaction/step0.png | Bin 0 -> 19137 bytes __tests__/plots/interaction/index.ts | 1 + .../plots/interaction/mock-pie-interaction.ts | 40 ++++++++++++++++++ src/runtime/plot.ts | 3 ++ src/utils/helper.ts | 10 ++++- 5 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 __tests__/integration/snapshots/interaction/mock-pie-interaction/step0.png create mode 100644 __tests__/plots/interaction/mock-pie-interaction.ts diff --git a/__tests__/integration/snapshots/interaction/mock-pie-interaction/step0.png b/__tests__/integration/snapshots/interaction/mock-pie-interaction/step0.png new file mode 100644 index 0000000000000000000000000000000000000000..6a0a3085ef50c9549ed44801bd94fc3e2a0931f7 GIT binary patch literal 19137 zcmcG$WmJ^k_Xqk64ANaHJxEF^JtCkCf;0$%k|Kz74P65$sUV7U3DS+U#DE}(Qqm0q z5=wX9Gk$;n7x(?Wx?HZsInO!!?ETrjHC#(WiJasr2?Rmp_mxpP5QK+;AlNL?CGZpR z{>cUK*ClgRB@}dl`<>C4`woKGq5G&ix}GV2r@VZ1_Znq4mt3E5KT%bdmuHtJVt<6% z#0wg>sfsNA%n(#P)P)#6uN*SG-Xf$?sAp?9V(T+yQ_R%1R&7vKI9&afEz)-@@AkJZ8hPo;6OXT*=s%(d|tsT4@$nvnn=%;xg2$YQmj#b$iQqY=UW@PdoPASW^~6Q&$19uL{`h=V zFflRl*s{7!nZbs+Nf*8Ql`kaRyby`EGy<)U zSNgY?YMdShZ+v-kni&rz)>xly&v0?rOr|_%yYkj__pQNk>({Cw$F?(LyaJ=92ctnq2uXe(OCRXY%XZV|xvs}C1TQlh=X|h`PuJ^nKpD(b}HMZC+DahBwGTEYkth|$FJiRW~K*UTq@ z>x7Vr|Iy+JbH|Y~DyPs!nA)qPvT|1++T0z`w6e6cB!H!mnw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OZ4&5W)@94Cwz1nxDu`$KZpyyn|C8*;;!Ag{l!~!0 zSkk<0-Km3-8zww3nG}4p*2zNNpOZgKJ2CixRa1SA>i4zz7k(U=dr?PLZRKW5236nA zQtwUwCtNq$e(i}#8ULZnOn$yIB6qFz%~h??NpRNw85rN&-Z$f@a@@J8CZaM8la`%5 zqG6Nh*1c1=Liwb0!_EWJ4cA4^&F0f>s#m|slA~0yM?cdfaZTJ&;iZpNzVZPbwCzL6 z)aK~2{)0Pf556|CiT;JdO_pyy(e(IhG ztDs3h%dFfMp9*I_&UWUc*zqk7R_wFmJN+ae!K~oNk>`ii?9!gUTmN^v)R~%{ijo@^ zvsyFNalTQxG3z8ZqdwDl_B}H`*lb|E!DAD8`)}oE9|`-7UC)=jnLS;_a}wF;OV>Z) Z%NMt;SZGw-3OtjF!PC{xWt~$(696^7K>h## literal 0 HcmV?d00001 diff --git a/__tests__/plots/interaction/index.ts b/__tests__/plots/interaction/index.ts index b3ebed3acd..e3bb7f8a70 100644 --- a/__tests__/plots/interaction/index.ts +++ b/__tests__/plots/interaction/index.ts @@ -69,3 +69,4 @@ export { commitsPointLegendFilter } from './commits-point-legend-filter'; export { settleWeatherLegendFilter } from './seattle-weather-legend-filter'; export { countriesBubbleMultiLegends } from './countries-bubble-multi-legends'; export { pointsPointTooltipMarker } from './points-point-tooltip-marker'; +export { mockPieInteraction } from './mock-pie-interaction'; diff --git a/__tests__/plots/interaction/mock-pie-interaction.ts b/__tests__/plots/interaction/mock-pie-interaction.ts new file mode 100644 index 0000000000..9a640d8e89 --- /dev/null +++ b/__tests__/plots/interaction/mock-pie-interaction.ts @@ -0,0 +1,40 @@ +import { deepMix } from '@antv/util'; +import { G2Spec } from '../../../src'; +import { LEGEND_ITEMS_CLASS_NAME } from '../../../src/interaction/legendFilter'; +import { step } from './utils'; + +function Pie(options, context) { + const { encode = {}, ...rest } = options; + const { value, ...restEncode } = encode; + return deepMix(rest, { + type: 'interval', + transform: [{ type: 'stackY' }], + coordinate: { type: 'theta' }, + encode: { + ...restEncode, + y: value, + }, + }); +} + +export function mockPieInteraction(): G2Spec { + return { + type: Pie, + data: [ + { genre: 'Sports', sold: 275 }, + { genre: 'Strategy', sold: 115 }, + { genre: 'Action', sold: 120 }, + { genre: 'Shooter', sold: 350 }, + { genre: 'Other', sold: 150 }, + ], + // @ts-ignore + encode: { value: 'sold', color: 'genre' }, + animate: false, + }; +} + +mockPieInteraction.steps = ({ canvas }) => { + const { document } = canvas; + const [e] = document.getElementsByClassName(LEGEND_ITEMS_CLASS_NAME); + return [step(e, 'click')]; +}; diff --git a/src/runtime/plot.ts b/src/runtime/plot.ts index c0c7cacc99..cf2fda2f70 100644 --- a/src/runtime/plot.ts +++ b/src/runtime/plot.ts @@ -422,11 +422,14 @@ async function initializeView( const flattenOptions = await transformMarks(options, library); const mergedOptions = bubbleOptions(flattenOptions); + // @todo Remove this. // !!! NOTE: Mute original view options. // Update interaction and coordinate for this view. options.interaction = mergedOptions.interaction; options.coordinate = mergedOptions.coordinate; + // @ts-ignore + options.marks = [...mergedOptions.marks, ...mergedOptions.components]; const transformedOptions = coordinate2Transform(mergedOptions, library); const state = await initializeMarks(transformedOptions, library); diff --git a/src/utils/helper.ts b/src/utils/helper.ts index 9d17e6d278..f46ceb3b44 100644 --- a/src/utils/helper.ts +++ b/src/utils/helper.ts @@ -45,7 +45,15 @@ export function copyAttributes(target: DisplayObject, source: DisplayObject) { const { attributes } = source; const exclude = new Set(['id', 'className']); for (const [key, value] of Object.entries(attributes)) { - if (!exclude.has(key)) target.attr(key, value); + if (!exclude.has(key)) { + // @todo Fix in @antv/g + if (key === 'transform') { + target.attr(key, ''); + target.attr(key, value); + } else { + target.attr(key, value); + } + } } }