Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
each(visualMap, function (opt) {
if (!opt) {
return;
}
// rename splitList to pieces
if (has(opt, 'splitList') && !has(opt, 'pieces')) {
opt.pieces = opt.splitList;
delete opt.splitList;
}
var pieces = opt.pieces;
if (pieces && zrUtil.isArray(pieces)) {
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;
}
}
});
}
});
};
var dataTransform = function (seriesModel, item) {
var data = seriesModel.getData();
var coordSys = seriesModel.coordinateSystem;
// 1. If not specify the position with pixel directly
// 2. If `coord` is not a data array. Which uses `xAxis`,
// `yAxis` to specify the coord on each dimension
// parseFloat first because item.x and item.y can be percent string like '20%'
if (item && (isNaN(parseFloat(item.x)) || isNaN(parseFloat(item.y)))
&& !zrUtil.isArray(item.coord)
&& coordSys
) {
var axisInfo = getAxisInfo(item, data, coordSys, seriesModel);
// Clone the option
// Transform the properties xAxis, yAxis, radiusAxis, angleAxis, geoCoord to value
item = zrUtil.clone(item);
if (item.type
&& markerTypeCalculator[item.type]
&& axisInfo.baseAxis && axisInfo.valueAxis
) {
var dims = coordSys.dimensions;
var baseCoordIndex = indexOf(dims, axisInfo.baseAxis.dim);
var valueCoordIndex = indexOf(dims, axisInfo.valueAxis.dim);
function updatePosition(positionExpr, x, y, content, params, el, api) {
var viewWidth = api.getWidth();
var viewHeight = api.getHeight();
var rect = el && el.getBoundingRect().clone();
el && el.transform && rect.applyTransform(el.transform);
if (typeof positionExpr === 'function') {
// Callback of position can be an array or a string specify the positiont
var positionExpr = positionExpr([x, y], params, rect);
}
if (zrUtil.isArray(positionExpr)) {
x = parsePercent(positionExpr[0], viewWidth);
y = parsePercent(positionExpr[1], viewHeight);
}
// Specify tooltip position by string 'top' 'bottom' 'left' 'right' around graphic element
else if (typeof positionExpr === 'string' && el) {
var pos = calcTooltipPosition(
positionExpr, rect, content.el
);
x = pos[0];
y = pos[1];
}
else {
var pos = refixTooltipPosition(
x, y, content.el, viewWidth, viewHeight
);
x = pos[0];
_resetRange: function () {
var dataExtent = this.getExtent();
var range = this.option.range;
if (!range || range.auto) {
// `range` should always be array (so we dont use other
// value like 'auto') for user-friend. (consider getOption).
dataExtent.auto = 1;
this.option.range = dataExtent;
}
else if (zrUtil.isArray(range)) {
if (range[0] > range[1]) {
range.reverse();
}
range[0] = Math.max(range[0], dataExtent[0]);
range[1] = Math.min(range[1], dataExtent[1]);
}
},
each(seriesModels, function (seriesModel) {
var boxWidthBound = seriesModel.get('boxWidth');
if (!zrUtil.isArray(boxWidthBound)) {
boxWidthBound = [boxWidthBound, boxWidthBound];
}
boundList.push([
parsePercent(boxWidthBound[0], bandWidth) || 0,
parsePercent(boxWidthBound[1], bandWidth) || 0
]);
});
function createSymbol(data, idx) {
var color = data.getItemVisual(idx, 'color');
var symbolType = data.getItemVisual(idx, 'symbol');
var symbolSize = data.getItemVisual(idx, 'symbolSize');
if (symbolType === 'none') {
return;
}
if (!zrUtil.isArray(symbolSize)) {
symbolSize = [symbolSize, symbolSize];
}
var symbolPath = symbolUtil.createSymbol(
symbolType, -symbolSize[0] / 2, -symbolSize[1] / 2,
symbolSize[0], symbolSize[1], color
);
return symbolPath;
}
if (!indicatorAxes.length) {
return;
}
var shape = radarModel.get('shape');
var splitLineModel = radarModel.getModel('splitLine');
var splitAreaModel = radarModel.getModel('splitArea');
var lineStyleModel = splitLineModel.getModel('lineStyle');
var areaStyleModel = splitAreaModel.getModel('areaStyle');
var showSplitLine = splitLineModel.get('show');
var showSplitArea = splitAreaModel.get('show');
var splitLineColors = lineStyleModel.get('color');
var splitAreaColors = areaStyleModel.get('color');
splitLineColors = zrUtil.isArray(splitLineColors) ? splitLineColors : [splitLineColors];
splitAreaColors = zrUtil.isArray(splitAreaColors) ? splitAreaColors : [splitAreaColors];
var splitLines = [];
var splitAreas = [];
function getColorIndex(areaOrLine, areaOrLineColorList, idx) {
var colorIndex = idx % areaOrLineColorList.length;
areaOrLine[colorIndex] = areaOrLine[colorIndex] || [];
return colorIndex;
}
if (shape === 'circle') {
var ticksRadius = indicatorAxes[0].getTicksCoords();
var cx = radar.cx;
var cy = radar.cy;
for (var i = 0; i < ticksRadius.length; i++) {
if (showSplitLine) {
formatValueText: function(value, isCategory) {
var option = this.option;
var precision = option.precision;
var dataBound = this.dataBound;
var formatter = option.formatter;
var isMinMax;
var textValue;
if (zrUtil.isArray(value)) {
value = value.slice();
isMinMax = true;
}
textValue = isCategory
? value
: (isMinMax
? [toFixed(value[0]), toFixed(value[1])]
: toFixed(value)
);
if (zrUtil.isString(formatter)) {
return formatter
.replace('{value}', isMinMax ? textValue[0] : textValue)
.replace('{value2}', isMinMax ? textValue[1] : textValue);
}
zrUtil.each(dataNode.children, function (child) {
completeTreeValue(child, arrValueLength);
var childValue = child.value;
zrUtil.isArray(childValue) && (childValue = childValue[0]);
sum += childValue;
});
zrUtil.each(polarOptArr, function (polarOpt, idx) {
if (polarOpt.indicator) {
if (polarOpt.type && !polarOpt.shape) {
polarOpt.shape = polarOpt.type;
}
option.radar = option.radar || [];
if (!zrUtil.isArray(option.radar)) {
option.radar = [option.radar];
}
option.radar.push(polarOpt);
}
else {
polarNotRadar.push(polarOpt);
}
});
option.polar = polarNotRadar;