Skip to content

Commit

Permalink
fix: 缩放后,legend点击会让缩放失效
Browse files Browse the repository at this point in the history
  • Loading branch information
zengyue committed Mar 10, 2020
1 parent 97f7aa5 commit b490bbe
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/interaction/new/context.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { getRange } from '../../util/array';
import {
EVENT_AFTER_INIT,
EVENT_AFTER_DATA_CHANGE
} from '../../chart/const';

const autoCat = require('@antv/scale/lib/auto/cat');

Expand Down Expand Up @@ -32,7 +36,7 @@ class Context {
this._initEvent(chart);
}
_initEvent(chart) {
chart.on('afterinit', () => {
chart.on(EVENT_AFTER_INIT, () => {
// 初始化value值
const scale = this.getPinchScale();
// 记录原始全量数据
Expand All @@ -41,6 +45,9 @@ class Context {
// 最小的缩放比例
this.minRangeRatio = minCount / values.length;
});
chart.on(EVENT_AFTER_DATA_CHANGE, () => {
this.updateRange(this.range);
});
}
// 缩放的主轴scale
getPinchScale() {
Expand Down

0 comments on commit b490bbe

Please sign in to comment.