import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { useNeighborhoodDemographics } from "~/sdks/NeighborhoodDemographics/context";
import { Chart } from "~/components/deprecated";
export const EducationLevel = () => {
    const { t } = useTranslation("neighborhoodDemographics");
    const { demographicsData: { education_level: educationLevel }, } = useNeighborhoodDemographics();
    const dataset = useMemo(() => {
        const variables = educationLevel === null || educationLevel === void 0 ? void 0 : educationLevel.variables.filter((variable) => !variable.type || variable.type === "percent");
        return {
            labels: (variables === null || variables === void 0 ? void 0 : variables.map((variable) => variable.label)) || [],
            data: (variables === null || variables === void 0 ? void 0 : 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