Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this._setDataForRendering(data);
this._clearSeriesContainer();
this._renderSeriesArea(data.paper, snippet.bind(this._renderGraph, this));
if (this.labelShowEffector) {
clearInterval(this.labelShowEffector.timerId);
}
// if rerender have excuted in the middle of animate,
// we should rerun animate
if (checkedLegends || !this.isInitRenderCompleted) {
this.animateComponent(true);
}
if (!snippet.isNull(this.selectedLegendIndex)) {
this.graphRenderer.selectLegend(this.selectedLegendIndex);
}
} else {
this._clearSeriesContainer();
}
}
rawSeriesData.forEach((datum, index) => {
const id = idPrefix + index;
const {children} = datum;
const indexes = ancestorIndexes.concat(index);
datum.indexes = indexes;
if (!snippet.isNull(datum.value)) {
flatData.push(datum);
}
if (!datum.id) {
datum.id = id;
}
if (!datum.parent) {
datum.parent = parent;
}
if (children) {
flatData = flatData.concat(this._flattenHierarchicalData(children, id, indexes));
delete datum.children;
}
});
_getIndexesCustomAttribute(elTooltip) {
const groupIndex = elTooltip.getAttribute('data-groupIndex');
const index = elTooltip.getAttribute('data-index');
let indexes = null;
if (!snippet.isNull(groupIndex) && !snippet.isNull(index)) {
indexes = {
groupIndex: parseInt(groupIndex, 10),
index: parseInt(index, 10)
};
}
return indexes;
},
_showTooltip(elTooltip, params, prevPosition) {
if (!snippet.isNull(this.prevIndex)) {
this.eventBus.fire('hideGroupAnimation', this.prevIndex);
}
elTooltip.innerHTML = this._makeGroupTooltipHtml(params.index);
this._fireBeforeShowTooltipPublicEvent(params.index, params.range, params.silent);
if (document.getElementsByClassName) {
this.makeLineLegendIcon(elTooltip.querySelectorAll('.tui-chart-legend-rect.line'));
}
dom.addClass(elTooltip, 'show');
this._showTooltipSector(params.size, params.range, params.isVertical, params.index, params.isMoving);
const dimension = this.getTooltipDimension(elTooltip);
selectLegend(legendIndex) {
const noneSelected = snippet.isNull(legendIndex);
this.selectedLegendIndex = legendIndex;
this.groupLines.forEach((line, groupIndex) => {
const opacity = (noneSelected || legendIndex === groupIndex) ? EMPHASIS_OPACITY : DE_EMPHASIS_OPACITY;
line.attr({'stroke-opacity': opacity});
});
}
}
_createOptionalLinePositionWhenLabelAxis(width, xAxisData, value) {
const {dataProcessor} = this;
const isLineTypeChart = predicate.isLineTypeChart(dataProcessor.chartType, dataProcessor.seriesTypes);
const isPointOnColumn = isLineTypeChart && xAxisData.options.pointOnColumn;
const index = dataProcessor.findCategoryIndex(value);
const halfLabelDistance = this._calculateXAxisLabelDistance(width, xAxisData) / 2;
let position = null;
let ratio;
if (!snippet.isNull(index)) {
const categoryCount = dataProcessor.getCategoryCount();
const divCount = isPointOnColumn ? categoryCount : categoryCount - 1;
ratio = (index === 0) ? 0 : (index / divCount);
position = ratio * width;
if (isPointOnColumn) {
position += halfLabelDistance;
}
}
if (ratio === 1) {
position -= 1;
}
return position;
_selectLegend(index) {
const data = this.legendModel.getDatum(index);
this.legendModel.toggleSelectedIndex(index);
if (!snippet.isNull(this.legendModel.getSelectedIndex()) && !this.legendModel.isCheckedSelectedIndex()) {
this.legendModel.checkSelectedIndex();
this._fireChangeCheckedLegendsEvent();
}
this.dataProcessor.selectLegendIndex = this.legendModel.getSelectedIndex();
this.graphRenderer.selectLegend(this.dataProcessor.selectLegendIndex, this.legendSet);
this._fireSelectLegendEvent(data);
this._fireSelectLegendPublicEvent(data);
}
_updateLineStrokeOpacity(changeType, line) {
let opacity = 1;
const isSelectedLegend = !snippet.isNull(this.selectedLegendIndex);
if (this.groupLines) {
if (changeType === CHART_HOVER_STATUS_OVER || isSelectedLegend) {
opacity = (this.chartType === 'radial' && this.showArea) ? 0 : DE_EMPHASIS_OPACITY;
}
if (changeType === CHART_HOVER_STATUS_OUT && isSelectedLegend) {
line = this.getLine(this.selectedLegendIndex);
}
this.groupLines.forEach(otherLine => {
otherLine.attr({
'stroke-opacity': opacity
});
});
line.attr({
'stroke-opacity': 1
seriesGroup.map(seriesItem => {
let position;
if (!snippet.isNull(seriesItem.end)) {
position = {
left: baseLeft + (seriesItem.ratioMap.x * width) + additionalLeft,
top: baseTop + height - (seriesItem.ratioMap.y * height)
};
if (snippet.isExisty(seriesItem.ratioMap.start)) {
position.startTop =
height - (seriesItem.ratioMap.start * height) + chartConst.SERIES_EXPAND_SIZE;
}
}
return position;
})
), true);