<commit_before>/**
 * @fileoverview Calculator for series.
 * @author <NAME>.
 *         FE Development Lab <<EMAIL>>
 */

'use strict';

var chartConst = require('../../const');
var predicate = require('../../helpers/predicate');

/**
 * Calculator for series.
 * @module seriesCalculator
 * @private */
var seriesCalculator = {
    /**
     * Calculate width.
     * @param {{
     *      chart: {width: number},
     *      yAxis: {width: number},
     *      legend: {width: number},
     *      rightYAxis: ?{width: number}
     * }} dimensionMap - dimension map
     * @param {{align: ?string, visible: boolean}} legendOptions - legend options
     * @returns {number} series width
     */
    calculateWidth: function(dimensionMap, legendOptions) {
        var chartWidth = dimensionMap.chart.width;
        var yAxisWidth = dimensionMap.yAxis.width;
        var legendDimension = dimensionMap.legend;
        var legendWidth, rightAreaWidth;

        if (predicate.isVerticalLegend(legendOptions.align) && legendOptions.visible) {
            legendWidth = legendDimension ? legendDimension.width : 0;
        } else {
            legendWidth = 20;
        }

        rightAreaWidth = legendWidth + dimensionMap.rightYAxis.width;

        return chartWidth - (chartConst.CHART_PADDING * 2) - yAxisWidth - rightAreaWidth;
    },

    /**
     * Calculate height.
     * @param {{
     *      chart: {height: number},
     *      title: {height: number},
     *      legend: {height: number},
     *      xAxis: {height: number}
     * }} dimensionMap - dimension map
     * @param {{align: ?string, visible: boolean}} legendOptions - legend options
     * @returns {number} series height
     */
    calculateHeight: function(dimensionMap, legendOptions) {
        var chartHeight = dimensionMap.chart.height;
        var titleHeight = dimensionMap.title.height;
        var legendHeight, bottomAreaWidth;

        if (predicate.isHorizontalLegend(legendOptions.align) && legendOptions.visible) {
            legendHeight = dimensionMap.legend.height;
        } else {
            legendHeight = 0;
        }

        bottomAreaWidth = legendHeight + dimensionMap.xAxis.height;

        return chartHeight - (chartConst.CHART_PADDING * 2) - titleHeight - bottomAreaWidth;
    }
};

module.exports = seriesCalculator;<commit_msg>fix: Remove rigth series area padding<commit_after>/**
 * @fileoverview Calculator for series.
 * @author <NAME>.
 *         FE Development Lab <<EMAIL>>
 */

'use strict';

var chartConst = require('../../const');
var predicate = require('../../helpers/predicate');

/**
 * Calculator for series.
 * @module seriesCalculator
 * @private */
var seriesCalculator = {
    /**
     * Calculate width.
     * @param {{
     *      chart: {width: number},
     *      yAxis: {width: number},
     *      legend: {width: number},
     *      rightYAxis: ?{width: number}
     * }} dimensionMap - dimension map
     * @param {{align: ?string, visible: boolean}} legendOptions - legend options
     * @returns {number} series width
     */
    calculateWidth: function(dimensionMap, legendOptions) {
        var chartWidth = dimensionMap.chart.width;
        var yAxisWidth = dimensionMap.yAxis.width;
        var legendDimension = dimensionMap.legend;
        var legendWidth, rightAreaWidth;

        if (predicate.isVerticalLegend(legendOptions.align) && legendOptions.visible) {
            legendWidth = legendDimension ? legendDimension.width : 0;
        } else {
            legendWidth = 0;
        }

        rightAreaWidth = legendWidth + dimensionMap.rightYAxis.width;

        return chartWidth - (chartConst.CHART_PADDING * 3) - yAxisWidth - rightAreaWidth;
    },

    /**
     * Calculate height.
     * @param {{
     *      chart: {height: number},
     *      title: {height: number},
     *      legend: {height: number},
     *      xAxis: {height: number}
     * }} dimensionMap - dimension map
     * @param {{align: ?string, visible: boolean}} legendOptions - legend options
     * @returns {number} series height
     */
    calculateHeight: function(dimensionMap, legendOptions) {
        var chartHeight = dimensionMap.chart.height;
        var titleHeight = dimensionMap.title.height;
        var legendHeight, bottomAreaWidth;

        if (predicate.isHorizontalLegend(legendOptions.align) && legendOptions.visible) {
            legendHeight = dimensionMap.legend.height;
        } else {
            legendHeight = 0;
        }

        bottomAreaWidth = legendHeight + dimensionMap.xAxis.height;

        return chartHeight - (chartConst.CHART_PADDING * 2) - titleHeight - bottomAreaWidth;
    }
};

module.exports = seriesCalculator;
{'fraction_non_alphanumeric': 0.11740890688259109, 'fraction_numerical': 0.002343916471340294, 'mean_word_length': 2.497764530551416, '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': '5818487', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1276, 'n_words': 308}