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