Skip to content

Commit c701ca3

Browse files
committed
fix: breaks should consider the min and max of axis, related to #3560
1 parent b27e24d commit c701ca3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/vchart/src/component/axis/mixin/linear-axis-mixin.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ export interface LinearAxisMixin {
3838
isSeriesDataEnable: any;
3939
computeDomain: any;
4040
collectData: (depth?: number) => { min: number; max: number; values: any[] }[];
41+
/**
42+
* 这个变量在其他break相关组件和扩展中都有使用
43+
*/
4144
_break: {
4245
domain: [number, number][];
4346
scope: [number, number][];
@@ -163,9 +166,11 @@ export class LinearAxisMixin {
163166
if (userSetBreaks) {
164167
const breakRanges = [];
165168
const breaks = [];
169+
// 如果用户手动的手指了max,可以将break的最大值限制在用户设置的最大值范围内
170+
const breakMaxLimit = isNil(this._domain.max) ? maxDomain : this._domain.max;
166171
for (let index = 0; index < this._spec.breaks.length; index++) {
167172
const { range } = this._spec.breaks[index];
168-
if (range[0] <= range[1] && range[1] <= maxDomain) {
173+
if (range[0] <= range[1] && range[1] <= breakMaxLimit) {
169174
breakRanges.push(range);
170175
breaks.push(this._spec.breaks[index]);
171176
}

0 commit comments

Comments
 (0)