{
  "label": "指标对比",
  "version": "1.0.0",
  "description": "指标对比用于测试",
  "nodes": [
    {
      "name": "行业",
      "engine": "xiang",
      "query": {
        "debug": false,
        "select": [
          "city",
          ":COUNT(id) as 数量",
          "industries[*](string 50) as industry"
        ],
        "from": "$service",
        "wheres": [
          { "field": "created_at", ">": "?:$from.0" },
          { "field": "created_at", "<": "?:$to" }
        ],
        "orders": "数量 desc",
        "limit": 100
      }
    },
    {
      "name": "计费",
      "engine": "xiang",
      "query": {
        "select": ["city", ":COUNT(id) as 数量", "price_options[*] as option"],
        "from": "$service",
        "wheres": [
          { "field": "created_at", ">": "?:$from.0" },
          { "field": "created_at", "<": "?:$to" }
        ],
        "orders": "数量 desc",
        "limit": 100
      }
    },
    {
      "name": "脚本",
      "script": "data",
      "outs": ["{{$out}}", "1"]
    },
    {
      "name": "合并结果",
      "process": "xiang.helper.ArrayPluck",
      "args": [
        ["城市", "行业", "计费"],
        {
          "行业": { "key": "city", "value": "数量", "items": "{{$res.行业}}" },
          "计费": { "key": "city", "value": "数量", "items": "{{$res.计费}}" }
        }
      ]
    }
  ],
  "output": {
    "合并": "{{$res.合并结果}}",
    "计费": "{{$res.计费}}",
    "行业": "{{$res.行业}}",
    "参数": "{{$in}}",
    "脚本": "{{$res.脚本}}",
    "page": true
  },
  "apis": {
    "data": {
      "disable": false,
      "guard": "-",
      "default": [{ "from": "1980-01-02", "to": "2050-12-31" }]
    },
    "setting": {
      "disable": false,
      "guard": "-"
    }
  },
  "filters": {
    "开始时间": {
      "label": "开始时间",
      "bind": "from",
      "input": {
        "type": "date",
        "props": {
          "placeholder": "请选择开始时间"
        }
      }
    },
    "结束时间": {
      "label": "结束时间",
      "bind": "to",
      "input": {
        "type": "date",
        "props": {
          "placeholder": "请选择结束时间"
        }
      }
    }
  },
  "page": {
    "primary": "城市",
    "layout": {
      "filters": [
        { "name": "开始时间", "width": 6 },
        { "name": "结束时间", "width": 6 }
      ],
      "charts": [
        { "type": "line", "props": {} },
        { "type": "bar", "props": {} }
      ]
    },
    "actions": {}
  }
}
