Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var dataNameMap = zrUtil.createHashMap();
var selectTargetList = [];
var toAppendNames = [];
for (var i = 0, len = data.count(); i < len; i++) {
var name = data.getName(i);
dataNameMap.set(name, true);
selectTargetList.push({
name: name,
value: data.get(valueDim, i),
selected: retrieveRawAttr(data, i, 'selected')
});
}
var geoSource = geoSourceManager.load(this.getMapType(), this.option.nameMap);
zrUtil.each(geoSource.regions, function (region) {
var name = region.name;
if (!dataNameMap.get(name)) {
selectTargetList.push({name: name});
toAppendNames.push(name);
}
});
this.updateSelectedMap(selectTargetList);
// Complete data with missing regions. The consequent processes (like visual
// map and render) can not be performed without a "full data". For example,
// find `dataIndex` by name.
data.appendValues([], toAppendNames);
return data;
},
}
var res = updateCenterAndZoom(
geo, payload, componentModel.get('scaleLimit')
);
componentModel.setCenter
&& componentModel.setCenter(res.center);
componentModel.setZoom
&& componentModel.setZoom(res.zoom);
// All map series with same `map` use the same geo coordinate system
// So the center and zoom must be in sync. Include the series not selected by legend
if (componentType === 'series') {
zrUtil.each(componentModel.seriesGroup, function (seriesModel) {
seriesModel.setCenter(res.center);
seriesModel.setZoom(res.zoom);
});
}
}
);
_updateElements: function (graphicModel) {
var elOptionsToUpdate = graphicModel.useElOptionsToUpdate();
if (!elOptionsToUpdate) {
return;
}
var elMap = this._elMap;
var rootGroup = this.group; // Top-down tranverse to assign graphic settings to each elements.
zrUtil.each(elOptionsToUpdate, function (elOption) {
var $action = elOption.$action;
var id = elOption.id;
var existEl = elMap.get(id);
var parentId = elOption.parentId;
var targetElParent = parentId != null ? elMap.get(parentId) : rootGroup;
var elOptionStyle = elOption.style;
if (elOption.type === 'text' && elOptionStyle) {
// In top/bottom mode, textVerticalAlign should not be used, which cause
// inaccurately locating.
if (elOption.hv && elOption.hv[1]) {
elOptionStyle.textVerticalAlign = elOptionStyle.textBaseline = null;
} // Compatible with previous setting: both support fill and textFill,
// stroke and textStroke.
function objectRowsCollectDimensions(data) {
var firstIndex = 0;
var obj;
while (firstIndex < data.length && !(obj = data[firstIndex++])) {} // jshint ignore: line
if (obj) {
var dimensions = [];
each(obj, function (value, key) {
dimensions.push(key);
});
return dimensions;
}
}
y: 0
}; /// Create axis
ecModel.eachComponent('xAxis', createAxisCreator('x'), this);
ecModel.eachComponent('yAxis', createAxisCreator('y'), this);
if (!axesCount.x || !axesCount.y) {
// Roll back when there no either x or y axis
this._axesMap = {};
this._axesList = [];
return;
}
this._axesMap = axesMap; /// Create cartesian2d
each(axesMap.x, function (xAxis, xAxisIndex) {
each(axesMap.y, function (yAxis, yAxisIndex) {
var key = 'x' + xAxisIndex + 'y' + yAxisIndex;
var cartesian = new Cartesian2D(key);
cartesian.grid = this;
cartesian.model = gridModel;
this._coordsMap[key] = cartesian;
this._coordsList.push(cartesian);
cartesian.addAxis(xAxis);
cartesian.addAxis(yAxis);
}, this);
}, this);
function createAxisCreator(axisType) {
return function (axisModel, idx) {
return;
}
var angleAxis = angleAxisModel.axis;
var polar = angleAxis.polar;
var radiusExtent = polar.getRadiusAxis().getExtent();
var ticksAngles = angleAxis.getTicksCoords();
var minorTickAngles = angleAxis.getMinorTicksCoords();
var labels = zrUtil.map(angleAxis.getViewLabels(), function (labelItem) {
var labelItem = zrUtil.clone(labelItem);
labelItem.coord = angleAxis.dataToCoord(labelItem.tickValue);
return labelItem;
});
fixAngleOverlap(labels);
fixAngleOverlap(ticksAngles);
zrUtil.each(elementList, function (name) {
if (angleAxisModel.get(name + '.show') && (!angleAxis.scale.isBlank() || name === 'axisLine')) {
this['_' + name](angleAxisModel, polar, ticksAngles, minorTickAngles, radiusExtent, labels);
}
}, this);
},
function (componentType, dependencies) {
each(componentsMap.get(componentType), function (component) {
(componentType !== 'series' || !isNotTargetSeries(component, payload))
&& component.restoreData();
});
}
);
}
fadeInItem(edge, lineOpacityPath);
fadeInItem(edge.node2, nodeOpacityPath);
});
} else if (focusNodeAdj === 'inEdges') {
zrUtil.each(node.inEdges, function (edge) {
if (edge.dataIndex < 0) {
return;
}
fadeInItem(edge, lineOpacityPath);
fadeInItem(edge.node1, nodeOpacityPath);
});
} else if (focusNodeAdj === 'allEdges') {
zrUtil.each(node.edges, function (edge) {
if (edge.dataIndex < 0) {
return;
}
fadeInItem(edge, lineOpacityPath);
fadeInItem(edge.node1, nodeOpacityPath);
fadeInItem(edge.node2, nodeOpacityPath);
});
}
}
if (edge) {
fadeInItem(edge, lineOpacityPath);
fadeInItem(edge.node1, nodeOpacityPath);
fadeInItem(edge.node2, nodeOpacityPath);
}
export default function (option, isNew) {
var brushComponents = option && option.brush;
if (!zrUtil.isArray(brushComponents)) {
brushComponents = brushComponents ? [brushComponents] : [];
}
if (!brushComponents.length) {
return;
}
var brushComponentSpecifiedBtns = [];
zrUtil.each(brushComponents, function (brushOpt) {
var tbs = brushOpt.hasOwnProperty('toolbox')
? brushOpt.toolbox : [];
if (tbs instanceof Array) {
brushComponentSpecifiedBtns = brushComponentSpecifiedBtns.concat(tbs);
}
});
var toolbox = option && option.toolbox;
if (zrUtil.isArray(toolbox)) {
toolbox = toolbox[0];
}
if (!toolbox) {
toolbox = {feature: {}};
option.toolbox = [toolbox];
function wrapEncodeDef(data) {
var encodeDef = {};
zrUtil.each(data.dimensions, function (dimName, dataDimIndex) {
var dimInfo = data.getDimensionInfo(dimName);
if (!dimInfo.isExtraCoord) {
var coordDim = dimInfo.coordDim;
var dataDims = encodeDef[coordDim] = encodeDef[coordDim] || [];
dataDims[dimInfo.coordDimIndex] = dataDimIndex;
}
});
return encodeDef;
}