cione-comp-lib
Version:
`$ yarn add cione-comp-lib` 或者 `$ npm i cione-comp-lib -S`
58 lines (57 loc) • 2.25 kB
JavaScript
import { createHashMap, each } from "../../../../zrender/lib/core/util.mjs";
import { getAxisMainType } from "./helper.mjs";
import AxisProxy from "./AxisProxy.mjs";
var dataZoomProcessor = {
getTargetSeries: function(ecModel) {
function eachAxisModel(cb) {
ecModel.eachComponent("dataZoom", function(dataZoomModel) {
dataZoomModel.eachTargetAxis(function(axisDim, axisIndex) {
var axisModel = ecModel.getComponent(getAxisMainType(axisDim), axisIndex);
cb(axisDim, axisIndex, axisModel, dataZoomModel);
});
});
}
eachAxisModel(function(axisDim, axisIndex, axisModel, dataZoomModel) {
axisModel.__dzAxisProxy = null;
});
var proxyList = [];
eachAxisModel(function(axisDim, axisIndex, axisModel, dataZoomModel) {
if (!axisModel.__dzAxisProxy) {
axisModel.__dzAxisProxy = new AxisProxy(axisDim, axisIndex, dataZoomModel, ecModel);
proxyList.push(axisModel.__dzAxisProxy);
}
});
var seriesModelMap = createHashMap();
each(proxyList, function(axisProxy) {
each(axisProxy.getTargetSeriesModels(), function(seriesModel) {
seriesModelMap.set(seriesModel.uid, seriesModel);
});
});
return seriesModelMap;
},
overallReset: function(ecModel, api) {
ecModel.eachComponent("dataZoom", function(dataZoomModel) {
dataZoomModel.eachTargetAxis(function(axisDim, axisIndex) {
dataZoomModel.getAxisProxy(axisDim, axisIndex).reset(dataZoomModel);
});
dataZoomModel.eachTargetAxis(function(axisDim, axisIndex) {
dataZoomModel.getAxisProxy(axisDim, axisIndex).filterData(dataZoomModel, api);
});
});
ecModel.eachComponent("dataZoom", function(dataZoomModel) {
var axisProxy = dataZoomModel.findRepresentativeAxisProxy();
if (axisProxy) {
var percentRange = axisProxy.getDataPercentWindow();
var valueRange = axisProxy.getDataValueWindow();
dataZoomModel.setCalculatedRange({
start: percentRange[0],
end: percentRange[1],
startValue: valueRange[0],
endValue: valueRange[1]
});
}
});
}
};
var dataZoomProcessor$1 = dataZoomProcessor;
export { dataZoomProcessor$1 as default };