in src/core/echarts.ts [1551:1651]
updateDirectly = function (
ecIns: ECharts,
method: string,
payload: Payload,
mainType: ComponentMainType,
subType?: ComponentSubType
): void {
const ecModel = ecIns._model;
ecModel.setUpdatePayload(payload);
// broadcast
if (!mainType) {
// FIXME
// Chart will not be update directly here, except set dirty.
// But there is no such scenario now.
each([].concat(ecIns._componentsViews).concat(ecIns._chartsViews), callView);
return;
}
const query: QueryConditionKindA['query'] = {};
query[mainType + 'Id'] = payload[mainType + 'Id'];
query[mainType + 'Index'] = payload[mainType + 'Index'];
query[mainType + 'Name'] = payload[mainType + 'Name'];
const condition = {mainType: mainType, query: query} as QueryConditionKindA;
subType && (condition.subType = subType); // subType may be '' by parseClassType;
const excludeSeriesId = payload.excludeSeriesId;
let excludeSeriesIdMap: HashMap<true, string>;
if (excludeSeriesId != null) {
excludeSeriesIdMap = createHashMap();
each(modelUtil.normalizeToArray(excludeSeriesId), id => {
const modelId = modelUtil.convertOptionIdName(id, null);
if (modelId != null) {
excludeSeriesIdMap.set(modelId, true);
}
});
}
// If dispatchAction before setOption, do nothing.
ecModel && ecModel.eachComponent(condition, function (model) {
const isExcluded = excludeSeriesIdMap && excludeSeriesIdMap.get(model.id) != null;
if (isExcluded) {
return;
};
if (isHighDownPayload(payload)) {
if (model instanceof SeriesModel) {
if (
payload.type === HIGHLIGHT_ACTION_TYPE
&& !payload.notBlur && !model.get(['emphasis', 'disabled'])
) {
blurSeriesFromHighlightPayload(model, payload, ecIns._api);
}
}
else {
const { focusSelf, dispatchers } = findComponentHighDownDispatchers(
model.mainType, model.componentIndex, payload.name, ecIns._api
);
if (payload.type === HIGHLIGHT_ACTION_TYPE && focusSelf && !payload.notBlur) {
blurComponent(model.mainType, model.componentIndex, ecIns._api);
}
// PENDING:
// Whether to put this "enter emphasis" code in `ComponentView`,
// which will be the same as `ChartView` but might be not necessary
// and will be far from this logic.
if (dispatchers) {
each(dispatchers, dispatcher => {
payload.type === HIGHLIGHT_ACTION_TYPE
? enterEmphasis(dispatcher)
: leaveEmphasis(dispatcher);
});
}
}
}
else if (isSelectChangePayload(payload)) {
// TODO geo
if (model instanceof SeriesModel) {
toggleSelectionFromPayload(model, payload, ecIns._api);
updateSeriesElementSelection(model);
markStatusToUpdate(ecIns);
}
}
}, ecIns);
ecModel && ecModel.eachComponent(condition, function (model) {
const isExcluded = excludeSeriesIdMap && excludeSeriesIdMap.get(model.id) != null;
if (isExcluded) {
return;
};
callView(ecIns[
mainType === 'series' ? '_chartsMap' : '_componentsMap'
][model.__viewId]);
}, ecIns);
function callView(view: ComponentView | ChartView) {
view && view.__alive && (view as any)[method] && (view as any)[method](
view.__model, ecModel, ecIns._api, payload
);
}
};