Git Product home page Git Product logo

Comments (2)

ajturner avatar ajturner commented on August 25, 2024

vega_live_editor

{
  "width": 700,
  "height": 400,
  "data": [
    {
      "name": "crimes",
      "url": "http://maps2.dcgis.dc.gov/dcgis/rest/services/FEEDS/CDW_Feeds/MapServer/8/query?where=1%3D1&outFields=REPORTDATETIME%2CWARD&returnGeometry=false&f=pjson",
      "format": {"type": "json", "property": "features", "parse": {"attributes.REPORTDATETIME":"date"}}
    }
  ],
  "scales": [
    {
      "name": "x",
      "type": "time",
      "round": true,
      "range": "width",
      "domain": {"data": "crimes", "field": "data.attributes.REPORTDATETIME"}
    },
    {
      "name": "y",
      "type": "linear",
      "nice": true,
      "range": "width",
      "domain": {"data": "crimes", "field": "data.attributes.WARD"}
    },    
    {
      "name": "c",
      "type": "ordinal",
      "range": "category10"
    }
  ],
  "axes": [
    {"type": "x", "scale": "x"},
    {"type": "y", "scale": "y"}
  ],
  "marks": [
    {
      "type": "symbol",
      "from": {"data": "crimes"},
      "properties": {
        "enter": {
          "x": {"scale": "x", "field": "data.attributes.REPORTDATETIME"},
          "y": {"scale": "y", "field": "data.attributes.WARD"},
          "size": {"value": 50},
          "stroke": {"scale": "c", "field": "data.attributes.WARD"},
          "strokeWidth": {"value": 2}
        }
      }
    }
  ]
}

from cedar.

ajturner avatar ajturner commented on August 25, 2024

Another type:

vega_live_editor

{
  "width": 700,
  "height": 700,
  "data": [
    {
      "name": "crimes",
      "url": "http://maps2.dcgis.dc.gov/dcgis/rest/services/FEEDS/CDW_Feeds/MapServer/8/query?where=1%3D1&outFields=OFFENSE%2CSHIFT%2CREPORTDATETIME%2CWARD&returnGeometry=false&f=pjson",
      "format": {"type": "json", "property": "features", "parse": {"attributes.REPORTDATETIME":"date"}}
    },
    {
      "name": "variety",
      "source": "crimes",
      "transform": [
        {"type": "facet", "keys": ["data.attributes.OFFENSE"]}
      ]
    },
    {
      "name": "ward",
      "source": "crimes",
      "transform": [
        {"type": "sort", "by": "data.attributes.WARD"},
        {"type": "facet", "keys": ["data.attributes.WARD"]}
      ]
    }    
  ],
  "scales": [
    {
      "name": "g",
      "type": "ordinal",
      "range": "height",
      "padding": 0.15,
      "domain": {"data": "ward", "field": "key"}
    },    
    {
      "name": "x",
      "type": "time",
      "round": true,
      "range": "width",
      "domain": {"data": "crimes", "field": "data.attributes.REPORTDATETIME"}
    },  
    {
      "name": "c",
      "type": "ordinal",
      "range": "category10"
    }
  ],
  "axes": [
    {"type": "x", "scale": "x"}
  ],
  "legends": [
    {
      "fill": "c",
      "title": "Shift",
      "offset": 0,
      "properties": {
        "symbols": {
          "fillOpacity": {
            "value": 0.5
          },
          "stroke": {
            "value": "transparent"
          }
        }
      }
    }
  ],  
  "marks": [
    {
      "type": "text",
      "from": {"data": "crimes"},
      "properties": {
        "enter": {
          "x": {"group": "width", "mult": 0.5},
          "y": {"scale": "g", "field": "data.attributes.WARD", "offset": -2},
          "fontWeight": {"value": "bold"},
          "text": {"field": "data.attributes.WARD"},
          "align": {"value": "center"},
          "baseline": {"value": "bottom"},
          "fill": {"value": "#000"}
        }
      }
    },
    {
      "type": "group",
      "from": {"data": "ward"},
      "scales": [
        {
          "name": "y",
          "type": "ordinal",
          "range": "height",
          "points": true,
          "padding": 1.2,
          "domain": {"data": "variety", "field": "key"}
        }
      ],
      "axes": [
        {
          "type": "y",
          "scale": "y",
          "tickSize": 0,
          "properties": {"axis": {"stroke": {"value": "transparent"}}}
        }
      ],
      "properties": {
        "enter": {
          "x": {"value": 0.5},
          "y": {"scale": "g", "field": "key"},
          "height": {"scale": "g", "band": true},
          "width": {"group": "width"},
          "stroke": {"value": "#ccc"}
        }
      },
      "marks": [
        {
          "type": "symbol",
          "properties": {
            "enter": {
              "x": {"scale": "x", "field": "data.attributes.REPORTDATETIME"},
              "y": {"scale": "y", "field": "data.attributes.OFFENSE"},
              "size": {"value": 50},
              "stroke": {"scale": "c", "field": "data.attributes.SHIFT"},
              "strokeWidth": {"value": 2}
            }
          }
        }
      ]
    }
  ]
}

from cedar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.