Benutzer:Rillke/Sandkasten/vega5

aus Wikipedia, der freien Enzyklopädie

<graph> {

 "$schema": "https://vega.github.io/schema/vega/v5.json",
 "width": 600,
 "height": 200,
 "config": {
   "text": {
     "font": "Ideal Sans, Avenir Next, Helvetica"
   },
   "title": {
     "font": "Ideal Sans, Avenir Next, Helvetica",
     "fontWeight": 500,
     "fontSize": 17,
     "limit": -1
   },
   "axis": {
     "labelFont": "Ideal Sans, Avenir Next, Helvetica",
     "labelFontSize": 12
   }
 },
 "title": {
   "text": "Opencast Veröffentlichungen",
   "orient": "top",
   "anchor": "start",
   "frame": "group"
 },
 "data":[
   {
     "name": "releases",
     "url": "wikidatasparql:///?query=%23defaultView%3ATimeline%0ASELECT%20%3Fdate%20%3Fversion%20%7B%0A%20%20wd%3AQ955212%20p%3AP348%20%5B%20%23%20replace%20Q381%20with%20Wikidata%20identifier%20of%20your%20software%0A%20%20%20%20ps%3AP348%20%3Fversion%20%3B%0A%20%20%20%20pq%3AP577%20%3Fdate%0A%20%20%5D%0A%7D&format=json",
     "format": {"type": "json"},
     "transform": [
       {
         "type": "formula",
         "field": "release_date",
         "as": "release_date",
         "expr": "datetime(datum.date.value)"
       },
       {
         "type": "formula",
         "field": "release_version",
         "as": "release_version",
         "expr": "datum.version.value"
       },
       {
         "type": "formula",
         "field": "release_major",
         "as": "release_major",
         "expr": "1*replace(datum.version.value, /^(\\d+).+/, '$1')"
       },
       {
         "type": "collect",
         "sort": {"field": "version.value"}
       }
     ]
   }
 ],
 "scales": [
   {
     "name": "xScale",
     "type": "time",
     "domain": {"data": "releases","field": "release_date"},
     "range": "width"
   },
   {
     "name": "yScale",
     "type": "linear",
     "domain": {"data": "releases","field": "release_major"},
     "range": "height"
   },
   {
     "name": "colorScale",
     "type": "ordinal",
     "domain": {"data": "releases", "field": "release_major"},
     "range": {"scheme": "category20"}
   }
 ],
 "axes":[
   {
     "scale": "xScale",
     "orient": "bottom"
   },
   {
     "scale": "yScale",
     "orient": "left"
   }
 ],
 "marks":[
   {
     "type": "symbol",
     "name": "dots",
     "from": {"data": "releases"},
     "encode": {
       "enter": {
         "x": {
           "signal": "scale('xScale',datum.release_date)"
         },
         "y": {
           "signal": "scale('yScale',datum.release_major)"
         },
         "fill": {
           "signal": "scale('colorScale', datum.release_major)"
         },
         "tooltip": {"signal": "{'Versionsnummer': datum.release_version, 'Datum': timeFormat(datum.release_date, '%d. %B %Y')}"}
       },
       "update": {
         "fillOpacity": {"value": 1}
       },
       "hover": {
         "fillOpacity": {"value": 0.5}
       }
     }
   }
 ],
 "legends": [
   {
     "title": "Hauptversion",
     "fill": "colorScale",
     "orient": "bottom",
     "direction": "horizontal",
     "encode": {
       "title": {
         "update": {
           "fontSize": {"value": 15}
         }
       },
       "labels": {
         "update": {
           "fontSize": {"value": 12}
         }
       }
     }
   }
 ]

} </graph>