all files / chart3d/series/ data-label.js

93.5% Statements 230/246
86.79% Branches 184/212
93.33% Functions 14/15
93.5% Lines 230/246
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390   147× 147×   299× 299× 299× 299× 1749× 1749× 1748×     299× 58×     1748× 1748× 1748× 1748× 1748× 1748× 1748× 1748× 1748× 1748× 1748× 54×     1694×   1748× 1748× 1748× 1748× 1748×           1748× 1748×         1748× 1748× 1748× 1748× 1748× 1748× 1748×   1748× 1748× 1748×             1748×   1748×   1748× 1748× 68× 68× 68× 68× 40× 10× 10× 10× 10× 10× 10× 10× 10× 16× 16× 16× 16× 16× 73× 73×   73× 23× 23× 23× 16×         16×         30×     30× 30× 30× 30× 135× 135×   135× 108×   27× 21×       40×         28×     28× 28× 28× 28× 28× 28× 28× 28× 84× 84× 84× 84×             28×       68× 68× 68× 68×     68×     68×   1748× 1388×                 1388×   1748× 1748× 1748× 1748× 1748×               1748×                         1748× 1736×     68×     68× 68× 68× 68×             68× 68× 68× 64×     64× 64× 64× 64× 64× 64×     64× 64× 64× 64× 64× 64× 64× 64× 64× 64× 64× 64× 64×         64× 64×   1748× 1748× 1748× 1748× 1748× 745×       745× 745×       1748×   477× 477× 477×         477×   478× 478× 478× 478× 478× 478× 478×   478× 478× 478× 478× 478× 478× 478×   478×               459× 459×     478× 478× 478× 478× 478× 478× 19× 19× 19×     459× 459× 459×   478×                   477× 477× 477× 477× 477× 477× 477× 477× 477× 477× 477×     477× 477× 477× 477×               477×   4351×          
define(["require", "exports", "@syncfusion/ej2-svg-base", "../../common/model/constants", "@syncfusion/ej2-base", "../../common/utils/helper"], function (require, exports, ej2_svg_base_1, constants_1, ej2_base_1, helper_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var DataLabel3D = (function () {
        function DataLabel3D(chart) {
            this.repositionedLabels = [];
            this.chart = chart;
        }
        DataLabel3D.prototype.render = function (series, chart, dataLabel) {
            var point;
            var templateId = chart.element.id + '-series-' + series.index + '-data-label-collections';
            series.dataLabelElement = ej2_base_1.createElement('div', { id: templateId });
            for (var i = 0; i < series.visiblePoints.length; i++) {
                point = series.visiblePoints[i];
                if (point.visible) {
                    this.draw3DDataLabel(series, point.index, point, chart, dataLabel);
                }
            }
            if (series.dataLabel.template) {
                helper_1.appendChildElement(false, document.getElementById(this.chart.element.id + '_Secondary_Element'), series.dataLabelElement, chart.redraw, false, 'x', 'y', null, '', false, false, null);
            }
        };
        DataLabel3D.prototype.draw3DDataLabel = function (series, pointIndex, point, chart, dataLabel) {
            var pointX;
            var pointY;
            var xOffset = 0;
            var yOffset = 0;
            var commonEventArgs = { data: null };
            var pointText = this.getLabelText(point, series, this.chart)[0];
            var textSize = ej2_svg_base_1.measureText(pointText, dataLabel.font, this.chart.themeStyle.datalabelFont);
            var location = chart.svg3DRenderer.transform3DToVisible(series, point.symbolLocations.x, point.symbolLocations.y, chart);
            pointY = location.y;
            pointX = location.x;
            if (series.dataLabel.position === 'Bottom') {
                pointY = location.y + yOffset;
            }
            else {
                pointY = location.y - yOffset;
            }
            pointX = location.x + xOffset;
            var topLeftFront = chart.svg3DRenderer.transform3DToVisible(series, point.left, point.top, chart);
            var bottomRightFront = chart.svg3DRenderer.transform3DToVisible(series, point.right, point.bottom, chart);
            var pointRegionRect = new ej2_svg_base_1.Rect(Math.min(topLeftFront.x, bottomRightFront.x), Math.min(topLeftFront.y, bottomRightFront.y), Math.abs(bottomRightFront.x - topLeftFront.x), Math.abs(bottomRightFront.y - topLeftFront.y));
            commonEventArgs.data = {
                text: pointText,
                location: { x: pointX, y: pointY },
                series: series,
                pointIndex: pointIndex
            };
            commonEventArgs.data.Text = commonEventArgs.data.text;
            var argsData = {
                cancel: false, series: series,
                point: point, text: pointText, border: dataLabel.border,
                color: dataLabel.fill, template: dataLabel.template, textStyle: dataLabel.font
            };
            chart.trigger(constants_1.textRender, argsData);
            this.fontBackground = series.dataLabel.position === 'Middle' ? argsData.color === 'transparent' ? point.color : argsData.color : argsData.color;
            commonEventArgs.data.text = argsData.text;
            var labelRect = new ej2_svg_base_1.Rect(pointX - (textSize.width / 2), pointY - (textSize.height / 2), textSize.width, textSize.height);
            var isStackingColumn = series.type === 'StackingColumn';
            var isStackingBar = series.type === 'StackingBar';
            var isLabelOutsidePointRegion = !(isStackingBar ? labelRect.x >= pointRegionRect.x && labelRect.x + labelRect.width <= pointRegionRect.x + pointRegionRect.width :
                labelRect.y >= pointRegionRect.y && labelRect.y + labelRect.height <= pointRegionRect.y + pointRegionRect.height);
            var chartBounds = new ej2_svg_base_1.Rect(0, 0, chart.element.clientWidth, chart.element.clientHeight);
            var hasCollision = false;
            for (var _i = 0, _a = this.chart.dataLabelCollections; _i < _a.length; _i++) {
                var existingRect = _a[_i];
                if (helper_1.isCollide(labelRect, [existingRect], chartBounds)) {
                    hasCollision = true;
                    break;
                }
            }
            var isRelocateAction = dataLabel.labelIntersectAction === 'RelocateVertically' ||
                dataLabel.labelIntersectAction === 'RelocateHorizontally';
            var shouldUseSmartReposition = (hasCollision || isLabelOutsidePointRegion) &&
                isRelocateAction && (isStackingColumn || isStackingBar);
            var repositionedLabelLocation = { x: pointX, y: pointY };
            if (shouldUseSmartReposition && !argsData.cancel) {
                var textPadding = 3;
                var xPos = pointX;
                var yPos = textSize.height + chart.initialClipRect.y;
                if (isStackingColumn) {
                    if (dataLabel.labelIntersectAction === 'RelocateHorizontally') {
                        var pointLeftEdgeX = pointRegionRect.x;
                        var pointRightEdgeX = pointRegionRect.x + pointRegionRect.width;
                        xPos = pointLeftEdgeX + textPadding;
                        var rowThreshold = Math.max(5, textSize.height * 0.2);
                        var needsRowCheck = true;
                        var rowCheckGuard = 0;
                        var maxRowChecks = 50;
                        while (needsRowCheck && rowCheckGuard < maxRowChecks) {
                            rowCheckGuard++;
                            needsRowCheck = false;
                            var labelYMin = yPos - textSize.height / 2;
                            var labelYMax = yPos + textSize.height / 2;
                            for (var _b = 0, _c = this.repositionedLabels; _b < _c.length; _b++) {
                                var existingRect = _c[_b];
                                var samePoint = existingRect.x >= pointLeftEdgeX - textSize.width &&
                                    existingRect.x < pointRightEdgeX;
                                if (samePoint) {
                                    var existingYMin = existingRect.y;
                                    var existingYMax = existingRect.y + existingRect.height;
                                    if ((labelYMin <= existingYMax + rowThreshold) && (labelYMax >= existingYMin - rowThreshold)) {
                                        xPos = Math.max(xPos, existingRect.x + existingRect.width + (textSize.width / 2) +
                                            dataLabel.margin.left + dataLabel.margin.right + textPadding);
                                    }
                                }
                            }
                            if (xPos > pointRightEdgeX) {
                                yPos = yPos + textSize.height + textPadding;
                                xPos = pointLeftEdgeX + (textPadding * rowCheckGuard);
                                needsRowCheck = true;
                            }
                        }
                    }
                    else {
                        var normalizedOffset = (dataLabel.smartLabelSettings && dataLabel.smartLabelSettings.offset !== undefined &&
                            dataLabel.smartLabelSettings.offset >= 0 && dataLabel.smartLabelSettings.offset <= 1
                            ? dataLabel.smartLabelSettings.offset : 0.5);
                        xPos = pointRegionRect.x + (pointRegionRect.width * normalizedOffset);
                        var columnLeftX = pointRegionRect.x;
                        var columnRightX = pointRegionRect.x + pointRegionRect.width;
                        for (var _d = 0, _e = this.repositionedLabels; _d < _e.length; _d++) {
                            var existingRect = _e[_d];
                            var inSameColumn = existingRect.x >= columnLeftX - textSize.width &&
                                existingRect.x < columnRightX;
                            if (!inSameColumn) {
                                continue;
                            }
                            if (existingRect.x < xPos + textSize.width && existingRect.x + existingRect.width > xPos - textSize.width) {
                                yPos = Math.max(yPos, existingRect.y + existingRect.height + textSize.height + (textPadding * 2));
                            }
                        }
                    }
                    Iif (yPos + labelRect.height > pointRegionRect.y && yPos < chart.initialClipRect.y + chart.initialClipRect.height) {
                        yPos = chart.initialClipRect.y + chart.initialClipRect.height + textSize.height + textPadding;
                    }
                }
                else {
                    var normalizedOffset = dataLabel.labelIntersectAction === 'RelocateHorizontally' ? 0 : (dataLabel.smartLabelSettings && dataLabel.smartLabelSettings.offset !== undefined &&
                        dataLabel.smartLabelSettings.offset >= 0 && dataLabel.smartLabelSettings.offset <= 1
                        ? dataLabel.smartLabelSettings.offset : 0.5);
                    var pointRegionCenterY = pointRegionRect.y + (pointRegionRect.height * normalizedOffset);
                    yPos = pointRegionCenterY;
                    var chartWidth = chart.initialClipRect.x + chart.initialClipRect.width;
                    xPos = this.chart.enableRtl ? (textPadding * 2) : chartWidth - (textSize.width + (textPadding * 2));
                    var labelYMin = yPos - textSize.height / 2;
                    var labelYMax = yPos + textSize.height / 2;
                    var rowThreshold = Math.max(5, textSize.height * 0.2);
                    for (var _f = 0, _g = this.repositionedLabels; _f < _g.length; _f++) {
                        var existingRect = _g[_f];
                        var existingYMin = existingRect.y;
                        var existingYMax = existingRect.y + existingRect.height;
                        if ((labelYMin <= existingYMax + rowThreshold) && (labelYMax >= existingYMin - rowThreshold)) {
                            xPos = this.chart.enableRtl ? Math.max(xPos, existingRect.x + existingRect.width + (textSize.width) + textPadding)
                                : Math.min(xPos, existingRect.x - (textSize.width) - (textPadding * 2));
                            if (dataLabel.labelIntersectAction === 'RelocateHorizontally') {
                                yPos += textPadding;
                                Iif (yPos > pointRegionRect.y + pointRegionRect.height) {
                                    yPos = pointRegionCenterY;
                                }
                            }
                        }
                    }
                    Iif ((xPos - textSize.width) < pointRegionRect.x + pointRegionRect.width && !this.chart.enableRtl) {
                        xPos = chart.initialClipRect.x - textSize.width;
                    }
                }
                repositionedLabelLocation = { x: xPos, y: yPos };
                labelRect = new ej2_svg_base_1.Rect(xPos - textSize.width / 2, yPos - textSize.height / 2, textSize.width, textSize.height);
                this.repositionedLabels.push(labelRect);
                var labelAnchor = isStackingBar
                    ? { x: labelRect.x, y: repositionedLabelLocation.y }
                    : { x: repositionedLabelLocation.x, y: labelRect.y + labelRect.height };
                var sourceAnchor = isStackingBar
                    ? { x: pointRegionRect.x + pointRegionRect.width, y: yPos }
                    : { x: xPos, y: pointRegionRect.y };
                this.drawConnectorLine(labelAnchor, sourceAnchor, series, point, dataLabel);
            }
            if (!series.dataLabel.template && commonEventArgs.data.Text !== '' && !argsData.cancel) {
                var element_1 = {
                    tag: 'dataLabel',
                    series: series,
                    point: point,
                    pointIndex: pointIndex,
                    id: chart.svgObject.id + series.index + '-data-label' + pointIndex,
                    child: chart.chart3D,
                    smartLabelSettings: shouldUseSmartReposition ? dataLabel.smartLabelSettings : null
                };
                chart.graphics.addVisual(chart.polygon.createTextElement(chart.vector.vector3D(repositionedLabelLocation.x, repositionedLabelLocation.y, point.symbolLocations.z), element_1, 0, -textSize.height), chart);
            }
            var tag = !(series.dataLabel && series.dataLabel.template) ? 'text' : 'template';
            var backgroundColor = this.fontBackground === 'transparent' ? ((this.chart.theme.indexOf('Dark') > -1 || this.chart.theme === 'HighContrast') ? '#000000' : '#FFFFFF') : this.fontBackground;
            var rgbValue = helper_1.convertHexToColor(helper_1.colorNameToHex(backgroundColor));
            var contrast = Math.round((rgbValue.r * 299 + rgbValue.g * 587 + rgbValue.b * 114) / 1000);
            var font = {
                size: argsData.textStyle.size || this.chart.themeStyle.datalabelFont.size,
                fontWeight: argsData.textStyle.fontWeight || this.chart.themeStyle.datalabelFont.fontWeight,
                fontStyle: argsData.textStyle.fontStyle || chart.themeStyle.datalabelFont.fontStyle,
                fontFamily: argsData.textStyle.fontFamily || this.chart.themeStyle.datalabelFont.fontFamily,
                color: argsData.textStyle.color || (shouldUseSmartReposition ? this.chart.themeStyle.tooltipLabelFont.color : this.chart.theme === 'Bootstrap5' ? '#212529' : this.chart.theme === 'Bootstrap5Dark' ? '#DEE2E6' : argsData.textStyle.color),
                opacity: argsData.textStyle.opacity
            };
            var element = {
                width: textSize.width,
                height: textSize.height,
                label: commonEventArgs.data,
                textAnchor: 'middle',
                tag: tag,
                font: font,
                angle: series.dataLabel.angle,
                id: chart.element.id + '-svg' + '-series-' + series.index + '-point-' + pointIndex + '-data-label',
                child: chart.chart3D,
                argsData: argsData,
                fill: (contrast >= 128) ? (this.chart.theme.indexOf('Tailwind3') > -1 ? '#111827' : '#000000') : '#FFFFFF'
            };
            if (!argsData.cancel) {
                chart.graphics.addVisual(chart.polygon.createTextElement(chart.vector.vector3D(repositionedLabelLocation.x, repositionedLabelLocation.y, point.symbolLocations.z), element, 0, -textSize.height), chart);
            }
        };
        DataLabel3D.prototype.drawConnectorLine = function (labelLocation, pointLocation, series, point, dataLabel) {
            Iif (!dataLabel.smartLabelSettings) {
                return;
            }
            var connectorStyle = dataLabel.smartLabelSettings.connectorLineStyle || {};
            var stroke = connectorStyle.color || this.chart.themeStyle.tooltipFill;
            var width = connectorStyle.width != null ? connectorStyle.width : 1;
            var connectorElement = {
                width: width,
                stroke: stroke,
                child: this.chart.chart3D,
                tag: 'line',
                id: this.chart.element.id + '-datalabel-series-' + series.index + '-connector-' + point.index
            };
            var connectorLine = this.chart.polygon.createLine(connectorElement, pointLocation.x, pointLocation.y, labelLocation.x, labelLocation.y, 0);
            this.chart.graphics.addVisual(connectorLine, this.chart);
            if (dataLabel.smartLabelSettings.pointerShape === 'Arrow') {
                this.drawArrowPointer(labelLocation, pointLocation, stroke, width, series, point);
            }
        };
        DataLabel3D.prototype.drawArrowPointer = function (labelLocation, pointLocation, stroke, width, series, point) {
            var minArrowSize = 8;
            var arrowSize = Math.max(minArrowSize, width * 4);
            var dx = pointLocation.x - labelLocation.x;
            var dy = pointLocation.y - labelLocation.y;
            var distance = Math.sqrt(dx * dx + dy * dy);
            Iif (distance === 0) {
                return;
            }
            var dirX = dx / distance;
            var dirY = dy / distance;
            var arrowTipX = pointLocation.x;
            var arrowTipY = pointLocation.y;
            var baseCenterX = arrowTipX - dirX * arrowSize;
            var baseCenterY = arrowTipY - dirY * arrowSize;
            var perpX = -dirY;
            var perpY = dirX;
            var leftX = baseCenterX + perpX * (arrowSize / 2);
            var leftY = baseCenterY + perpY * (arrowSize / 2);
            var rightX = baseCenterX - perpX * (arrowSize / 2);
            var rightY = baseCenterY - perpY * (arrowSize / 2);
            var arrowPoints = [
                this.chart.vector.vector3D(arrowTipX, arrowTipY, 0),
                this.chart.vector.vector3D(leftX, leftY, 0),
                this.chart.vector.vector3D(rightX, rightY, 0)
            ];
            var arrowPolygon = this.chart.polygon.polygon3D(arrowPoints, 'arrow', 0, stroke, 0, 1, stroke, 'datalabel-arrow-' + point.index + '-' + series.index, this.chart.chart3D);
            this.chart.graphics.addVisual(arrowPolygon, this.chart);
        };
        DataLabel3D.prototype.getLabelText = function (currentPoint, series, chart) {
            var labelFormat = series.dataLabel.format ? series.dataLabel.format : series.yAxis.labelFormat;
            var text = [];
            var customLabelFormat = labelFormat.match('{value}') !== null;
            text.push(currentPoint.text || currentPoint.yValue.toString());
            if ((labelFormat || chart.useGroupingSeparator) && !currentPoint.text) {
                series.yAxis.format = chart.intl.getNumberFormat({
                    format: customLabelFormat ? '' : labelFormat,
                    useGrouping: chart.useGroupingSeparator
                });
                for (var i = 0; i < text.length; i++) {
                    text[i] = customLabelFormat ? labelFormat.replace('{value}', series.yAxis.format(parseFloat(text[i]))) :
                        series.yAxis.format(parseFloat(text[i]));
                }
            }
            return text;
        };
        DataLabel3D.prototype.createDataLabelTemplate = function (parentElement, series, dataLabel, point, data, labelIndex, redraw, location) {
            this.margin = { left: 0, right: 0, bottom: 0, top: 0 };
            var clip = series.clipRect;
            var childElement = this.createTemplate(ej2_base_1.createElement('div', {
                id: this.chart.element.id + '-series-' + series.index + '-data-label-' + labelIndex,
                styles: 'position: absolute;background-color:' + data.color + ';' +
                    helper_1.getFontStyle(dataLabel.font, this.chart.themeStyle.datalabelFont) + ';border:' + data.border.width + 'px solid ' + data.border.color + ';'
            }), data.template, this.chart, point, series, this.chart.element.id + '-data-label-', labelIndex, location);
            this.calculateTemplateLabelSize(parentElement, childElement, point, series, dataLabel, clip, redraw, location);
        };
        DataLabel3D.prototype.calculateTemplateLabelSize = function (parentElement, childElement, point, series, dataLabel, clip, redraw, location, isReactCallback) {
            var elementRect = helper_1.measureElementRect(childElement, redraw, isReactCallback);
            var rect = { x: 0, y: 0, width: 0, height: 0 };
            var rectPosition = this.calculateTextPosition(series, point, elementRect, location);
            var clipWidth = 0;
            var clipHeight = 0;
            var isOverlap = false;
            if (isReactCallback) {
                isOverlap = (elementRect.width === 0 || elementRect.height === 0);
            }
            childElement.style.left = (rectPosition.left - clipWidth) + 'px';
            childElement.style.top = (rectPosition.top + clipHeight) + 'px';
            var backgroundColor = this.fontBackground === 'transparent' ? (this.chart.theme.indexOf('Dark') > -1 ? 'black' : 'white') : this.fontBackground;
            var rgbValue = helper_1.convertHexToColor(helper_1.colorNameToHex(backgroundColor));
            var vAxis = series.chart.requireInvertedAxis ? series.xAxis : series.yAxis;
            var hAxis = series.chart.requireInvertedAxis ? series.yAxis : series.xAxis;
            childElement.style.color = dataLabel.font.color || this.chart.theme === 'Bootstrap5' ? '#212529' : this.chart.theme === 'Bootstrap5Dark' ? '#DEE2E6' :
                ((Math.round((rgbValue.r * 299 + rgbValue.g * 587 + rgbValue.b * 114) / 1000)) >= 128 ? this.chart.theme.indexOf('Tailwind3') > -1 ? '#111827' : 'black' : this.chart.theme.indexOf('Tailwind3') > -1 ? '#FFFFFF' : 'white');
            if (childElement.childElementCount && !isOverlap && (!helper_1.isCollide(rect, this.chart.dataLabelCollections, clip))
                && (point.yValue === undefined ||
                    helper_1.withIn(point.yValue, series.yAxis.visibleRange) || (series.type.indexOf('Stacking') > -1) ||
                    (series.type.indexOf('100') > -1 && helper_1.withIn(series.stackedValues.endValues[point.index], series.yAxis.visibleRange))) &&
                helper_1.withIn(point.xValue, series.xAxis.visibleRange) && parseFloat(childElement.style.top) >= vAxis.rect.y &&
                parseFloat(childElement.style.left) >= hAxis.rect.x &&
                parseFloat(childElement.style.top) <= vAxis.rect.y + vAxis.rect.height &&
                parseFloat(childElement.style.left) <= hAxis.rect.x + hAxis.rect.width) {
                this.chart.dataLabelCollections.push(new ej2_svg_base_1.Rect(rect.x + clip.x, rect.y + clip.y, rect.width, rect.height));
                helper_1.appendChildElement(false, parentElement, childElement, redraw, true, 'left', 'top');
            }
        };
        DataLabel3D.prototype.calculateTextPosition = function (series, point, elementSize, location) {
            var width = elementSize.width / 2;
            var height = elementSize.height;
            var left;
            var top;
            var right;
            if (series.type.indexOf('Bar') !== -1) {
                left = location.x - width;
                top = location.y - height + series.xAxis.plotOffset;
                right = location.x + width;
            }
            else {
                left = location.x - width;
                top = location.y - height;
                right = location.x + width;
            }
            return { left: left, top: top, right: right };
        };
        DataLabel3D.prototype.chartReactTemplate = function (childElement, chart, point, series, labelIndex, redraw, location) {
            var parentElement = document.getElementById(chart.element.id + '-series-' + series.index + '-data-label-collections');
            if (parentElement) {
                if (point.index === 0) {
                    chart.dataLabelCollections = [];
                }
                chart.dataLabel3DModule.calculateTemplateLabelSize(parentElement, childElement, point, series, series.dataLabel, series.clipRect, redraw, location, true);
            }
        };
        DataLabel3D.prototype.createTemplate = function (childElement, content, chart, point, series, dataLabelId, labelIndex, location, redraw) {
            var templateFn = helper_1.getTemplateFunction(content);
            var templateElement;
            try {
                var tempObject = { chart: chart, series: series, point: point };
                var templateId = dataLabelId + '-template';
                var elementData = templateFn ? templateFn(tempObject, chart, templateId, dataLabelId) : [];
                Eif (elementData.length) {
                    templateElement = Array.prototype.slice.call(elementData);
                    var len = templateElement.length;
                    for (var i = 0; i < len; i++) {
                        childElement.appendChild(templateElement[i]);
                    }
                }
                var reactCallback = void 0;
                Eif (chart.getModuleName() === 'chart3d') {
                    reactCallback = (point && series) ? this.chartReactTemplate.bind(this, childElement, chart, point, series, labelIndex, redraw, location) : reactCallback;
                    Iif (chart.isReact) {
                        chart.renderReactTemplates(reactCallback);
                    }
                }
            }
            catch (e) {
                return childElement;
            }
            return childElement;
        };
        DataLabel3D.prototype.getModuleName = function () {
            return 'DataLabel3D';
        };
        DataLabel3D.prototype.destroy = function () {
        };
        return DataLabel3D;
    }());
    exports.DataLabel3D = DataLabel3D;
});