{
    "debug": false,
    "$schema": "https://cstm.rivm.nl/regiobeeld/Regiobeeld-app-acc/schema/figure-config.schema.json",
    "identifier": "113_persoon_kenmerk_bar",
    "figure": {
        "type": "figure-highcharts-regiobeeld",
        "title": "Overledenen door suïcides uitgesplitst naar <%= filters[\"113_persoon_opties\"].label.toLowerCase() %> in <%= String(state.config.dataset.data[0].jaar).length === 8? String(state.config.dataset.data[0].jaar).substring(0, 4) + '-' + String(state.config.dataset.data[0].jaar).substring(4, 8): String(state.config.dataset.data[0].jaar)%>",
        "credits": "{appConfig.credits.CBS_micro}",
        "watch": [
            "regio_GG",
            "113_jaar_opties",
            "113_persoon_opties"
        ],
        "settings": {
            "series": {
                "name": "regio",
                "data": [
                    {
                        "y": "percentage"
                    }
                ]
            },
            "options": {
                "chart": {
                    "type": "bar"
                },
                "colors": "{appConfig.colorPalettes.qualitative}",
                "xAxis": {
                    "labels": {
                        "format": {
                        "if": [
                                {"condition": ["{113_persoon_opties}","opleidingsniveau"], "then": "\\{chart.series.0.userOptions.data.(pos).props.formatted.opleidingsniveau\\}"},
                                {"condition": ["{113_persoon_opties}","subcategorie"], "then": "\\{chart.series.0.userOptions.data.(pos).props.formatted.subcategorie\\}"},
                                {"condition": ["{113_persoon_opties}","hoofdcategorie"], "then": "\\{chart.series.0.userOptions.data.(pos).props.formatted.hoofdcategorie\\}"}
                        ]
                    }
                    },
                    "tickInterval": 1
                },
                "yAxis": {

                    "title": {
                        "text": "Percentage"
                    },
                    "xlabels": {
                        "rotation": 0
                    }
                }
            },
            "formatters": {}
        }
    },
    "dataset": {
        "type": "local-static-default",
        "settings": {
            "src": [
                "data/113/suicides_pers_uitg_kenm_20261111/suicides_pers_uitg_kenm_20261111--NL01.json",
                "data/113/suicides_pers_uitg_kenm_20261111/suicides_pers_uitg_kenm_20261111--{regio_GG}.json"
            ],
            "tableGrouping": {
                "row": {
                            "if": [
                                {"condition": ["{113_persoon_opties}","opleidingsniveau"], "then": "opleidingsniveau"},
                                {"condition": ["{113_persoon_opties}","subcategorie"], "then": "subcategorie"},
                                {"condition": ["{113_persoon_opties}","hoofdcategorie"], "then": "hoofdcategorie"}
                        ]
                    },
                "column": "regio",
                "minRowCount": 2
            },
            "columns": [
                {
                    "label": "Regio",
                    "data": "regio",
                    "show": ["tooltip"]
                },
                {
                    "label": "Uitsplitsing",
                    "data": "opleidingsniveau",
                    "show": false
                },
                {
                    "label": "Uitsplitsing",
                    "data": "subcategorie",
                    "show": false
                },
                {
                    "label": "Uitsplitsing",
                    "data": "hoofdcategorie",
                    "show": false
                },
                {
                    "label": "Geo_id",
                    "data": "geo_id",
                    "show": false
                },
                {
                    "label": "Aantal",
                    "data": "aantal",
                    "show": ["table"],
                    "numberFormat": 0,
                    "align": "right"
                },
                {
                    "label": "Percentage",
                    "data": "percentage",
                    "show": true,
                    "numberFormat": 0,
                    "align": "right",
                    "suffix": "%"
                }
            ],
            "select": [
                [
                    "geo_id"
                ],
                [
                    "opleidingsniveau"
                ],
                [
                    "subcategorie"
                ],
                [
                    "hoofdcategorie"
                ],
                [
                    "aantal"
                ],
                [
                    "percentage"
                ],
                [
                    "regio"
                ],
                [
                    "jaar"
                ]
            ],
            "where":{
            "and": [
                ["jaar", "{113_jaar_opties}"],
                {
                    "if": [
                        {
                        "condition": ["{113_persoon_opties}", "opleidingsniveau"],
                        "then": ["opleidingsniveau", "Opleidingsniveau totaal", "ne"]
                        },
                        {
                        "condition": ["{113_persoon_opties}", "subcategorie"],
                        "then": ["subcategorie", "Totaal", "ne"]
                        },
                        {
                        "condition": ["{113_persoon_opties}", "hoofdcategorie"],
                        "then": ["hoofdcategorie", "Totaal", "ne"]
                        }
                    ]
                }
            ]
        },
             "join": [
                {
                    "dataset": {
                        "type": "local-static-default",
                        "settings": {
                            "src": [
                                "data/regio/ref_gem_regio_gem2023_20240507/ref_gem_regio_gem2023_20240507--NL01.json",
                                "data/regio/ref_gem_regio_gem2023_20240507/ref_gem_regio_gem2023_20240507--{regio_GG}.json"
                            ],
                            "select": [
                                [
                                    "geo_nm",
                                    "regio"
                                ]
                            ]
                        }
                    },
                    "on": [
                        "geo_id",
                        "geo_id"
                    ]
                },
                {
                    "dataset": {
                        "type": "local-static-default",
                        "settings": {
                            "src": ["data/filterOpties/opties_113_waarden_20261116.json"],
                             "select": [["value"], ["label", "opleidingsniveau"]]
                        }
                    },
                    "on": ["opleidingsniveau", "value"]
                },
                {
                    "dataset": {
                        "type": "local-static-default",
                        "settings": {
                            "src": ["data/filterOpties/opties_113_waarden_20261116.json"],
                             "select": [["value"], ["label", "subcategorie"]]
                        }
                    },
                    "on": ["subcategorie", "value"]
                },
                {
                    "dataset": {
                        "type": "local-static-default",
                        "settings": {
                            "src": ["data/filterOpties/opties_113_waarden_20261116.json"],
                             "select": [["value"], ["label", "hoofdcategorie"]]
                        }
                    },
                    "on": ["hoofdcategorie", "value"]
                }
            ], "order": ["order"]
        }
    },
    "filters": [
        {
            "identifier": "113_jaar_opties",
            "type": "filter-default",
            "settings": {
                "label": "Selecteer een jaar:",
                "defaultValue": "20212025",
                "dataset": {
                    "type": "local-static-default",
                    "settings": {
                        "src": ["data/filterOpties/filteropties_jaren_2025_2021-2025.json"]
                    }
                }
            }
        },
        {
            "identifier": "113_persoon_opties",
            "type": "filter-default",
            "settings": {
                "label": "Selecteer een optie:",
                "defaultValue": "opleidingsniveau",
                "dataset": {
                    "type": "local-static-default",
                    "settings": {
                        "src": ["data/filterOpties/filteropties_113_uitsplitsingen_persoon_uitgebreid_20261111.json"],
                        "where": {
                            "or": [
                                ["value", "opleidingsniveau"],
                                ["value", "subcategorie"],
                                ["value", "hoofdcategorie"]
                            ]
                        }
                    }
                }
            }
        }
    ]
}