import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { useDemographics } from "~/sdks/LocalDemographics/context";
import { Chart } from "~/components/deprecated";
export const IncomeBrackets = () => {
    const { t } = useTranslation("localDemographics");
    const { demographicsState: { income_level: incomeLevel }, } = useDemographics();
    const dataset = useMemo(() => ({
        labels: (incomeLevel === null || incomeLevel === void 0 ? void 0 : incomeLevel.variables.map((variable) => variable.label)) || [],
        data: (incomeLevel === null || incomeLevel === void 0 ? void 0 : incomeLevel.variables.map((variable) => Number((variable.value * 100).toFixed(1)))) || [],
    }), [incomeLevel === null || incomeLevel === void 0 ? void 0 : incomeLevel.variables]);
    const chartOptions = useMemo(() => ({
        title: t("data.income.graphs.incomeBrackets.title"),
        labels: dataset.labels,
        data: dataset.data,
        unit: "%",
    }), [dataset]);
    return (React.createElement(Chart.Root, Object.assign({}, chartOptions),
        React.createElement(Chart.BarChart, null)));
};
//# sourceMappingURL=index.js.map