Skip to content

Commit

Permalink
Merge pull request #12147 from susiwen8/#12121
Browse files Browse the repository at this point in the history
Fix: minOpen is true will drop a piece
  • Loading branch information
100pah committed Feb 25, 2020
2 parents 331ac4a + dbaa9bf commit 80d389f
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/component/visualMap/PiecewiseModel.js
Expand Up @@ -398,41 +398,37 @@ var resetMethods = {
thisOption.precision = precision;
splitStep = +splitStep.toFixed(precision);

var index = 0;

if (thisOption.minOpen) {
pieceList.push({
index: index++,
interval: [-Infinity, dataExtent[0]],
close: [0, 0]
});
}

for (
var curr = dataExtent[0], len = index + splitNumber;
index < len;
curr += splitStep
var index = 0, curr = dataExtent[0];
index < splitNumber;
curr += splitStep, index++
) {
var max = index === splitNumber - 1 ? dataExtent[1] : (curr + splitStep);

pieceList.push({
index: index++,
interval: [curr, max],
close: [1, 1]
});
}

if (thisOption.maxOpen) {
pieceList.push({
index: index++,
interval: [dataExtent[1], Infinity],
close: [0, 0]
});
}

reformIntervals(pieceList);

zrUtil.each(pieceList, function (piece) {
zrUtil.each(pieceList, function (piece, index) {
piece.index = index;
piece.text = this.formatValueText(piece.interval);
}, this);
},
Expand Down

0 comments on commit 80d389f

Please sign in to comment.