This is an automated email from the ASF dual-hosted git repository. shenyi pushed a commit to branch pr/13317 in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
The following commit(s) were added to refs/heads/pr/13317 by this push: new c68ab09 fix(task): fix downSample wont change the task params end. c68ab09 is described below commit c68ab09d1f8b6ab197e9499b65b7df3ad64c35fe Author: pissang <bm2736...@gmail.com> AuthorDate: Wed Sep 23 18:40:11 2020 +0800 fix(task): fix downSample wont change the task params end. --- src/chart/helper/createRenderPlanner.ts | 17 +++++++++-------- src/data/List.ts | 4 ++-- src/model/Series.ts | 9 +++++---- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/chart/helper/createRenderPlanner.ts b/src/chart/helper/createRenderPlanner.ts index bdf564d..72daef1 100644 --- a/src/chart/helper/createRenderPlanner.ts +++ b/src/chart/helper/createRenderPlanner.ts @@ -17,8 +17,6 @@ * under the License. */ -// @ts-nocheck - import {makeInner} from '../../util/model'; import SeriesModel from '../../model/Series'; import { StageHandlerPlanReturn } from '../../util/types'; @@ -27,23 +25,26 @@ import { StageHandlerPlanReturn } from '../../util/types'; * @return {string} If large mode changed, return string 'reset'; */ export default function () { - const inner = makeInner(); + const inner = makeInner<{ + large: boolean + progressiveRender: boolean + }, SeriesModel>(); return function (seriesModel: SeriesModel): StageHandlerPlanReturn { const fields = inner(seriesModel); const pipelineContext = seriesModel.pipelineContext; - const originalLarge = fields.large; - const originalProgressive = fields.progressiveRender; + const originalLarge = !!fields.large; + const originalProgressive = !!fields.progressiveRender; // FIXME: if the planner works on a filtered series, `pipelineContext` does not // exists. See #11611 . Probably we need to modify this structure, see the comment // on `performRawSeries` in `Schedular.js`. - const large = fields.large = pipelineContext && pipelineContext.large; - const progressive = fields.progressiveRender = pipelineContext && pipelineContext.progressiveRender; + const large = fields.large = !!(pipelineContext && pipelineContext.large); + const progressive = fields.progressiveRender = !!(pipelineContext && pipelineContext.progressiveRender); return ( - !!((originalLarge ^ large as any) || (originalProgressive ^ progressive as any)) && 'reset' + !!((originalLarge !== large) || (originalProgressive !== progressive)) && 'reset' ) as StageHandlerPlanReturn; }; } diff --git a/src/data/List.ts b/src/data/List.ts index 15cebe5..46aa5e8 100644 --- a/src/data/List.ts +++ b/src/data/List.ts @@ -283,10 +283,10 @@ class List< // Methods that create a new list based on this list should be listed here. // Notice that those method should `RETURN` the new list. - TRANSFERABLE_METHODS = ['cloneShallow', 'downSample', 'map'] as const; + TRANSFERABLE_METHODS = ['cloneShallow', 'downSample', 'lttbDownSample', 'map'] as const; // Methods that change indices of this list should be listed here. CHANGABLE_METHODS = ['filterSelf', 'selectRange'] as const; - + DOWNSAMPLE_METHODS = ['downSample', 'lttbDownSample'] as const; /** * @param dimensions diff --git a/src/model/Series.ts b/src/model/Series.ts index a082994..5857cbf 100644 --- a/src/model/Series.ts +++ b/src/model/Series.ts @@ -643,17 +643,18 @@ function dataTaskProgress(param: StageHandlerProgressParams, context: SeriesTask // TODO refactor function wrapData(data: List, seriesModel: SeriesModel): void { - zrUtil.each(data.CHANGABLE_METHODS, function (methodName) { - data.wrapMethod(methodName as any, zrUtil.curry(onDataSelfChange, seriesModel)); + zrUtil.each([...data.CHANGABLE_METHODS, ...data.DOWNSAMPLE_METHODS], function (methodName) { + data.wrapMethod(methodName as any, zrUtil.curry(onDataChange, seriesModel)); }); } -function onDataSelfChange(this: List, seriesModel: SeriesModel): void { +function onDataChange(this: List, seriesModel: SeriesModel, newList: List): List { const task = getCurrentTask(seriesModel); if (task) { // Consider case: filter, selectRange - task.setOutputEnd(this.count()); + task.setOutputEnd((newList || this).count()); } + return newList; } function getCurrentTask(seriesModel: SeriesModel): GeneralTask { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org