Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_initializeRawData(rawData) {
const data = objectUtil.deepCopy(rawData);
const {chartType, series: seriesOption} = this.originalOptions;
if (chartType !== 'combo' && snippet.isArray(data.series)) {
const clonedSeries = data.series;
data.series = {};
data.series[chartType] = clonedSeries;
}
rawDataHandler.updateRawSeriesDataByOptions(data, seriesOption);
if (chartType === 'boxplot') {
rawDataHandler.appendOutliersToSeriesData(data);
}
return data;
}
registerYAxisDimension: function(limit, componentName, options, theme, isVertical) {
var categories, yAxisOptions;
if (limit) {
categories = [limit.min, limit.max];
} else if (predicate.isHeatmapChart(this.chartType) || !isVertical) {
categories = this.dataProcessor.getCategories(true);
} else {
return;
}
if (snippet.isArray(options)) {
yAxisOptions = (componentName === 'yAxis') ? options[0] : options[1];
} else {
yAxisOptions = options;
}
this._registerDimension(componentName, {
width: axisCalculator.calculateYAxisWidth(categories, yAxisOptions, theme)
});
},
_processCategories(type) {
const rawCategories = this.rawData.categories;
const categoriesMap = {};
if (snippet.isArray(rawCategories)) {
categoriesMap[type] = this._mapCategories(rawCategories, type);
} else if (rawCategories) {
if (rawCategories.x) {
categoriesMap.x = this._mapCategories(rawCategories.x, 'x');
}
if (rawCategories.y) {
categoriesMap.y = this._mapCategories(rawCategories.y, 'y').reverse();
}
}
return categoriesMap;
}
_copyArray: function(originalArray, copyArray) {
if (!snippet.isExisty(originalArray)) {
return false;
}
if (!snippet.isArray(originalArray)) {
originalArray = [originalArray];
}
if (!snippet.isExisty(copyArray) || !snippet.isArray(copyArray)) {
copyArray = [];
}
snippet.forEach(originalArray, function(value, index) {
copyArray[index] = value;
}, this);
return copyArray;
},
_pushSeriesData(values) {
if (this.chartType !== 'combo' && snippet.isArray(values)) {
const temp = values;
values = {};
values[this.chartType] = temp;
}
Object.entries(this.originalRawData.series).forEach(([seriesType, seriesData]) => {
this._pushValues(seriesData, values[seriesType], seriesType);
});
}
_mapCategories(categories, axisName) {
const axisType = `${axisName}Axis`;
const options = this.options[axisType] || {};
let isDateTime = false;
if (snippet.isArray(options)) {
isDateTime = options.filter(option => option.type && predicate.isDatetimeType(option.type));
} else {
isDateTime = options.type && predicate.isDatetimeType(options.type);
}
if (isDateTime) {
categories = categories.map(value => this.chageDatetypeToTimestamp(value));
} else {
categories = this._escapeCategories(categories);
}
this.categoriesIsDateTime[axisName] = isDateTime;
return categories;
}
_makeComponentOptions(options, optionKey, componentName, index) {
options = options || this.options[optionKey];
options = snippet.isArray(options) ? options[index] : options || {};
return options;
}
registerYAxisDimension(dimensionInfos) {
const {limit, options, theme, yAxisLabels, isVertical, axisName: componentName} = dimensionInfos;
const isDiverging = this.options.series && this.options.series.diverging;
let categories, yAxisOptions;
if (limit) {
categories = [limit.min, limit.max];
} else if (predicate.isHeatmapChart(this.chartType) || !isVertical) {
categories = this.dataProcessor.getCategories(true);
} else {
return;
}
if (snippet.isArray(options)) {
yAxisOptions = (componentName === 'yAxis') ? options[0] : options[1];
} else {
yAxisOptions = options;
}
this._registerDimension(componentName, {
width: axisCalculator.calculateYAxisWidth(categories, yAxisOptions, theme, yAxisLabels, isDiverging)
});
}
return this.rawSeriesData.map(rawDatum => {
const data = snippet.isArray(rawDatum) ? rawDatum : [].concat(rawDatum.data);
const items = data.map((datum, index) => (
new SeriesItemForBoxplot({
datum,
chartType,
formatFunctions,
index,
legendName: rawDatum.name
})
));
return items;
});
}