"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBarChartSettings = void 0;
var mdm_sdk_1 = require("@reltio/mdm-sdk");
var getBarChartSettings = function (_a, barColor) {
    var margin = _a.margin, isHorizontal = _a.isHorizontal, isLabelRotated = _a.isLabelRotated;
    return {
        barChart: {
            layout: isHorizontal ? 'vertical' : 'horizontal',
            barCategoryGap: '30%',
            margin: margin
        },
        bar: {
            dataKey: 'value',
            fill: barColor
        },
        xAxis: {
            type: isHorizontal ? 'number' : 'category',
            dataKey: isHorizontal ? '' : 'label',
            tick: {
                fill: '#000',
                opacity: '0.54'
            },
            tickFormatter: function (value, _index) {
                return typeof value === 'string' ? value.replace(/ /g, '\u00A0') : value;
            },
            angle: isLabelRotated ? -45 : 0,
            textAnchor: isLabelRotated ? 'end' : 'middle',
            stroke: '#666'
        },
        yAxis: {
            dataKey: isHorizontal ? 'label' : '',
            type: isHorizontal ? 'category' : 'number',
            tick: {
                fill: '#000',
                opacity: isHorizontal ? '0.87' : '0.54',
                width: isHorizontal ? 150 : undefined
            },
            tickFormatter: function (value) { return (0, mdm_sdk_1.formatNumberAsMetric)(value); },
            stroke: '#666',
            tickCount: 8,
            mirror: isHorizontal
        },
        cartesianGrid: {
            strokeDasharray: '3 3',
            stroke: '#666',
            strokeOpacity: '0.4',
            vertical: !isHorizontal
        },
        tooltip: {
            cursor: {
                fill: '#000',
                opacity: '0.1'
            }
        }
    };
};
exports.getBarChartSettings = getBarChartSettings;
