<commit_before>/**
 * @fileoverview Raphael title renderer.
 * @author <NAME>.
 *         FE Development Lab <<EMAIL>>
 */

'use strict';

var chartConst = require('../const');
var raphaelRenderUtil = require('./raphaelRenderUtil');

var RaphaelAxisComponent = tui.util.defineClass(/** @lends RaphaelAxisComponent.prototype */ {
    init: function() {
        this.ticks = [];
    },
    /**
     * Render title
     * @param {object} paper raphael paper
     * @param {object} data rendering data
     * @param {string} data.text text content
     * @param {object} data.theme theme object
     * @param {object} data.rotationInfo object
     * @param {object} data.layout dimension and position
     */
    renderTitle: function(paper, data) {
        var fontSize = data.theme.fontSize;
        var fontFamily = data.theme.fontFamily;
        var titleSize = raphaelRenderUtil.getRenderedTextSize(data.text, fontSize, fontFamily);
        var size = data.rotationInfo.isVertical ? data.layout.dimension.height : data.layout.dimension.width;
        var position = data.rotationInfo.isVertical ? data.layout.position.top : data.layout.position.left;
        var centerPosition = ((size + titleSize.width) / 2) + position;
        var halfTextHeight = titleSize.height / 2;
        var attributes = {
            'font-family': data.theme.fontFamily,
            'font-size': data.theme.fontSize,
            'font-weight': data.theme.fontWeight,
            fill: data.theme.color,
            'text-anchor': 'start'
        };
        var positionTopAndLeft = {};

        attributes['text-anchor'] = 'middle';

        if (data.rotationInfo.isCenter) {
            positionTopAndLeft.top = data.layout.position.top + (data.layout.dimension.height * 1.1) + halfTextHeight;
            positionTopAndLeft.left = data.layout.position.left + (data.layout.dimension.width / 2);
        } else if (data.rotationInfo.isPositionRight) {
            attributes.transform = 'r90';

            positionTopAndLeft.top = centerPosition;
            positionTopAndLeft.left = data.layout.position.left + data.layout.dimension.width - halfTextHeight;
        } else if (data.rotationInfo.isVertical) {
            attributes.transform = 'r-90';

            positionTopAndLeft.top = centerPosition;
            positionTopAndLeft.left = data.layout.position.left + halfTextHeight;
        } else {
            positionTopAndLeft.top = paper.height - halfTextHeight - chartConst.CHART_PADDING;
            positionTopAndLeft.left = centerPosition;
        }

        raphaelRenderUtil.renderText(paper, positionTopAndLeft, {
            text: data.text,
            attributes: attributes,
            set: data.Set
        });
    },

    /**
     * Render Axis label
     * @param {object} data data for render label
     *       @param {{
     *           left: number,
     *           top: number
     *       }} data.positionTopAndLeft left, top positions
     *       @param {string} data.labelText label text
     *       @param {number} data.labelSize label size
     *       @param {object} data.paper raphael paper
     *       @param {boolean} data.isVertical boolean value of axis is vertical
     *       @param {boolean} data.isPositionRight boolean value of axis is right yAxis
     *       @param {object} data.theme theme of label
     */
    renderLabel: function(data) {
        var positionTopAndLeft = data.positionTopAndLeft;
        var labelText = data.labelText;
        var paper = data.paper;
        var isVertical = data.isVertical;
        var isPositionRight = data.isPositionRight;
        var theme = data.theme;
        var attributes = {
            'font-family': theme.fontFamily,
            'font-size': theme.fontSize,
            'font-weight': theme.fontWeight,<commit_msg>fix: Axis title not removed on rerender #504<commit_after>/**
 * @fileoverview Raphael title renderer.
 * @author <NAME>.
 *         FE Development Lab <<EMAIL>>
 */

'use strict';

var chartConst = require('../const');
var raphaelRenderUtil = require('./raphaelRenderUtil');

var RaphaelAxisComponent = tui.util.defineClass(/** @lends RaphaelAxisComponent.prototype */ {
    init: function() {
        this.ticks = [];
    },
    /**
     * Render title
     * @param {object} paper raphael paper
     * @param {object} data rendering data
     * @param {string} data.text text content
     * @param {object} data.theme theme object
     * @param {object} data.rotationInfo object
     * @param {object} data.layout dimension and position
     */
    renderTitle: function(paper, data) {
        var fontSize = data.theme.fontSize;
        var fontFamily = data.theme.fontFamily;
        var titleSize = raphaelRenderUtil.getRenderedTextSize(data.text, fontSize, fontFamily);
        var size = data.rotationInfo.isVertical ? data.layout.dimension.height : data.layout.dimension.width;
        var position = data.rotationInfo.isVertical ? data.layout.position.top : data.layout.position.left;
        var centerPosition = ((size + titleSize.width) / 2) + position;
        var halfTextHeight = titleSize.height / 2;
        var attributes = {
            'font-family': data.theme.fontFamily,
            'font-size': data.theme.fontSize,
            'font-weight': data.theme.fontWeight,
            fill: data.theme.color,
            'text-anchor': 'start'
        };
        var positionTopAndLeft = {};

        attributes['text-anchor'] = 'middle';

        if (data.rotationInfo.isCenter) {
            positionTopAndLeft.top = data.layout.position.top + (data.layout.dimension.height * 1.1) + halfTextHeight;
            positionTopAndLeft.left = data.layout.position.left + (data.layout.dimension.width / 2);
        } else if (data.rotationInfo.isPositionRight) {
            attributes.transform = 'r90';

            positionTopAndLeft.top = centerPosition;
            positionTopAndLeft.left = data.layout.position.left + data.layout.dimension.width - halfTextHeight;
        } else if (data.rotationInfo.isVertical) {
            attributes.transform = 'r-90';

            positionTopAndLeft.top = centerPosition;
            positionTopAndLeft.left = data.layout.position.left + halfTextHeight;
        } else {
            positionTopAndLeft.top = paper.height - halfTextHeight - chartConst.CHART_PADDING;
            positionTopAndLeft.left = centerPosition;
        }

        raphaelRenderUtil.renderText(paper, positionTopAndLeft, {
            text: data.text,
            attributes: attributes,
            set: data.set
        });
    },

    /**
     * Render Axis label
     * @param {object} data data for render label
     *       @param {{
     *           left: number,
     *           top: number
     *       }} data.positionTopAndLeft left, top positions
     *       @param {string} data.labelText label text
     *       @param {number} data.labelSize label size
     *       @param {object} data.paper raphael paper
     *       @param {boolean} data.isVertical boolean value of axis is vertical
     *       @param {boolean} data.isPositionRight boolean value of axis is right yAxis
     *       @param {object} data.theme theme of label
     */
    renderLabel: function(data) {
        var positionTopAndLeft = data.positionTopAndLeft;
        var labelText = data.labelText;
        var paper = data.paper;
        var isVertical = data.isVertical;
        var isPositionRight = data.isPositionRight;
        var theme = data.theme;
        var attributes = {
            'font-family': theme.fontFamily,
            'font-size': theme.fontSize,
            'font-weight': theme.fontWeight,
{'fraction_non_alphanumeric': 0.10783928805130219, 'fraction_numerical': 0.0027483313702394976, 'mean_word_length': 2.302506482281763, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3297665', 'n_tokens_mistral': 2127, 'n_tokens_neox': 2083, 'n_words': 492}