Skip to content

Commit e2aa10c

Browse files
moayuisudaanhaohui.ahh
and
anhaohui.ahh
authored
fix: thumbnail of dual-axes are out of sync (#3821)
Co-authored-by: anhaohui.ahh <[email protected]>
1 parent 0b5a9af commit e2aa10c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

__tests__/unit/utils/pattern/line-spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('utils: line pattern', () => {
2929
drawLine(ctx, cfg as LinePatternCfg, d);
3030
// 传入的是呈现的位置
3131
expect(getPixelColor(canvas, 0, 0).hex).toEqual('#ff0000');
32-
expect(getPixelColor(canvas, 0, height - 1).hex).toEqual('#ff0000');
32+
expect(getPixelColor(canvas, 0, height - 1).hex).toEqual('#000000');
3333
});
3434

3535
it('lineUnitPattern with strokeOpacity', () => {

src/plots/dual-axes/util/render-sider.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export const doSliderFilter = (view: View, sliderValue: [number, number]) => {
2121
const values = valuesOfKey(data, xScale.field);
2222
const xValues = isHorizontal ? values : values.reverse();
2323
const xTickCount = size(xValues);
24-
const minIndex = Math.floor(min * (xTickCount - 1));
25-
const maxIndex = Math.floor(max * (xTickCount - 1));
24+
const minIndex = Math.round(min * (xTickCount - 1));
25+
const maxIndex = Math.round(max * (xTickCount - 1));
2626

2727
// 增加 x 轴的过滤器
2828
view.filter(xScale.field, (value: any) => {

0 commit comments

Comments
 (0)