{
  "debug": false,
  "$schema": "https://cstm.rivm.nl/regiobeeld/Regiobeeld-app-acc/schema/figure-config.schema.json",
  "identifier": "gezondheidsmonitor_eenzaam_trend",
  "figure": {
    "type": "figure-highcharts-regiobeeld",
    "title": "<%= state.config.dataset.data[0].hoofdcategorie %>",
    "subtitle": "<%= state.config.dataset.data[0].leeftijd %>",
    "credits": "{appConfig.credits.Statline_rivm_50150NED_eenzaam}",
    "watch": [
      "regio",
      "GM_filteropties_eenzaam"
    ],
    "settings": {
      "series": {
        "name": "regio",
        "zoneAxis": "x",
        "data": [
          {
            "x": "jaar",
            "y": "percentage"
          }
        ]
      },
      "options": {
        "chart": {
          "type": "line"
        },
        "colors": {
          "if": [
            {
              "condition": ["{gwb}","GM"],
              "then": "{appConfig.colorPalettes.qualitative}"
            },
            {
              "condition": ["{gwb}", ["WK","BU"],"in"],
              "then": "{appConfig.colorPalettes.qualitative_wijkbuurt}"
            }
          ]
        },
        "plotOptions": {
          "line": {
            "marker": {
              "enabled": true
            }
          }
        },
        "yAxis": {
          "min": 0,
          "title": {
            "text": "Percentage"
          }
        },
        "xAxis": {
          "min": 2012,
          "max": 2024,
          "tickInterval": 2
        }
      },
      "formatters": {}
    }
  },
  "dataset": {
    "type": "local-static-default",
    "settings": {
      "src": {
        "if": [
          {
            "condition": [
              "{gwb}",
              "GM"
            ],
            "then": [
              "data/statline/gem_gezondheidsmonitor_20260318/gem_gezondheidsmonitor_20260318--NL01.json",
              "data/statline/gem_gezondheidsmonitor_20260318/gem_gezondheidsmonitor_20260318--{regio}.json"
            ]
          },
          {
            "condition": [
              "{gwb}",
              ["WK","BU"],
              "in"
            ],
            "then": [
              "data/statline/gem_gezondheidsmonitor_20260318/gem_gezondheidsmonitor_20260318--NL01.json",
              "data/statline/gem_gezondheidsmonitor_20260318/gem_gezondheidsmonitor_20260318--{regio}.json",
              "data/statline/gem_gezondheidsmonitor_20260318/gem_gezondheidsmonitor_20260318--{gm}.json"
            ]
          }
        ]
      },
      "tableGrouping": {
        "column": "regio",
        "row": "jaar"
      },
      "columns": [
        {
          "data": "regio",
          "label": "Regio",
          "show": ["tooltip"]
        },
        {
          "data": "gwb_id",
          "label": "gwb_id",
          "show": false
        },
        {
          "data": "geo_id",
          "label": "geo_id",
          "show": false
        },
        {
          "data": "jaar",
          "label": "Jaar",
          "show": true
        },
        {
          "label": "Percentage",
          "data": "percentage",
          "show": true,
          "numberFormat": 0,
          "align": "right",
          "suffix": "%"
        }
      ],
      "select": [
        [
          "geo_id"
        ],
        [
          "jaar"
        ],
        [
          "hoofdcategorie"
        ],
        [
          "leeftijd"
        ],
        [
          "percentage"
        ],
        [
          "geo_name",
          "regio"
        ],
        [
          "geo_id",
          "gwb_id"
        ]
      ],
      "union": {
        "if": [
          {
            "condition": [
              "{gwb}",
              ["WK","BU"],
              "in"
            ],
            "then": [
              {
                "dataset": {
                  "type": "local-static-default",
                  "settings": {
                    "src": [
                      "data/statline/gem_gezondheidsmonitor_20260318/gem_gezondheidsmonitor_20260318--{gm}.json",
                      "data/statline/wb_gezondheidsmonitor_20260318/wb_gezondheidsmonitor_20260318--{gm}.json"
                    ],
                    "select": [
                      [
                        "gwb_id",
                        "geo_id"
                      ],
                      [
                        "jaar"
                      ],
                      [
                        "percentage"
                      ],
                      [
                        "gwb_id"
                      ]
                    ]
                  }
                }
              }
            ]
          }
        ]
      },
      "where": {
        "if": [
          {
            "condition": ["{gwb}","GM"],
            "then": ["hoofdcategorie","{GM_filteropties_eenzaam}"]
          },
          {
            "condition": ["{gwb}","WK"],
            "then": {
              "and": [
                ["hoofdcategorie","{GM_filteropties_eenzaam}"],
                {
                  "or": [
                    ["gwb_id","{wk}"],
                    ["gwb_id","{gm}"]
                  ]
                }
              ]
            }
          },
          {
            "condition": ["{gwb}","BU"],
            "then": {
              "and": [
                ["hoofdcategorie","{GM_filteropties_eenzaam}"],
                {
                  "or": [
                    ["gwb_id","{wk}"],
                    ["gwb_id","{gm}"],
                    ["gwb_id","{bu}"]
                  ]
                }
              ]
            }
          }
        ]
      },
      "join": [
        {
          "dataset": {
            "ref": "config/refs/rwb_wfs_ref.json"
          },
          "on": ["geo_id","geo_id"]
        }
      ]
    }
  }
}