How to use the tui-code-snippet.isNumber function in tui-code-snippet

To help you get started, weโ€™ve selected a few tui-code-snippet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nhn / tui.chart / src / js / plugins / raphaelAreaChart.js View on Github external
_isAreaOpacityNumber(areaOpacity) {
        const isNumber = snippet.isNumber(areaOpacity);

        if (isNumber) {
            if (areaOpacity < 0 || areaOpacity > 1) {
                consoleUtil.print(GUIDE_AREACHART_AREAOPACITY_TYPE, 'warn');
            }
        } else if (!snippet.isUndefined(areaOpacity)) {
            consoleUtil.print(GUIDE_AREACHART_AREAOPACITY_TYPE, 'error');
        }

        return isNumber;
    }
}
github nhn / tui.chart / src / js / plugins / raphaelAreaChart.js View on Github external
render(paper, data) {
        const {dimension, groupPositions, theme = {}, position, zeroTop, hasRangeData, options} = data;
        const {dot: dotTheme = {}, colors} = theme;
        const {spline, allowSelect, connectNulls, pointWidth, showDot, areaOpacity: areaOpacityOptions} = options;
        const areaOpacity = this._isAreaOpacityNumber(areaOpacityOptions) ? areaOpacityOptions : 1;
        const dotOpacity = showDot ? 1 : 0;
        const borderStyle = this.makeBorderStyle(dotTheme.strokeColor, dotOpacity, dotTheme.strokeWidth);
        const outDotStyle = this.makeOutDotStyle(dotOpacity, borderStyle);
        const lineWidth = this.lineWidth = (snippet.isNumber(pointWidth) ? pointWidth : this.lineWidth);

        this.paper = paper;
        this.theme = theme;
        this.isSpline = spline;
        this.dimension = dimension;
        this.position = position;
        this.zeroTop = zeroTop;
        this.hasRangeData = hasRangeData;

        paper.setStart();

        this.groupPaths = this._getAreaChartPath(groupPositions, null, connectNulls);
        this.groupAreas = this._renderAreas(paper, this.groupPaths, colors, lineWidth, areaOpacity);

        this.tooltipLine = this._renderTooltipLine(paper, dimension.height);
        this.groupDots = this._renderDots(paper, groupPositions, colors, dotOpacity);
github nhn / tui.chart / src / js / components / tooltips / normalTooltip.js View on Github external
_getBoxplotTooltipTemplate(item) {
        let template = tooltipTemplate.tplBoxplotChartDefault;

        if (snippet.isNumber(item.outlierIndex)) {
            template = tooltipTemplate.tplBoxplotChartOutlier;
            item.label = item.outliers[item.outlierIndex].label;
        }

        return template;
    }
github nhn / tui.chart / src / js / models / data / seriesItemForCoordinateType.js View on Github external
_getFormattedValueForTooltip(valueType) {
        const ratio = this.ratioMap[valueType];
        const value = this[valueType];
        const formattedValue = renderUtil.formatValue({
            value,
            formatFunctions: this.formatFunctions,
            chartType: this.chartType,
            areaType: 'tooltip',
            valueType
        });

        return snippet.isNumber(ratio) ? formattedValue : value;
    }
github nhn / tui.calendar / src / js / common / domutil.js View on Github external
setPosition: function(el, x, y) {
        x = util.isUndefined(x) ? 0 : x;
        y = util.isUndefined(y) ? 0 : y;

        el[posKey] = [x, y];

        el.style.left = util.isNumber(x) ? (x + 'px') : x;
        el.style.top = util.isNumber(y) ? (y + 'px') : y;
    },
github nhn / tui.chart / src / js / plugins / raphaelLineChart.js View on Github external
render(paper, data) {
        const {dimension, groupPositions, theme, options, position} = data;
        const {colors} = theme;
        const opacity = options.showDot ? 1 : 0;
        const isSpline = options.spline;
        const lineWidth = this.lineWidth = (snippet.isNumber(options.pointWidth) ? options.pointWidth : this.lineWidth);
        const borderStyle = this.makeBorderStyle(theme.dot.strokeColor, opacity, theme.dot.strokeWidth);
        const outDotStyle = this.makeOutDotStyle(opacity, borderStyle);
        let groupPaths;

        if (isSpline) {
            groupPaths = this._getSplineLinesPath(groupPositions, options.connectNulls);
        } else {
            groupPaths = this._getLinesPath(groupPositions, options.connectNulls);
        }

        this.paper = paper;
        this.theme = theme;
        this.isSpline = isSpline;
        this.dimension = dimension;
        this.position = position;
github nhn / tui.chart / src / js / helpers / dataExporter.js View on Github external
snippet.forEachArray(row, (cell, cellIndex) => {
            const cellContent = (snippet.isNumber(cell) ? cell : `"${cell}"`);

            csvText += cellContent;

            if (cellIndex < lastCellIndex) {
                csvText += itemDelimiter;
            }
        });
github nhn / tui.chart / src / js / components / tooltips / normalTooltip.js View on Github external
_makeSingleTooltipHtml(chartType, indexes) {
        const {groupIndex} = indexes;
        let data = this._findTooltipData(chartType, indexes);
        let color = this._findTooltipColor(chartType, indexes, data);

        if (predicate.isBoxplotChart(this.chartType) && snippet.isNumber(indexes.outlierIndex)) {
            data.outlierIndex = indexes.outlierIndex;
        }
        if (this.colorSpectrum) {
            color = this.colorSpectrum.getColor(data.colorRatio || data.ratio);
        }

        data.chartType = this.chartType;
        data.cssText = `background-color: ${color}`;
        data = Object.assign({
            suffix: this.suffix
        }, data);
        data.valueTypes = this._makeHtmlForValueTypes(data, ['x', 'y', 'r']);

        return this.templateFunc(data.category, data, this.getRawCategory(groupIndex));
    }
github nhn / tui.chart / src / js / plugins / raphaelLineTypeBase.js View on Github external
renderDot(paper, position, color, opacity) {
        const dotTheme = (this.theme && this.theme.dot) || {dot: {}};
        let raphaelDot;

        if (position) {
            const dot = paper.circle(
                position.left,
                position.top,
                (!snippet.isUndefined(dotTheme.radius)) ? dotTheme.radius : DEFAULT_DOT_RADIUS
            );
            const dotStyle = {
                fill: dotTheme.fillColor || color,
                'fill-opacity': snippet.isNumber(opacity) ? opacity : dotTheme.fillOpacity,
                stroke: dotTheme.strokeColor || color,
                'stroke-opacity': snippet.isNumber(opacity) ? opacity : dotTheme.strokeOpacity,
                'stroke-width': dotTheme.strokeWidth
            };

            dot.attr(dotStyle);

            raphaelDot = {
                dot,
                color
            };
        }

        return raphaelDot;
    }