Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dataZoom): valueRange for dataZoom event #17278

Closed
wants to merge 6 commits into from
Closed
Changes from 3 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
28 changes: 16 additions & 12 deletions src/component/dataZoom/SliderZoomView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class SliderZoomView extends DataZoomView {
private _shadowSize: number[];
private _shadowPolygonPts: number[][];
private _shadowPolylinePts: number[][];
private _valueRange: number[] = [];

init(ecModel: GlobalModel, api: ExtensionAPI) {
this.api = api;
Expand Down Expand Up @@ -803,20 +804,21 @@ class SliderZoomView extends DataZoomView {

// FIXME
// date型,支持formatter,autoformatter(ec2 date.getAutoFormatter)
if (dataZoomModel.get('showDetail')) {
const axisProxy = dataZoomModel.findRepresentativeAxisProxy();
const axisProxy = dataZoomModel.findRepresentativeAxisProxy();

if (axisProxy) {
const axis = axisProxy.getAxisModel().axis;
const range = this._range;
if (axisProxy) {
const axis = axisProxy.getAxisModel().axis;
const range = this._range;

const dataInterval = nonRealtime
// See #4434, data and axis are not processed and reset yet in non-realtime mode.
? axisProxy.calculateDataWindow({
start: range[0], end: range[1]
}).valueWindow
: axisProxy.getDataValueWindow();
const dataInterval = nonRealtime
// See #4434, data and axis are not processed and reset yet in non-realtime mode.
? axisProxy.calculateDataWindow({
start: range[0], end: range[1]
}).valueWindow
: axisProxy.getDataValueWindow();
this._valueRange = dataInterval;

if (dataZoomModel.get('showDetail')) {
labelTexts = [
this._formatLabel(dataInterval[0], axis),
this._formatLabel(dataInterval[1], axis)
Expand Down Expand Up @@ -1049,7 +1051,9 @@ class SliderZoomView extends DataZoomView {
dataZoomId: this.dataZoomModel.id,
animation: realtime ? REALTIME_ANIMATION_CONFIG : null,
start: range[0],
end: range[1]
end: range[1],
startValue: this._valueRange[0],
endValue: this._valueRange[1]
});
}

Expand Down