Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return zrUtil.map(newData, function (newVal, idx) {
var original = originalData && originalData[idx];
if (zrUtil.isObject(original) && !zrUtil.isArray(original)) {
if (zrUtil.isObject(newVal) && !zrUtil.isArray(newVal)) {
newVal = newVal.value;
} // Original data has option
return zrUtil.defaults({
value: newVal
}, original);
} else {
return newVal;
}
});
}
var splitLines = [];
for (var i = 0; i < ticksAngles.length; i++) {
var colorIndex = (lineCount++) % lineColors.length;
splitLines[colorIndex] = splitLines[colorIndex] || [];
splitLines[colorIndex].push(new graphic.Line({
shape: getAxisLineShape(polar, radiusExtent, ticksAngles[i].coord)
}));
}
// Simple optimization
// Batching the lines if color are the same
for (var i = 0; i < splitLines.length; i++) {
this.group.add(graphic.mergePath(splitLines[i], {
style: zrUtil.defaults({
stroke: lineColors[i % lineColors.length]
}, lineStyleModel.getLineStyle()),
silent: true,
z: angleAxisModel.get('z')
}));
}
},
return zrUtil.map(newData, function (newVal, idx) {
var original = originalData && originalData[idx];
if (zrUtil.isObject(original) && !zrUtil.isArray(original)) {
if (zrUtil.isObject(newVal) && !zrUtil.isArray(newVal)) {
newVal = newVal.value;
}
// Original data has option
return zrUtil.defaults({
value: newVal
}, original);
}
else {
return newVal;
}
});
}
var generateNewSeriesTypes = function (seriesModel) {
var seriesType = seriesModel.subType;
var seriesId = seriesModel.id;
var newSeriesOpt = seriesOptGenreator[type](seriesType, seriesId, seriesModel, model);
if (newSeriesOpt) {
// PENDING If merge original option?
zrUtil.defaults(newSeriesOpt, seriesModel.option);
newOption.series.push(newSeriesOpt);
} // Modify boundaryGap
var coordSys = seriesModel.coordinateSystem;
if (coordSys && coordSys.type === 'cartesian2d' && (type === 'line' || type === 'bar')) {
var categoryAxis = coordSys.getAxesByScale('ordinal')[0];
if (categoryAxis) {
var axisDim = categoryAxis.dim;
var axisType = axisDim + 'Axis';
var axisModel = ecModel.queryComponents({
mainType: axisType,
index: seriesModel.get(name + 'Index'),
id: seriesModel.get(name + 'Id')
areaPoints.push([thisCoord, 0]);
linePoints.push([thisCoord, 0]);
}
areaPoints.push([thisCoord, otherCoord]);
linePoints.push([thisCoord, otherCoord]);
thisCoord += step;
lastIsEmpty = isEmpty;
});
var dataZoomModel = this.dataZoomModel; // var dataBackgroundModel = dataZoomModel.getModel('dataBackground');
this._displayables.barGroup.add(new graphic.Polygon({
shape: {
points: areaPoints
},
style: zrUtil.defaults({
fill: dataZoomModel.get('dataBackgroundColor')
}, dataZoomModel.getModel('dataBackground.areaStyle').getAreaStyle()),
silent: true,
z2: -20
}));
this._displayables.barGroup.add(new graphic.Polyline({
shape: {
points: linePoints
},
style: dataZoomModel.getModel('dataBackground.lineStyle').getLineStyle(),
silent: true,
z2: -19
}));
},
_prepareDataShadowInfo: function () {
var indicatorModels = zrUtil.map(this.get('indicator') || [], function (indicatorOpt) {
// PENDING
if (indicatorOpt.max != null && indicatorOpt.max > 0 && !indicatorOpt.min) {
indicatorOpt.min = 0;
}
else if (indicatorOpt.min != null && indicatorOpt.min < 0 && !indicatorOpt.max) {
indicatorOpt.max = 0;
}
var iNameTextStyle = nameTextStyle;
if (indicatorOpt.color != null) {
iNameTextStyle = zrUtil.defaults({color: indicatorOpt.color}, nameTextStyle);
}
// Use same configuration
indicatorOpt = zrUtil.merge(zrUtil.clone(indicatorOpt), {
boundaryGap: boundaryGap,
splitNumber: splitNumber,
scale: scale,
axisLine: axisLine,
axisTick: axisTick,
axisLabel: axisLabel,
// Competitable with 2 and use text
name: indicatorOpt.text,
nameLocation: 'end',
nameGap: nameGap,
// min: 0,
nameTextStyle: iNameTextStyle,
triggerEvent: triggerEvent
var AxisBuilder = function (axisModel, opt) {
/**
* @readOnly
*/
this.opt = opt;
/**
* @readOnly
*/
this.axisModel = axisModel;
// Default value
defaults(
opt,
{
labelOffset: 0,
nameDirection: 1,
tickDirection: 1,
labelDirection: 1,
silent: true
}
);
/**
* @readOnly
*/
this.group = new graphic.Group();
// FIXME Not use a seperate text group?
var tickLen = (tickModel.get('inside') ? -1 : 1) * minorTickModel.get('length');
var radius = radiusExtent[getRadiusIdx(polar)];
var lines = [];
for (var i = 0; i < minorTickAngles.length; i++) {
for (let k = 0; k < minorTickAngles[i].length; k++) {
lines.push(new graphic.Line({
shape: getAxisLineShape(polar, [radius, radius + tickLen], minorTickAngles[i][k].coord)
}));
}
}
this.group.add(graphic.mergePath(
lines, {
style: zrUtil.defaults(
minorTickModel.getModel('lineStyle').getLineStyle(),
zrUtil.defaults(
tickModel.getLineStyle(), {
stroke: angleAxisModel.get('axisLine.lineStyle.color')
}
)
)
}
));
},
var lines = [];
for (var i = 0; i < minorTickAngles.length; i++) {
for (let k = 0; k < minorTickAngles[i].length; k++) {
lines.push(new graphic.Line({
shape: getAxisLineShape(polar, [radius, radius + tickLen], minorTickAngles[i][k].coord)
}));
}
}
this.group.add(graphic.mergePath(
lines, {
style: zrUtil.defaults(
minorTickModel.getModel('lineStyle').getLineStyle(),
zrUtil.defaults(
tickModel.getLineStyle(), {
stroke: angleAxisModel.get('axisLine.lineStyle.color')
}
)
)
}
));
},
var tickModel = angleAxisModel.getModel('axisTick');
var minorTickModel = angleAxisModel.getModel('minorTick');
var tickLen = (tickModel.get('inside') ? -1 : 1) * minorTickModel.get('length');
var radius = radiusExtent[getRadiusIdx(polar)];
var lines = [];
for (var i = 0; i < minorTickAngles.length; i++) {
for (var k = 0; k < minorTickAngles[i].length; k++) {
lines.push(new graphic.Line({
shape: getAxisLineShape(polar, [radius, radius + tickLen], minorTickAngles[i][k].coord)
}));
}
}
this.group.add(graphic.mergePath(lines, {
style: zrUtil.defaults(minorTickModel.getModel('lineStyle').getLineStyle(), zrUtil.defaults(tickModel.getLineStyle(), {
stroke: angleAxisModel.get('axisLine.lineStyle.color')
}))
}));
},