import {
    Chart,
    Axis,
    Line,
    Legend
} from '@antv/f2';
import {
    jsx as _jsx
} from "@antv/f2/jsx-runtime";
import {
    jsxs as _jsxs
} from "@antv/f2/jsx-runtime";
export default (({
    data
}) => {
    return _jsxs(Chart, {
        data,
        children: [
            _jsx(Axis, {
                field: "label",
                tickCount: 12,
                style: {
                    label: {
                        align: 'between'
                    },
                }
            }),
            _jsx(Axis, {
                field: "value",
                tickCount: 5
            }),
            _jsx(Line, {
                x: "label",
                y: "value",
                lineWidth: "4px",
                color: "type"
            }),
            _jsx(Legend, {
                position: "top",
                style: {
                    justifyContent: 'space-around',
                },
                triggerMap: {
                    press: (items, records, legend) => {
                        const map = {};
                        items.forEach((item) => (map[item.name] = _.clone(item)));
                        records.forEach((record) => {
                            map[record.type].value = record.value;
                        });
                        legend.setItems(_.values(map));
                    },
                    pressend: (items, records, legend) => {
                        legend.setItems(items);
                    },
                },
            })
        ]
    });
});