提交 1ac815ae 编写于 作者: S sushuang

Fix overall task

上级 62959467
......@@ -284,6 +284,12 @@ var SliderZoomView = DataZoomView.extend({
var size = this._size;
var seriesModel = info.series;
var data = seriesModel.getRawData();
// FIXME rough. ???
if (data.count() > 1e5) {
return;
}
var otherDim = seriesModel.getShadowDim
? seriesModel.getShadowDim() // @see candlestick
: info.otherDim;
......
import * as echarts from '../../echarts';
echarts.registerProcessor(function (ecModel, api) {
echarts.registerProcessor({
getTargetSeries: function (ecModel, api) {
var seriesModels = [];
ecModel.eachComponent('dataZoom', function (dataZoomModel) {
dataZoomModel.eachTargetAxis(function (dimNames, axisIndex, dataZoomModel) {
var axisProxy = dataZoomModel.getAxisProxy(dimNames.name, axisIndex);
seriesModels = seriesModels.concat(axisProxy.getTargetSeriesModels());
});
});
return seriesModels;
},
overallReset: function (ecModel, api) {
ecModel.eachComponent('dataZoom', function (dataZoomModel) {
// We calculate window and reset axis here but not in model
// init stage and not after action dispatch handler, because
// reset should be called after seriesData.restoreData.
dataZoomModel.eachTargetAxis(resetSingleAxis);
ecModel.eachComponent('dataZoom', function (dataZoomModel) {
// We calculate window and reset axis here but not in model
// init stage and not after action dispatch handler, because
// reset should be called after seriesData.restoreData.
dataZoomModel.eachTargetAxis(resetSingleAxis);
// Caution: data zoom filtering is order sensitive when using
// percent range and no min/max/scale set on axis.
// For example, we have dataZoom definition:
// [
// {xAxisIndex: 0, start: 30, end: 70},
// {yAxisIndex: 0, start: 20, end: 80}
// ]
// In this case, [20, 80] of y-dataZoom should be based on data
// that have filtered by x-dataZoom using range of [30, 70],
// but should not be based on full raw data. Thus sliding
// x-dataZoom will change both ranges of xAxis and yAxis,
// while sliding y-dataZoom will only change the range of yAxis.
// So we should filter x-axis after reset x-axis immediately,
// and then reset y-axis and filter y-axis.
dataZoomModel.eachTargetAxis(filterSingleAxis);
});
// Caution: data zoom filtering is order sensitive when using
// percent range and no min/max/scale set on axis.
// For example, we have dataZoom definition:
// [
// {xAxisIndex: 0, start: 30, end: 70},
// {yAxisIndex: 0, start: 20, end: 80}
// ]
// In this case, [20, 80] of y-dataZoom should be based on data
// that have filtered by x-dataZoom using range of [30, 70],
// but should not be based on full raw data. Thus sliding
// x-dataZoom will change both ranges of xAxis and yAxis,
// while sliding y-dataZoom will only change the range of yAxis.
// So we should filter x-axis after reset x-axis immediately,
// and then reset y-axis and filter y-axis.
dataZoomModel.eachTargetAxis(filterSingleAxis);
});
function resetSingleAxis(dimNames, axisIndex, dataZoomModel) {
dataZoomModel.getAxisProxy(dimNames.name, axisIndex).reset(dataZoomModel, api);
}
function resetSingleAxis(dimNames, axisIndex, dataZoomModel) {
dataZoomModel.getAxisProxy(dimNames.name, axisIndex).reset(dataZoomModel, api);
}
function filterSingleAxis(dimNames, axisIndex, dataZoomModel) {
dataZoomModel.getAxisProxy(dimNames.name, axisIndex).filterData(dataZoomModel, api);
function filterSingleAxis(dimNames, axisIndex, dataZoomModel) {
dataZoomModel.getAxisProxy(dimNames.name, axisIndex).filterData(dataZoomModel, api);
}
}
});
......
......@@ -1068,7 +1068,7 @@ listProto.filterSelf = function (dimensions, cb, stack, context) {
};
/**
* Select data in range.
* Select data in range. (For optimization of filter)
*/
listProto.selectRange = function (range, stack) {
'use strict';
......@@ -1077,7 +1077,9 @@ listProto.selectRange = function (range, stack) {
var dimensions = [];
for (var dim in range) {
dimensions.push(dim);
if (range.hasOwnProperty(dim)) {
dimensions.push(dim);
}
}
var dimSize = dimensions.length;
if (!dimSize) {
......
......@@ -126,7 +126,7 @@ proto.prepareView = function (view, model, ecModel, api) {
proto.performDataProcessorTasks = function (stageHandlers, ecModel, payload) {
// performStageTasks(this, stageHandlers, ecModel, payload, {block: true});
performStageTasks(this, stageHandlers, ecModel, payload);
performStageTasks(this, stageHandlers, ecModel, payload, {block: true});
};
// opt
......@@ -250,7 +250,8 @@ function createSeriesStageTask(scheduler, stageHandler, stageHandlerRecord, ecMo
function createOverallStageTask(scheduler, stageHandler, stageHandlerRecord, ecModel, api) {
var overallTask = stageHandlerRecord.overallTask = stageHandlerRecord.overallTask
|| createTask(
{plan: overallTaskPlan, reset: overallTaskReset},
// For overall task, the function only be called on reset stage.
{reset: overallTaskReset},
{ecModel: ecModel, api: api, overallReset: stageHandler.overallReset}
);
......@@ -259,11 +260,21 @@ function createOverallStageTask(scheduler, stageHandler, stageHandlerRecord, ecM
// Reuse orignal stubs.
var stubs = overallTask.agentStubs = overallTask.agentStubs || [];
var stubIndex = 0;
// If no series type detected, we do not set overallTask block. Otherwise the
// progressive rendering of all pipelines will be disabled unexpectedly.
// Moreover, it is not necessary to add stub to pipeline in the case.
// If no seriesType detected and no getTargetSeries method, we do not set
// overallTask block. Otherwise the progressive rendering of all pipelines
// will be disabled unexpectedly. Moreover, it is not necessary to add stub
// to pipeline in the case.
var seriesType = stageHandler.seriesType;
seriesType && ecModel.eachRawSeriesByType(seriesType, function (seriesModel) {
var getTargetSeries = stageHandler.getTargetSeries;
if (seriesType) {
ecModel.eachRawSeriesByType(seriesType, createStub);
}
else if (getTargetSeries) {
each(getTargetSeries(ecModel, api), createStub);
}
function createStub(seriesModel) {
var stub = stubs[stubIndex] = stubs[stubIndex] || createTask(
{plan: prepareData, reset: pullData}, {model: seriesModel}
);
......@@ -273,7 +284,8 @@ function createOverallStageTask(scheduler, stageHandler, stageHandlerRecord, ecM
// ???! sequence of call should be caution (when to set dirty), so move it to task.js?
pipe(scheduler, seriesModel, stub);
});
}
stubs.length = stubIndex;
}
......
......@@ -124,8 +124,6 @@ function reset(taskIns) {
var downstream = taskIns._downstream;
downstream && downstream.dirty();
// FIXME
taskIns.agent && taskIns.agent.dirty();
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册