{
    "debug": false,
    "$schema": "https://cstm.rivm.nl/regiobeeld/Regiobeeld-app-acc/schema/figure-config.schema.json",
    "identifier": "gezondheidsmonitor_broosheid_kaart",
    "figure": {
        "type": "figure-highcharts-regiobeeld",
        "title": "<%= state.config.dataset.data[0].hoofdcategorie %> in <%= state.config.dataset.data[0].jaar %>", 
        "subtitle": "Kaart op <%= (state.gwb === 'GM' ? 'gemeenteniveau' : state.gwb === 'WK' ? 'wijkniveau' : state.gwb === 'BU' ? 'buurtniveau' : 'onbekend niveau') %>, <%= state.config.dataset.data[0].leeftijd %>",
        "credits": "{appConfig.credits.Statline_rivm_50150NED_broos}",
        "watch": [
            "GM_filteropties_broos",
            "regio"
        ],
        "settings": {
            "series": [
                {
                    "name": "Geen gegevens",
                    "color": "{appConfig.colorPalettes.noData}",
                    "showInLegend": true,
                    "data": []
                },
                {
                    "nullColor": "{appConfig.colorPalettes.noData}",
                    "allowPointSelect": true,
                    "data": [
                        {
                            "geo_id": "geo_id",
                            "value": "percentage"
                        }
                    ],
                    "joinBy": [
                        {
                            "if": [
                                {
                                    "condition": [
                                        "{gwb}",
                                        "GM"
                                    ],
                                    "then": [
                                        "gem_code"
                                    ]
                                },
                                {
                                    "condition": [
                                        "{gwb}",
                                        ["WK", "BU"],
                                        "in"
                                    ],
                                    "then": [
                                        "gwb_code"
                                    ]
                                }
                            ]
                        },
                        "geo_id"
                    ]
                }
            ],
            "options": {
                "chart": {
                    "type": "map"
                },
                "colorAxis": {
                    "labels": {
                        "overflow":"allow"
                    },
                    "stops": [
                        [0.05,"#CCE5F4"], [0.25,"#99cae9"], [0.5,"#4da3d8"], [0.75,"#00568B"], [0.95,"#003150"]
                    ]
                },
                "legend": {
                    "title": {
                        "text": "Percentage"
                    }
                }
            },
            "formatters": {},
            "geojson": {
                "ref": "config/refs/rwb_wfs_geojson.json"
            }
        }
    },
        "dataset": {
            "type": "local-static-default",
            "settings": {
                "src": {
                    "if": [
                        {
                            "condition": [
                                "{gwb}",
                                "GM"
                            ],
                            "then": [
                                "data/statline/gem_gezondheidsmonitor_20260318/gem_gezondheidsmonitor_20260318--{regio}.json",
                                "data/statline/gem_gezondheidsmonitor_20260318/gem_gezondheidsmonitor_20260318--{regio|GM}.json"

                            ]
                        },
                        {
                            "condition": [
                                "{gwb}",
                                ["WK", "BU"],
                                "in"
                            ],
                            "then": [
                                "data/statline/wb_gezondheidsmonitor_20260318/wb_gezondheidsmonitor_20260318--{gm}.json"
                            ]
                        }
                    ]
                },
                "columns": [
                   {
                    "label": "Regio",
                    "data": "regio",
                    "show": true
                   },
                   {
                    "label": "Percentage",
                    "data": "percentage",
                    "show": true,
                    "numberFormat": 0,
                    "align": "right",
                    "suffix": "%"
                   }
                ],
                "select": {
                    "if": [
                        {
                            "condition": [
                                "{gwb}",
                                "GM"
                            ],
                            "then": [
                                [
                                    "geo_id"
                                ],
                                [
                                    "geo_name", "regio"
                                ],
                                [
                                    "aantal"
                                ],
                                [
                                    "percentage"
                                ],
                                [
                                    "hoofdcategorie"
                                ],
                                [
                                    "jaar"
                                ],
                                [
                                    "leeftijd"
                                ]
                            ]
                        },
                        {
                            "condition": [
                                "{gwb}",
                                ["WK", "BU"],
                                "in"
                            ],
                            "then": [
                                [
                                    "gwb_id", "geo_id"
                                ],
                                [
                                    "geo_name", "regio"
                                ],
                                [
                                    "aantal"
                                ],
                                [
                                    "percentage"
                                ],
                                [
                                    "hoofdcategorie"
                                ],
                                [
                                    "jaar"
                                ],
                                [
                                    "leeftijd"
                                ]
                            ]
                        }

                    ]
                },
                "where": {
                    "if": [
                        {
                            "condition": ["{gwb}", "GM"],
                            "then": {
                                "and": [
                                    ["jaar", "2024"],
                                    ["hoofdcategorie", "{GM_filteropties_broos}"]
                                ]
                            }
                        },
                        {
                            "condition": ["{gwb}", ["WK", "BU"], "in"],
                            "then": {
                                "and": [
                                    ["jaar", "2024"],
                                    ["hoofdcategorie", "{GM_filteropties_broos}"],
                                    ["gwb_id", "{gwb}%", "like"]
                                ]
                            }
                        }
                    ]
                },
                "order": [
                    "geo_name"
                ],
                "join": [
                    {
                        "dataset": {
                            "ref": "config/refs/rwb_wfs_ref.json"
                        },
                        "on": [
                            "geo_id",
                            "geo_id"
                        ]
                    }
                ]
            }
        }
}