"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
const Text_1 = require("../Text");
const pretty_number_1 = require("@based/pretty-number");
const pretty_date_1 = require("@based/pretty-date");
const XAxis = ({ maxX, minX, xFormat, width }) => {
    const d = maxX - minX;
    const amount = Math.floor(width / 150);
    const rW = width / amount;
    const c = [];
    // let prevValue
    for (let i = 0; i < amount; i++) {
        const value = (d * (i + 1)) / amount + minX;
        // if (Object.is(value, prevValue)) {
        //   continue
        // }
        // prevValue = value
        if (xFormat === 'date-time-human') {
            // c.push({ value, format: 'date-time-human' })
            c.push((0, pretty_date_1.prettyDate)(value, 'date-time-human'));
        }
        else if (xFormat === 'date') {
            // (d * i) / amount
            c.push([
                (0, pretty_date_1.prettyDate)(value, 'time-precise'),
                // { value, format: 'time-precise' },
                ' - ',
                (0, pretty_date_1.prettyDate)(value, 'date'),
                // { value, format: 'date' },
            ]);
        }
        else {
            c.push((0, pretty_number_1.prettyNumber)(value, 'number-short'));
            // c.push({ value, format: 'number-short' })
        }
    }
    return (react_1.default.createElement("div", { style: { display: 'flex' } }, c.map((v, i) => {
        return (react_1.default.createElement("div", { key: i, style: {
                minWidth: rW,
                display: 'flex',
                justifyContent: 'flex-start',
                paddingTop: 15,
            } },
            react_1.default.createElement(Text_1.Text, { size: 12 }, v)));
    })));
};
exports.default = XAxis;
//# sourceMappingURL=XAxis.js.map