Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
each(dataDims, function (resultDimIdx, coordDimIndex) {
var resultItem = result[resultDimIdx];
applyDim(defaults(resultItem, sysDimItem), coordDim, coordDimIndex);
if (resultItem.name == null && sysDimItemDimsDef) {
var sysDimItemDimsDefItem = sysDimItemDimsDef[coordDimIndex];
!isObject(sysDimItemDimsDefItem) && (sysDimItemDimsDefItem = {name: sysDimItemDimsDefItem});
resultItem.name = resultItem.displayName = sysDimItemDimsDefItem.name;
resultItem.defaultTooltip = sysDimItemDimsDefItem.defaultTooltip;
}
// FIXME refactor, currently only used in case: {otherDims: {tooltip: false}}
sysDimItemOtherDims && defaults(resultItem.otherDims, sysDimItemOtherDims);
});
});
function completeDimensions(sysDims, source, opt) {
if (!Source.isInstance(source)) {
source = Source.seriesDataToSource(source);
}
opt = opt || {};
sysDims = (sysDims || []).slice();
var dimsDef = (opt.dimsDef || []).slice();
var dataDimNameMap = createHashMap();
var coordDimNameMap = createHashMap(); // var valueCandidate;
var result = [];
var dimCount = getDimCount(source, sysDims, dimsDef, opt.dimCount); // Apply user defined dims (`name` and `type`) and init result.
for (var i = 0; i < dimCount; i++) {
var dimDefItem = dimsDef[i] = extend({}, isObject(dimsDef[i]) ? dimsDef[i] : {
name: dimsDef[i]
});
var userDimName = dimDefItem.name;
var resultItem = result[i] = new DataDimensionInfo(); // Name will be applied later for avoiding duplication.
if (userDimName != null && dataDimNameMap.get(userDimName) == null) {
// Only if `series.dimensions` is defined in option
// displayName, will be set, and dimension will be diplayed vertically in
// tooltip by default.
resultItem.name = resultItem.displayName = userDimName;
dataDimNameMap.set(userDimName, i);
}
dimDefItem.type != null && (resultItem.type = dimDefItem.type);
dimDefItem.displayName != null && (resultItem.displayName = dimDefItem.displayName);
}
each(dimensionsDefine, function (dim, idx) {
if ((isObject(dim) ? dim.name : dim) === 'name') {
potentialNameDimIndex = idx;
}
});
} // idxResult: {v, n}.
each(mapResult, function (item, index) {
var opt = item.option;
if (isObject(opt)) {
item.keyInfo.mainType = mainType;
item.keyInfo.subType = determineSubType(mainType, opt, item.exist);
}
});
zrUtil.each(axes, function (axisOption) {
if (!zrUtil.isObject(axisOption)) {
return;
}
var parallelIndex = axisOption.parallelIndex || 0;
var parallelOption = modelUtil.normalizeToArray(option.parallel)[parallelIndex];
if (parallelOption && parallelOption.parallelAxisDefault) {
zrUtil.merge(axisOption, parallelOption.parallelAxisDefault, false);
}
});
}
zrUtil.each(axes, function (axisOption) {
if (!zrUtil.isObject(axisOption)) {
return;
}
var parallelIndex = axisOption.parallelIndex || 0;
var parallelOption = modelUtil.normalizeToArray(option.parallel)[parallelIndex];
if (parallelOption && parallelOption.parallelAxisDefault) {
zrUtil.merge(axisOption, parallelOption.parallelAxisDefault, false);
}
});
}
function getName(obj) {
if (isObject(obj) && obj.value != null) {
return obj.value;
}
else {
return obj + '';
}
}
VisualMapping.mapVisual = function (visual, callback, context) {
var isPrimary;
var newVisual = zrUtil.isArray(visual) ? [] : zrUtil.isObject(visual) ? {} : (isPrimary = true, null);
VisualMapping.eachVisual(visual, function (v, key) {
var newVal = callback.call(context, v, key);
isPrimary ? newVisual = newVal : newVisual[key] = newVal;
});
return newVisual;
};
/**
}
for (var i = 0, len = data.length; i < len; i++) {
var item = data[i];
if (item == null) {
continue;
} else if (isArray(item)) {
sourceFormat = SOURCE_FORMAT_ARRAY_ROWS;
break;
} else if (isObject(item)) {
sourceFormat = SOURCE_FORMAT_OBJECT_ROWS;
break;
}
}
} else if (isObject(data)) {
for (var key in data) {
if (data.hasOwnProperty(key) && isArrayLike(data[key])) {
sourceFormat = SOURCE_FORMAT_KEYED_COLUMNS;
break;
}
}
} else if (data != null) {
throw new Error('Invalid data');
}
inner(datasetModel).sourceFormat = sourceFormat;
}
/**
each(pieces, function (piece) {
if (zrUtil.isObject(piece)) {
if (has(piece, 'start') && !has(piece, 'min')) {
piece.min = piece.start;
}
if (has(piece, 'end') && !has(piece, 'max')) {
piece.max = piece.end;
}
}
});
}