Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/component/dataZoom/DataZoomModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,22 @@ class DataZoomModel<Opts extends DataZoomOption = DataZoomOption> extends Compon

setCalculatedRange(opt: RangeOption): void {
const option = this.option;
each(['start', 'startValue', 'end', 'endValue'] as const, function (name) {
(option as any)[name] = opt[name];
});
const settledOption = this.settledOption;
// A representative axis cannot supply value inputs for every target axis.
// Keep value-mode bounds (including unspecified bounds) so getOption can
// recover each axis independently, even when the representative range is clamped.
each([['start', 'startValue'], ['end', 'endValue']] as const, function (names, index) {
if (this._rangePropMode[index] === 'value') {
option[names[0]] = null;
option[names[1]] = settledOption[names[1]];
}
else {
option[names[0]] = opt[names[0]];
option[names[1]] = opt[names[1]];
}
}, this);
// Actions can change the mode without changing the user-specified rangeMode.
option.rangeMode = this.getRangePropMode();
}

getPercentRange(): number[] {
Expand Down
4 changes: 2 additions & 2 deletions src/component/dataZoom/dataZoomProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ const dataZoomProcessor: StageHandler = {
});

ecModel.eachComponent('dataZoom', function (dataZoomModel: DataZoomModel) {
// Fullfill all of the range props so that user
// is able to get them from chart.getOption().
// Update the output range while preserving the value-mode inputs
// needed to recover all target axes from chart.getOption().
const axisProxy = dataZoomModel.findRepresentativeAxisProxy();
if (axisProxy) {
const {percent, value} = axisProxy.getWindow();
Expand Down
39 changes: 31 additions & 8 deletions test/dataZoom-action.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

111 changes: 111 additions & 0 deletions test/dataZoom-range-recovery.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

139 changes: 139 additions & 0 deletions test/ut/spec/component/dataZoom/rangeRoundTrip.test.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.