{
    "debug": false,
    "$schema": "https://cstm.rivm.nl/regiobeeld/Regiobeeld-app-acc/schema/figure-config.schema.json",
    "identifier": "ouderenzorg_wachtstatus_uitsplitsing",
    "figure": {
        "type": "figure-highcharts-regiobeeld",
        "title": "<%= mapping['oz_wachtstatus_opties'][state['oz_wachtstatus_opties']] %> - uitgesplitst naar <%= filters.opties_ouderenzorg_wachtstatus_uitsplitsing.label.toLowerCase() %> in Nederland",
        "subtitle": "65 jaar en ouder",  
        "credits": "{appConfig.credits.iwlz_zinl}",
        "watch": [
            "opties_ouderenzorg_wachtstatus_uitsplitsing",
            "oz_wachtstatus_opties",
            "regio_ZK"
        ],
        "settings": {
            "series": {
                "name": {"if": [{"condition": ["{opties_ouderenzorg_wachtstatus_uitsplitsing}","leeftijd"],
                        "then": "leeftijd"},
                        {"condition": ["{opties_ouderenzorg_wachtstatus_uitsplitsing}","geslacht"],
                        "then": "geslacht"}
                        ]},
                "data": [
                    {
                        "y": "per_1e4"
                    }
                ]
            },
            "options": {
                "chart": {
                    "type": "column"
                },
                "xAxis": {
                    "labels": {
                    "format": "\\{chart.series.0.userOptions.data.(pos).props.formatted.jaar\\}"
                    }
                },
                "yAxis": {
                    "title": {
                        "text": {"if": [{"condition": ["{opties_ouderenzorg_wachtstatus_uitsplitsing}","leeftijd"],
                        "then": "Per 10.000 inwoners"},
                        {"condition": ["{opties_ouderenzorg_wachtstatus_uitsplitsing}","leeftijd","ne"],
                        "then": "Per 10.000 inwoners (65+)"}]} 
                    },
                    "min": 0,
                    "allowDecimals": true
                },
                "plotOptions": {
                    "series": {
                        "stacking": null
                    }
                }
            },
            "formatters":  {
           
        }
        }
    },
    "dataset": {
        "type": "local-static-default",
        "settings": {
            "src": [
                "data/rivm/wozo_ouderenzorg_20260729/wozo_ouderenzorg_20260729--NL01.json"
            ],
            "tableGrouping": {
                "row": "jaar",
                "column": {"if": [{"condition": ["{opties_ouderenzorg_wachtstatus_uitsplitsing}","leeftijd"],
                        "then": "leeftijd"},
                        {"condition": ["{opties_ouderenzorg_wachtstatus_uitsplitsing}","geslacht"],
                        "then": "geslacht"}
                       ]},
                "minColumnCount": 2
            },
            "columns": [
                {
                    "label": "Indicator",
                    "data": "hoofdcategorie",
                    "show": false
                },
                {
                    "label": "Leeftijd",
                    "data": "leeftijd",
                    "show": {"if": [{"condition": ["{opties_ouderenzorg_wachtstatus_uitsplitsing}", "leeftijd"], "then": ["tooltip"]}]}
                },
                {
                    "label": "Geslacht",
                    "data": "geslacht",
                    "show": {"if": [{"condition": ["{opties_ouderenzorg_wachtstatus_uitsplitsing}", "geslacht"], "then": ["tooltip"]}]}
                },
                {
                    "label": "Geo_id",
                    "data": "geo_id",
                    "show": false
                },
                {
                    "label": "Regio",
                    "data": "regio",
                    "show": false
                },
                {
                    "label": "Jaar",
                    "data": "jaar",
                    "show": true
                },
                {
                    "label": "per 10.000 inw",
                    "data": "per_1e4",
                    "show": true,
                    "numberFormat": 0,
                    "align": "right"
                },
                {
                    "label": "Aantal",
                    "data": "aantal",
                    "show": true,
                    "numberFormat": 0,
                    "align": "right"
                }
            ],
            "select": [
                ["geo_id"],
                ["jaar"],
                ["hoofdcategorie"],
                ["leeftijd"],
                ["geslacht"],
                ["per_1e4"],
                ["regio"],
                ["aantal"]
            ],
            "where": {
                "and": [
                    ["per_1e4", null, "ne"],
                    {
                    "if": [
                        {
                        "condition": ["{opties_ouderenzorg_wachtstatus_uitsplitsing}", "geslacht"],
                        "then": {
                            "and": [
                            ["hoofdcategorie", "{oz_wachtstatus_opties}"],
                            ["geslacht", "Totaal mannen en vrouwen", "ne"]
                            ]
                        }},
                        {
                        "condition": ["{opties_ouderenzorg_wachtstatus_uitsplitsing}", "leeftijd"],
                        "then": {
                            "and": [
                            ["hoofdcategorie", "{oz_wachtstatus_opties}"],
                            ["leeftijd", "Totaal leeftijd", "ne"]
                            ]
                        }}
                    ]
                    }
                ]
                },
            "join": [
                {
                    "dataset": {
                        "type": "local-static-default",
                        "settings": {
                            "src": [
                                "data/regio/ref_gem_regio_gem2023_20240507/ref_gem_regio_gem2023_20240507--NL01.json"
                            ],
                            "select": [
                                [
                                    "geo_nm",
                                    "regio"
                                ]
                            ]
                        }
                    },
                    "on": [
                        "geo_id",
                        "geo_id"
                    ]
                }
            ], "order": ["order"]
        }
    },
    "filters": [
        {
            "identifier": "opties_ouderenzorg_wachtstatus_uitsplitsing",
            "type": "filter-default",
            "settings": {
                "label": "Selecteer een uitsplitsing:",
                "defaultValue": "leeftijd",   
                "dataset": {
                    "type": "local-static-default",
                    "settings": {
                        "src": ["data/filterOpties/filteropties_ouderenzorg_uitsplitsingen_20260729.json"],
                        "where": {
                            "or": [
                                ["value", "leeftijd"],
                                ["value", "geslacht"]
                            ]
                        }
                    }
                }
            }
        }
    ]
}