import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { useDemographics } from "~/sdks/LocalDemographics/context";
import { Chart } from "~/components/deprecated";
export const TypeOfHousing = () => {
    const { t } = useTranslation("localDemographics");
    const { demographicsState: { housing_type: housingType }, } = useDemographics();
    const dataset = useMemo(() => ({
        labels: (housingType === null || housingType === void 0 ? void 0 : housingType.variables.map((variable) => variable.label)) || [],
        data: (housingType === null || housingType === void 0 ? void 0 : housingType.variables.map((variable) => Number((variable.value * 100).toFixed(1)))) || [],
    }), [housingType === null || housingType === void 0 ? void 0 : housingType.variables]);
    const chartOptions = useMemo(() => ({
        title: t("data.housing.graphs.typeOfHousing.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