MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / mergeOption

Function mergeOption

libs/echarts/echarts-en.simple.js:22496–22522  ·  view source on GitHub ↗

* Consider case: * `chart.setOption(opt1);` * Then user do some interaction like dataZoom, dataView changing. * `chart.setOption(opt2);` * Then user press 'reset button' in toolbox. * * After doing that all of the interaction effects should be reset, the * chart should be the same as the resu

(oldOption, newOption)

Source from the content-addressed store, hash-verified

22494 * 2. Use a shadow ecModel. (Performace expensive)
22495 */
22496function mergeOption(oldOption, newOption) {
22497 newOption = newOption || {};
22498
22499 each$4(newOption, function (newCptOpt, mainType) {
22500 if (newCptOpt == null) {
22501 return;
22502 }
22503
22504 var oldCptOpt = oldOption[mainType];
22505
22506 if (!ComponentModel.hasClass(mainType)) {
22507 oldOption[mainType] = merge$1(oldCptOpt, newCptOpt, true);
22508 }
22509 else {
22510 newCptOpt = normalizeToArray(newCptOpt);
22511 oldCptOpt = normalizeToArray(oldCptOpt);
22512
22513 var mapResult = mappingToExists(oldCptOpt, newCptOpt);
22514
22515 oldOption[mainType] = map$1(mapResult, function (item) {
22516 return (item.option && item.exist)
22517 ? merge$1(item.exist, item.option, true)
22518 : (item.exist || item.option);
22519 });
22520 }
22521 });
22522}
22523
22524/*
22525* Licensed to the Apache Software Foundation (ASF) under one

Callers 1

Calls 2

normalizeToArrayFunction · 0.70
mappingToExistsFunction · 0.70

Tested by

no test coverage detected