{
    "debug": false,
    "$schema": "https://cstm.rivm.nl/regiobeeld/Regiobeeld-app-acc/schema/figure-config.schema.json",
    "identifier": "ouderenzorg_pohggz",
    "figure": {
        "type": "figure-highcharts-regiobeeld",
        "title": "<%= mapping['oz_pohggz_opties'][state['oz_pohggz_opties']] %>",
        "subtitle": "65 jaar en ouder",  
        "credits": "{appConfig.credits.Nivel}",
        "watch": [
            "regio_ZK",
            "oz_pohggz_opties"
        ],
        "settings": {
            "series": {
                "name": "regio",
                "zoneAxis": "x",
                "data": [
                    {
                        "x": "jaar",
                        "y": 
                            {"if": [
                                {"condition": ["{oz_pohggz_opties}", "Ouderen die contact hebben met de POH GGZ"],
                                "then": "percentage"},
                                {"condition": ["{oz_pohggz_opties}","Gemiddeld aantal POH GGZ bezoeken van ouderen"],
                                "then": "aantal"}]}
                    }
                ]
            },
            "options": {
                "chart": {
                    "type": "line"
                },
                "yAxis": {
                    "min": 0,
                    "title": {
                        "text": 
                            {"if": [
                                {"condition": ["{oz_pohggz_opties}", "Ouderen die contact hebben met de POH GGZ"],
                                "then": "Percentage (65+)"},
                                {"condition": ["{oz_pohggz_opties}","Gemiddeld aantal POH GGZ bezoeken van ouderen"],
                                "then": "Aantal (65+)"}]}
                    }
                },
            "plotOptions": {
                "line": {
                    "marker": {
                        "enabled": true
                    },
                    "connectNulls": true
                }
            }
            },
            "formatters": {}
        }
    },
    "dataset": {
        "type": "local-static-default",
        "settings": {
            "src": [
                "data/rivm/wozo_ouderenzorg_20260729/wozo_ouderenzorg_20260729--NL01.json",
                "data/rivm/wozo_ouderenzorg_20260729/wozo_ouderenzorg_20260729--{regio_ZK}.json"
            ],
            "tableGrouping": {
                "column": "regio",
                "row": "jaar"
            },
            "columns": [
                {
                    "label": "Regio",
                    "data": "regio",
                    "show": ["tooltip"]
                },
                {
                    "label": "Jaar",
                    "data": "jaar",
                    "show": true
                },
                {
                    "label": "Indicator",
                    "data": "hoofdcategorie",
                    "show": false
                },
                {
                    "label": "Leeftijd",
                    "data": "leeftijd",
                    "show": false
                },
                {
                    "label": "Geslacht",
                    "data": "geslacht",
                    "show": false
                },
                {
                    "label": "Opleidingsniveau",
                    "data": "opleidingsniveau",
                    "show": false
                },
                { 
                    "label": "subcategorie",
                    "data": "subcategorie",
                    "show": false
                },
                { 
                    "label": "Subcategorie2",
                    "data": "subcategorie2",
                    "show": false
                },
                 { 
                    "label": "Subcategorie3",
                    "data": "subcategorie3",
                    "show": false
                },
                { 
                    "label": "Subcategorie4",
                    "data": "subcategorie4",
                    "show": false
                },
                 { 
                    "label": "Subcategorie5",
                    "data": "subcategorie5",
                    "show": false
                },
                {
                    "label": "Percentage",
                    "data": "percentage",
                    "show": {"if": [{"condition": ["{oz_pohggz_opties}", "Ouderen die contact hebben met de POH GGZ"], "then": true},
                                    {"condition": ["{oz_pohggz_opties}", "Gemiddeld aantal POH GGZ bezoeken van ouderen"], "then": false}]},   
                    "numberFormat": 0,
                    "suffix": "%",
                    "align": "right"
                },
                {
                    "label": "Geo_id",
                    "data": "geo_id",
                    "show": false
                },
                {
                    "label": "Aantal",
                    "data": "aantal",
                    "show": {"if": [{"condition": ["{oz_pohggz_opties}", "Ouderen die contact hebben met de POH GGZ"], "then": false},
                                    {"condition": ["{oz_pohggz_opties}", "Gemiddeld aantal POH GGZ bezoeken van ouderen"], "then": true}]},   
                    "numberFormat": 0,
                    "align": "right"
                }
            ],
            "select": [
                ["jaar"],
                ["hoofdcategorie"],
                ["leeftijd"],
                ["geslacht"],
                ["opleidingsniveau"],
                ["subcategorie"],
                ["subcategorie2"],
                ["subcategorie3"],
                ["subcategorie4"],
                ["subcategorie5"],
                ["percentage"],
                ["aantal"],
                ["geo_id"],
                ["regio"]
            ],
            "where": {
            "and": [
                {"or": [["aantal", null, "ne"],["percentage", null, "ne"]]},    
                ["hoofdcategorie","{oz_pohggz_opties}"],
                ["leeftijd","Totaal leeftijd"],
                ["geslacht","Totaal mannen en vrouwen"],
                ["opleidingsniveau","Opleidingsniveau totaal"],
                ["subcategorie","Woonsituatie_Totaal"],
                ["subcategorie2","Huishoudinkomen_Totaal"], 
                ["subcategorie3","Huishoudvermogen_Totaal"],
                ["subcategorie4","SES-WOA_Totaal"],
                ["subcategorie5","Gezondheid_Totaal"]
            ]
            },
            "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_ZK}.json"
                            ],
                            "select": [
                                [
                                    "geo_nm",
                                    "regio"
                                ]
                            ]
                        }
                    },
                    "on": [
                        "geo_id",
                        "geo_id"
                    ]
                }
            ]
        }
    },
    "filters": []
}