mattijn
8/16/2017 - 2:45 PM

vega3_matrix_doubleInputBinding.json

{
  "$schema": "https://vega.github.io/schema/vega/v3.0.json",
  "autosize": "pad",
  "padding": 5,
  "encode": {
    "update": {
      "stroke": {
        "value": "#ccc"
      },
      "fill": {
        "value": "transparent"
      }
    }
  },
  "data": [
    {
      "name": "source_0",
      "url": "http://85.17.82.66/dataservices/data.asmx/read?database=OMSWaddenzee&key=trendParameters_min_cut",
      "format": {
        "type": "json",
        "parse": {
          "date": "string",
          "value": "number"
        }
      },
      "transform": [
        {
          "type": "filter",
          "expr": "datum.Activity===activiteit"
        },
        {
          "type": "filter",
          "expr": "datum.parameterId===parameter"
        }
      ]
    }
  ],
  "signals": [
    {
      "name": "activiteit",
      "value": "Taak",
      "bind": {
        "input": "select",
        "options": [
          "Taak",
          "Benoemd",
          "Raamact."
        ]
      }
    },
    {
      "name": "parameter",
      "value": "m3.minDepth.cut",
      "bind": {
        "input": "select",
        "options": [
          "pct.opp.minDepth.cut",
          "m3.minDepth.cut",
          "m2.minDepth.cut",
          "cm.avg.minDepth.cut"
        ]
      }
    },
    {
      "name": "x_step",
      "value": 17
    },
    {
      "name": "width",
      "update": "bandspace(domain('x').length, 0, -0.05) * x_step"
    },
    {
      "name": "y_step",
      "value": 17
    },
    {
      "name": "height",
      "update": "bandspace(domain('y').length, 0, -0.05) * y_step"
    }
  ],
  "marks": [
    {
      "name": "marks",
      "type": "rect",
      "from": {
        "data": "source_0"
      },
      "encode": {
        "update": {
          "x": {
            "scale": "x",
            "field": "date"
          },
          "y": {
            "scale": "y",
            "field": "stationName"
          },
          "width": {
            "scale": "x",
            "band": 1,
            "offset": -1.25
          },
          "height": {
            "scale": "y",
            "band": 1,
            "offset": -1.25
          },
          "fill": {
            "scale": "color",
            "field": "value"
          },
          "stroke": {
            "value": "#000"
          },
          "strokeWidth": {
            "value": 0.15
          }
        },
        "hover": {
          "stroke": {
            "value": "#000"
          },
          "strokeWidth": {
            "value": 2
          }
        }
      }
    }
  ],
  "scales": [
    {
      "name": "x",
      "type": "band",
      "domain": {
        "data": "source_0",
        "field": "date",
        "sort": true
      },
      "range": {
        "step": {
          "signal": "x_step"
        }
      }
    },
    {
      "name": "y",
      "type": "band",
      "domain": {
        "data": "source_0",
        "field": "stationName",
        "sort": true
      },
      "range": {
        "step": {
          "signal": "y_step"
        }
      }
    },
    {
      "name": "color",
      "type": "linear",
      "domain": [
        0,
        1,
        100,
        300,
        1000,
        3000,
        7000
      ],
      "range": [
        "white",
        "#F0F8FF",
        "cornflowerblue",
        "mediumseagreen",
        "#FFEE00",
        "darkorange",
        "firebrick"
      ],
      "nice": false,
      "zero": false
    }
  ],
  "axes": [
    {
      "scale": "x",
      "orient": "top",
      "tickCount": 5,
      "offset": 0,
      "zindex": 1,
      "encode": {
        "domain": {
          "update": {
            "strokeWidth": {
              "value": 0
            }
          }
        },
        "ticks": {
          "update": {
            "strokeWidth": {
              "value": 0
            }
          }
        },
        "labels": {
          "update": {
            "angle": {
              "value": 45
            },
            "fontSize": {
              "value": 12
            },
            "align": {
              "value": "right"
            },
            "baseline": {
              "value": "middle"
            }
          }
        }
      }
    },
    {
      "scale": "y",
      "offset": 0,
      "orient": "left",
      "zindex": 1,
      "encode": {
        "domain": {
          "update": {
            "strokeWidth": {
              "value": 0
            }
          }
        },
        "ticks": {
          "update": {
            "strokeWidth": {
              "value": 0
            }
          }
        },
        "labels": {
          "update": {
            "limit": {
              "value": 256
            },
            "fontSize": {
              "value": 12
            }
          }
        }
      }
    }
  ],
  "legends": [
    {
      "fill": "color",
      "orient": "bottom",
      "title": "kuubs [m3]",
      "type": "gradient",
      "format": "s",
      "values": [
        0,
        3000,
        5000,
        7000
      ]
    }
  ],
  "config": {
    "axis": {
      "quantitativeExtent": 30
    }
  }
}