From 32fb46b65dbcdcffa4b9a0031c0d273ca9284f9a Mon Sep 17 00:00:00 2001 From: "anhaohui.ahh" Date: Tue, 15 Oct 2024 19:05:28 +0800 Subject: [PATCH] fix: thumbnail of dual-axes are out of sync --- __tests__/unit/plots/bullet/index-spec.ts | 2 +- src/plots/dual-axes/util/render-sider.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__tests__/unit/plots/bullet/index-spec.ts b/__tests__/unit/plots/bullet/index-spec.ts index 35e5556c1b..ad0871f0f3 100644 --- a/__tests__/unit/plots/bullet/index-spec.ts +++ b/__tests__/unit/plots/bullet/index-spec.ts @@ -134,7 +134,7 @@ describe('bullet', () => { xField: 'title', yField: 'measures', }); - expect(measureGeometry.getAttribute('color').values).toEqual('#ff0000'); + expect(measureGeometry.getAttribute('color').values).toEqual('#000000'); bullet.destroy(); }); diff --git a/src/plots/dual-axes/util/render-sider.ts b/src/plots/dual-axes/util/render-sider.ts index d8f89b1a65..be75e84e56 100644 --- a/src/plots/dual-axes/util/render-sider.ts +++ b/src/plots/dual-axes/util/render-sider.ts @@ -21,8 +21,8 @@ export const doSliderFilter = (view: View, sliderValue: [number, number]) => { const values = valuesOfKey(data, xScale.field); const xValues = isHorizontal ? values : values.reverse(); const xTickCount = size(xValues); - const minIndex = Math.floor(min * (xTickCount - 1)); - const maxIndex = Math.floor(max * (xTickCount - 1)); + const minIndex = Math.round(min * (xTickCount - 1)); + const maxIndex = Math.round(max * (xTickCount - 1)); // 增加 x 轴的过滤器 view.filter(xScale.field, (value: any) => {