Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function _createNewCell(rowData, rowIndex, colIndex, prevCell) {
const cellData = rowData[colIndex];
let newCell;
if (util.isExisty(cellData.colMergeWith)) {
const {colMergeWith} = cellData;
const merger = rowData[colMergeWith];
const lastMergedCellIndex = colMergeWith + merger.colspan - 1;
if (util.isExisty(merger.rowMergeWith) && prevCell) {
newCell = util.extend({}, prevCell);
} else if (lastMergedCellIndex > colIndex) {
merger.colspan += 1;
newCell = util.extend({}, cellData);
}
} else if (cellData.colspan > 1) {
cellData.colspan += 1;
newCell = _createColMergedCell(colIndex, cellData.nodeName);
}
if (!newCell) {
newCell = dataHandler.createBasicCell(rowIndex, colIndex + 1, cellData.nodeName);
}
return newCell;
}
getCategories(isVertical) {
const type = isVertical ? 'y' : 'x';
let foundCategories = [];
if (!this.categoriesMap) {
this.categoriesMap = this._processCategories(type);
}
if (snippet.isExisty(isVertical)) {
foundCategories = this.categoriesMap[type] || [];
} else {
Object.values(this.categoriesMap).every(categories => {
foundCategories = categories;
return false;
});
}
return foundCategories;
}
addRatio(valueType, divNumber, subNumber) {
if (!snippet.isExisty(this.ratioMap[valueType]) && divNumber) {
this.ratioMap[valueType] = (this[valueType] - subNumber) / divNumber;
}
}
seriesGroup.map(({start, startLabel, endLabel}) => {
const label = {
end: this.decorateLabel(endLabel)
};
if (snippet.isExisty(start)) {
label.start = this.decorateLabel(startLabel);
}
return label;
})
));
_getTemplate: function(keyGroup, key) {
var template;
if (keyGroup === 'blank') {
template = this._template.blank;
} else {
template = this._template[key] || this._template.key;
}
if (snippet.isExisty(key)) {
template = template.replace(/{KEY}/g, key);
}
return template;
},
util.range(startColIndex, endColIndex + 1).forEach(colIndex => {
const cellData = rowData [colIndex];
if (util.isExisty(cellData.colMergeWith)) {
const merger = rowData [cellData.colMergeWith];
if (merger.colspan) {
merger.colspan -= 1;
}
} else if (cellData.colspan > 1) {
const lastMergedCellIndex = colIndex + cellData.colspan - 1;
cellData.colspan -= (endColIndex - colIndex + 1);
if (lastMergedCellIndex > endColIndex) {
rowData [endColIndex + 1] = util.extend({}, cellData);
}
}
});
});
onClickSeries(position) {
const sectorInfo = this._executeGraphRenderer(position, 'findSectorInfo');
const prevIndex = this.prevClickedIndex;
const {allowSelect} = this.options;
if ((sectorInfo || this._isDetectedLabel(position)) && snippet.isExisty(prevIndex) && allowSelect) {
this.onUnselectSeries({
indexes: {
index: prevIndex
}
});
this.prevClickedIndex = null;
}
if (!sectorInfo || sectorInfo.chartType !== this.seriesType) {
return;
}
const foundIndex = sectorInfo.index;
const shouldSelect = foundIndex > -1 && (foundIndex !== prevIndex);
if (allowSelect && !shouldSelect) {
function _get2DArrayFromRawData(rawData) {
const resultArray = [];
const isHeatMap = (rawData.categories && snippet.isExisty(rawData.categories.x));
const isBullet = (rawData.series && snippet.isExisty(rawData.series.bullet));
let return2DArrayData = false;
if (rawData) {
let categories;
if (isHeatMap) {
return2DArrayData = _get2DArrayFromHeatmapRawData(rawData);
} else if (isBullet) {
return2DArrayData = _get2DArrayFromBulletRawData(rawData);
} else if (rawData.categories) {
({categories} = rawData);
}
if (return2DArrayData) {
return return2DArrayData;
}
isLineCoordinateType() {
let {lineCoordinateType} = this;
if (!snippet.isExisty(lineCoordinateType)) {
const {chartType} = this;
lineCoordinateType = predicate.isLineTypeChart(chartType) && !this.hasCategories();
this.lineCoordinateType = lineCoordinateType;
}
return lineCoordinateType;
}