├── .dockerignore ├── .eslintrc ├── .gitignore ├── Dockerfile ├── LICENSE ├── Makefile ├── README.md ├── app.json ├── charts ├── Bar.js ├── DemographicBar.js ├── DistrictBar.js ├── VegaLite.js └── ZurichMap.js ├── docs ├── chihuahua.jpg ├── example.csv ├── example.html ├── labrador-retriever.jpg ├── playground.gif └── zurich.jpg ├── index.js └── package.json /.dockerignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | npm-debug.log 4 | .env 5 | docs 6 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint:recommended", 3 | "env": { 4 | "es6": true, 5 | "node": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | npm-debug.log 4 | .env 5 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:6.9.1-wheezy 2 | 3 | WORKDIR /tmp 4 | 5 | RUN apt-get update 6 | RUN apt-get -y install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++ 7 | 8 | RUN mkdir -p /usr/src/app 9 | WORKDIR /usr/src/app 10 | 11 | COPY package.json /usr/src/app/ 12 | RUN npm install --production 13 | 14 | COPY . /usr/src/app 15 | 16 | EXPOSE 3000 17 | CMD [ "npm", "start" ] 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016-present, Interactive Things GmbH 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | * Neither the name of Interactive Things GmbH nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 9 | 10 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 11 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: server install lint 2 | 3 | server: install 4 | $$(npm bin)/nodemon 5 | 6 | lint: 7 | @$$(npm bin)/eslint . 8 | 9 | install: node_modules 10 | 11 | node_modules: package.json 12 | @npm install 13 | @touch $@ 14 | 15 | docs/example.csv: 16 | $$(npm bin)/gsheets \ 17 | --key=1Mt6xzEGcuO9cusTUB3q3JwhNOZbhwHK71TfpOaUWS9c --title=charts \ 18 | --out $@ --csv 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Chart Server 2 | 3 | A server for a light-weight charting system. 4 | 5 | [](https://docs.google.com/spreadsheets/d/18ByaFrHDh7y0_nY-mFrk05Nx21e0UBAWe-qKfd2tAL8/edit#gid=0) 6 | 7 | Read «[Roll your own charting system](https://blog.interactivethings.com/69f5753efc1c)» on the Interactive Things blog to learn more. 8 | 9 | ## Chart Types 10 | 11 | You can render any Vega-Lite specification to SVG by sending it to `/VegaLite` with the `spec` query paramter. 12 | 13 | Example: 14 | ```json 15 | { 16 | "description": "A simple bar chart with embedded data.", 17 | "data": { 18 | "values": [ 19 | {"a": "A","b": 28}, {"a": "B","b": 55}, {"a": "C","b": 43}, 20 | {"a": "D","b": 91}, {"a": "E","b": 81}, {"a": "F","b": 53}, 21 | {"a": "G","b": 19}, {"a": "H","b": 87}, {"a": "I","b": 52} 22 | ] 23 | }, 24 | "mark": "bar", 25 | "encoding": { 26 | "x": {"field": "a", "type": "ordinal"}, 27 | "y": {"field": "b", "type": "quantitative"} 28 | } 29 | } 30 | ``` 31 | 32 |  33 | 34 | Additionally three example chart types, `Bar`, `DemographicBar` and `DistrictBar`, built on top of Vega-Lite and one, `ZurichMap`, build on top of Vega are provided in the [`charts` folder](https://github.com/interactivethings/chart-server/tree/master/charts). There is also a example [essay](https://interactivethings.github.io/chart-server/example.html) and [spreadsheet](https://docs.google.com/spreadsheets/d/1Mt6xzEGcuO9cusTUB3q3JwhNOZbhwHK71TfpOaUWS9c/edit?usp=sharing) available utilizing those types. 35 | 36 | ## Prerequisites 37 | 38 | - make 39 | - [Node.js](https://nodejs.org/) (v6) 40 | - [Cairo](https://github.com/Automattic/node-canvas#installation) 41 | 42 | ## Develop 43 | 44 | Install dependencies and start the development server 45 | 46 | ``` 47 | make 48 | ``` 49 | 50 | ## Deploy 51 | 52 | The repository contains a `Dockerfile` and `app.json` manifesto and can easily be deployed. 53 | 54 | - [▲ ZEIT `now --docker`](https://zeit.co/now) 55 | - [Deploy to Heroku](https://heroku.com/deploy) 56 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "buildpacks": [ 3 | { 4 | "url": "https://github.com/mojodna/heroku-buildpack-cairo.git" 5 | }, 6 | { 7 | "url": "heroku/nodejs" 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /charts/Bar.js: -------------------------------------------------------------------------------- 1 | const VegaLite = require('./VegaLite'); 2 | 3 | const defaults = { 4 | data: undefined, 5 | filter: undefined, 6 | y: undefined, 7 | aggregate: undefined, 8 | value: undefined, 9 | valueTitle: undefined, 10 | facet: undefined, 11 | facetTitle: undefined 12 | }; 13 | 14 | module.exports = ({spec}) => { 15 | const cfg = Object.assign({}, defaults, spec); 16 | 17 | return VegaLite({ 18 | spec: { 19 | config: {axis: {characterWidth: 0}}, 20 | data: { 21 | url: cfg.data 22 | }, 23 | transform: { 24 | filter: cfg.filter, 25 | calculate: [ 26 | cfg.facet && {field: 'facet', 'expr': cfg.facet}, 27 | cfg.y && {field: 'y', 'expr': cfg.y}, 28 | cfg.value && {field: 'value', 'expr': cfg.value} 29 | ].filter(Boolean) 30 | }, 31 | mark: 'bar', 32 | encoding: { 33 | column: cfg.facet && {title: cfg.facetTitle || cfg.facet, field: 'facet', type: 'nominal'}, 34 | x: { 35 | title: cfg.valueTitle, aggregate: cfg.aggregate, 36 | field: cfg.aggregate === 'count' ? '*' : 'value', type: 'quantitative' 37 | }, 38 | y: { 39 | title: false, field: 'y', type: 'ordinal', 40 | axis: {axisWidth: 0, tickSize: 0, labelAngle: 0}, 41 | sort: { 42 | op: cfg.aggregate, 43 | field: cfg.aggregate === 'count' ? '*' : 'value', 44 | order: 'descending' 45 | } 46 | } 47 | } 48 | } 49 | }); 50 | }; 51 | -------------------------------------------------------------------------------- /charts/DemographicBar.js: -------------------------------------------------------------------------------- 1 | const VegaLite = require('./VegaLite'); 2 | 3 | const defaults = { 4 | data: undefined, 5 | filter: undefined, 6 | age: undefined, 7 | sex: undefined, 8 | aggregate: 'sum', 9 | value: undefined, 10 | valueTitle: 'Population', 11 | bandSize: 21, 12 | facet: undefined, 13 | facetTitle: undefined, 14 | orient: 'vertical' 15 | }; 16 | 17 | module.exports = ({spec}) => { 18 | const cfg = Object.assign({}, defaults, spec); 19 | 20 | return VegaLite({ 21 | spec: { 22 | config: {axis: {characterWidth: 0}}, 23 | data: { 24 | url: cfg.data 25 | }, 26 | transform: { 27 | filter: cfg.filter, 28 | calculate: [ 29 | cfg.facet && {field: 'facet', 'expr': cfg.facet}, 30 | cfg.age && {field: 'age', 'expr': cfg.age}, 31 | cfg.sex && {field: 'sex', 'expr': cfg.sex}, 32 | cfg.value && {field: 'value', 'expr': cfg.value}, 33 | ].filter(Boolean) 34 | }, 35 | mark: 'bar', 36 | encoding: { 37 | [cfg.orient === 'vertical' ? 'column' : 'row']: 38 | cfg.facet && {title: cfg.facetTitle || cfg.facet, field: 'facet', type: 'nominal'}, 39 | [cfg.orient === 'vertical' ? 'row' : 'column']: 40 | {title: 'Gender', field: 'sex', type: 'nominal'}, 41 | color: { 42 | field: 'sex', 43 | type: 'nominal', 44 | legend: false, 45 | scale: {range: ['#EA98D2', '#659CCA']} 46 | }, 47 | x: { 48 | title: 'Age', field: 'age', type: 'ordinal', 49 | axis: {axisWidth: 0, tickSize: 0}, 50 | scale: {bandSize: cfg.bandSize} 51 | }, 52 | y: { 53 | title: cfg.valueTitle, 54 | aggregate: cfg.aggregate, 55 | field: cfg.aggregate === 'count' ? '*' : 'value', 56 | type: 'quantitative' 57 | } 58 | } 59 | } 60 | }); 61 | }; 62 | -------------------------------------------------------------------------------- /charts/DistrictBar.js: -------------------------------------------------------------------------------- 1 | const VegaLite = require('./VegaLite'); 2 | 3 | const defaults = { 4 | data: undefined, 5 | filter: undefined, 6 | district: undefined, 7 | aggregate: undefined, 8 | value: undefined, 9 | valueTitle: undefined, 10 | facet: undefined, 11 | facetTitle: undefined 12 | }; 13 | 14 | module.exports = ({spec}) => { 15 | const cfg = Object.assign({}, defaults, spec); 16 | 17 | return VegaLite({ 18 | spec: { 19 | config: {axis: {characterWidth: 0}}, 20 | data: { 21 | url: cfg.data 22 | }, 23 | transform: { 24 | filter: cfg.filter, 25 | calculate: [ 26 | cfg.facet && {field: 'facet', 'expr': cfg.facet}, 27 | cfg.district && {field: 'district', 'expr': cfg.district}, 28 | cfg.value && {field: 'value', 'expr': cfg.value} 29 | ].filter(Boolean) 30 | }, 31 | mark: 'bar', 32 | encoding: { 33 | column: cfg.facet && {title: cfg.facetTitle || cfg.facet, field: 'facet', type: 'nominal'}, 34 | x: { 35 | title: 'District', field: 'district', type: 'ordinal', 36 | axis: {axisWidth: 0, tickSize: 0, labelAngle: 0} 37 | }, 38 | y: { 39 | title: cfg.valueTitle, aggregate: cfg.aggregate, 40 | field: cfg.aggregate === 'count' ? '*' : 'value', type: 'quantitative' 41 | } 42 | } 43 | } 44 | }); 45 | }; 46 | -------------------------------------------------------------------------------- /charts/VegaLite.js: -------------------------------------------------------------------------------- 1 | const vegaLite = require('vega-lite'); 2 | 3 | module.exports = ({spec}) => { 4 | return vegaLite.compile(spec).spec; 5 | }; 6 | -------------------------------------------------------------------------------- /charts/ZurichMap.js: -------------------------------------------------------------------------------- 1 | const defaults = { 2 | topojson: 'https://gist.githubusercontent.com/tpreusse/e4c166de85211a2a9294207acd23210c/raw/682266b75fc1970025e65a7312eff57c0d4fe8f6/map.topojson' 3 | }; 4 | 5 | module.exports = ({spec}) => { 6 | const cfg = Object.assign({}, defaults, spec); 7 | 8 | const projection = { 9 | projection: 'mercator', 10 | scale: 160000, 11 | translate: [290, 310], 12 | center: [8.55, 47.366667] 13 | }; 14 | 15 | return { 16 | width: 520, 17 | height: 520, 18 | padding: 'auto', 19 | data: [ 20 | { 21 | name: 'districts', 22 | url: cfg.topojson, 23 | format: {type: 'topojson', feature: 'districts'}, 24 | transform: [ 25 | Object.assign({ 26 | type: 'geopath' 27 | }, projection) 28 | ] 29 | }, 30 | { 31 | name: 'lake', 32 | url: cfg.topojson, 33 | format: {type: 'topojson', feature: 'lake'}, 34 | transform: [ 35 | Object.assign({ 36 | type: 'geopath' 37 | }, projection) 38 | ] 39 | }, 40 | { 41 | name: 'points', 42 | url: cfg.data, 43 | format: {type: 'csv', parse: 'auto'}, 44 | transform: [ 45 | Object.assign({ 46 | type: 'geo', 47 | lon: 'lon', lat: 'lat' 48 | }, projection) 49 | ] 50 | } 51 | ], 52 | scales: cfg.category ? [ 53 | { 54 | name: 'color', 55 | type: 'ordinal', 56 | range: 'category10', 57 | domain: {data: 'points', field: cfg.category} 58 | } 59 | ] : undefined, 60 | legends: cfg.category ? [ 61 | { 62 | fill: 'color', 63 | properties: { 64 | legend: { 65 | x: {value: 400}, 66 | y: {value: 30} 67 | }, 68 | symbols: { 69 | stroke: {value: 'transparent'} 70 | } 71 | } 72 | } 73 | ] : undefined, 74 | marks: [ 75 | { 76 | type: 'path', 77 | from: {data: 'districts'}, 78 | properties: { 79 | enter: { 80 | fill: {value: '#dedede'}, 81 | stroke: {value: 'white'} 82 | }, 83 | update: { 84 | path: {field: 'layout_path'} 85 | } 86 | } 87 | }, 88 | { 89 | type: 'path', 90 | from: {data: 'lake'}, 91 | properties: { 92 | enter: { 93 | fill: {value: 'white'} 94 | }, 95 | update: { 96 | path: {field: 'layout_path'} 97 | } 98 | } 99 | }, 100 | { 101 | type: 'symbol', 102 | from: {data: 'points'}, 103 | properties: { 104 | enter: { 105 | size: {value: 50}, 106 | fill: cfg.category ? {scale: 'color', field: cfg.category} : {value: 'steelblue'}, 107 | fillOpacity: {value: 0.8}, 108 | stroke: {value: 'white'}, 109 | strokeWidth: {value: 1} 110 | }, 111 | update: { 112 | x: {field: 'layout_x'}, 113 | y: {field: 'layout_y'} 114 | } 115 | } 116 | } 117 | ] 118 | }; 119 | }; 120 | -------------------------------------------------------------------------------- /docs/chihuahua.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/interactivethings/chart-server/4d3f29b9b6bef653ef270b4da006d4025b30e3a2/docs/chihuahua.jpg -------------------------------------------------------------------------------- /docs/example.csv: -------------------------------------------------------------------------------- 1 | id,title,source,type,specification,output,src,undefined 2 | pop-1,Population 2015 by District,https://data.stadt-zuerich.ch/dataset/bev_bestand_jahr_quartier_alter_herkunft_geschlecht,DistrictBar,"{ 3 | ""data"": ""https://gist.githubusercontent.com/tpreusse/a0c00ad2a585994f3e8ecfa4a2f8cff8/raw/55185e48f723c0792b3d5a557559eae847e20cc7/bevbestandjahrquartieralterherkunftgeschlecht-optimized.csv"", 4 | ""filter"": ""datum.StichtagDatJahr == 2015"", 5 | ""district"": ""+slice(datum.QuarCd, 0, 2)"", 6 | ""aggregate"": ""sum"", 7 | ""value"": ""+datum.AnzBestWir"", 8 | ""valueTitle"": ""Population"" 9 | } ",,https://chart-server.now.sh/DistrictBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2Fa0c00ad2a585994f3e8ecfa4a2f8cff8%2Fraw%2F55185e48f723c0792b3d5a557559eae847e20cc7%2Fbevbestandjahrquartieralterherkunftgeschlecht-optimized.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.StichtagDatJahr%20%3D%3D%202015%22%2C%0A%20%20%22district%22%3A%20%22%2Bslice(datum.QuarCd%2C%200%2C%202)%22%2C%0A%20%20%22aggregate%22%3A%20%22sum%22%2C%0A%20%20%22value%22%3A%20%22%2Bdatum.AnzBestWir%22%2C%0A%20%20%22valueTitle%22%3A%20%22Population%22%0A%7D%20,http://localhost:3000/DistrictBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2Fa0c00ad2a585994f3e8ecfa4a2f8cff8%2Fraw%2F55185e48f723c0792b3d5a557559eae847e20cc7%2Fbevbestandjahrquartieralterherkunftgeschlecht-optimized.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.StichtagDatJahr%20%3D%3D%202015%22%2C%0A%20%20%22district%22%3A%20%22%2Bslice(datum.QuarCd%2C%200%2C%202)%22%2C%0A%20%20%22aggregate%22%3A%20%22sum%22%2C%0A%20%20%22value%22%3A%20%22%2Bdatum.AnzBestWir%22%2C%0A%20%20%22valueTitle%22%3A%20%22Population%22%0A%7D%20 10 | pop-1b,Population 2015 Total,https://data.stadt-zuerich.ch/dataset/bev_bestand_jahr_quartier_alter_herkunft_geschlecht,VegaLite,"{ 11 | ""data"": { 12 | ""url"": ""https://gist.githubusercontent.com/tpreusse/a0c00ad2a585994f3e8ecfa4a2f8cff8/raw/55185e48f723c0792b3d5a557559eae847e20cc7/bevbestandjahrquartieralterherkunftgeschlecht-optimized.csv"" 13 | }, 14 | ""transform"": { 15 | ""filter"": ""datum.StichtagDatJahr == 2015"" 16 | }, 17 | ""mark"": ""text"", 18 | ""encoding"": { 19 | ""text"": {""aggregate"": ""sum"", ""field"": ""AnzBestWir"", ""type"": ""quantitative""} 20 | } 21 | } ",,https://chart-server.now.sh/VegaLite?spec=%7B%0A%20%20%22data%22%3A%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2Fa0c00ad2a585994f3e8ecfa4a2f8cff8%2Fraw%2F55185e48f723c0792b3d5a557559eae847e20cc7%2Fbevbestandjahrquartieralterherkunftgeschlecht-optimized.csv%22%0A%20%20%7D%2C%0A%20%20%22transform%22%3A%20%7B%0A%20%20%20%20%22filter%22%3A%20%22datum.StichtagDatJahr%20%3D%3D%202015%22%0A%20%20%7D%2C%0A%20%20%22mark%22%3A%20%22text%22%2C%0A%20%20%22encoding%22%3A%20%7B%0A%20%20%20%20%22text%22%3A%20%7B%22aggregate%22%3A%20%22sum%22%2C%20%22field%22%3A%20%22AnzBestWir%22%2C%20%22type%22%3A%20%22quantitative%22%7D%0A%20%20%7D%0A%7D%20,http://localhost:3000/VegaLite?spec=%7B%0A%20%20%22data%22%3A%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2Fa0c00ad2a585994f3e8ecfa4a2f8cff8%2Fraw%2F55185e48f723c0792b3d5a557559eae847e20cc7%2Fbevbestandjahrquartieralterherkunftgeschlecht-optimized.csv%22%0A%20%20%7D%2C%0A%20%20%22transform%22%3A%20%7B%0A%20%20%20%20%22filter%22%3A%20%22datum.StichtagDatJahr%20%3D%3D%202015%22%0A%20%20%7D%2C%0A%20%20%22mark%22%3A%20%22text%22%2C%0A%20%20%22encoding%22%3A%20%7B%0A%20%20%20%20%22text%22%3A%20%7B%22aggregate%22%3A%20%22sum%22%2C%20%22field%22%3A%20%22AnzBestWir%22%2C%20%22type%22%3A%20%22quantitative%22%7D%0A%20%20%7D%0A%7D%20 22 | pop-1c,Population 2015 District 11,https://data.stadt-zuerich.ch/dataset/bev_bestand_jahr_quartier_alter_herkunft_geschlecht,VegaLite,"{ 23 | ""data"": { 24 | ""url"": ""https://gist.githubusercontent.com/tpreusse/a0c00ad2a585994f3e8ecfa4a2f8cff8/raw/55185e48f723c0792b3d5a557559eae847e20cc7/bevbestandjahrquartieralterherkunftgeschlecht-optimized.csv"" 25 | }, 26 | ""transform"": { 27 | ""filter"": ""datum.StichtagDatJahr == 2015 && slice(datum.QuarCd, 0, 2) == '11'"" 28 | }, 29 | ""mark"": ""text"", 30 | ""encoding"": { 31 | ""text"": {""aggregate"": ""sum"", ""field"": ""AnzBestWir"", ""type"": ""quantitative""} 32 | } 33 | } ",,https://chart-server.now.sh/VegaLite?spec=%7B%0A%20%20%22data%22%3A%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2Fa0c00ad2a585994f3e8ecfa4a2f8cff8%2Fraw%2F55185e48f723c0792b3d5a557559eae847e20cc7%2Fbevbestandjahrquartieralterherkunftgeschlecht-optimized.csv%22%0A%20%20%7D%2C%0A%20%20%22transform%22%3A%20%7B%0A%20%20%20%20%22filter%22%3A%20%22datum.StichtagDatJahr%20%3D%3D%202015%20%26%26%20slice(datum.QuarCd%2C%200%2C%202)%20%3D%3D%20'11'%22%0A%20%20%7D%2C%0A%20%20%22mark%22%3A%20%22text%22%2C%0A%20%20%22encoding%22%3A%20%7B%0A%20%20%20%20%22text%22%3A%20%7B%22aggregate%22%3A%20%22sum%22%2C%20%22field%22%3A%20%22AnzBestWir%22%2C%20%22type%22%3A%20%22quantitative%22%7D%0A%20%20%7D%0A%7D%20,http://localhost:3000/VegaLite?spec=%7B%0A%20%20%22data%22%3A%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2Fa0c00ad2a585994f3e8ecfa4a2f8cff8%2Fraw%2F55185e48f723c0792b3d5a557559eae847e20cc7%2Fbevbestandjahrquartieralterherkunftgeschlecht-optimized.csv%22%0A%20%20%7D%2C%0A%20%20%22transform%22%3A%20%7B%0A%20%20%20%20%22filter%22%3A%20%22datum.StichtagDatJahr%20%3D%3D%202015%20%26%26%20slice(datum.QuarCd%2C%200%2C%202)%20%3D%3D%20'11'%22%0A%20%20%7D%2C%0A%20%20%22mark%22%3A%20%22text%22%2C%0A%20%20%22encoding%22%3A%20%7B%0A%20%20%20%20%22text%22%3A%20%7B%22aggregate%22%3A%20%22sum%22%2C%20%22field%22%3A%20%22AnzBestWir%22%2C%20%22type%22%3A%20%22quantitative%22%7D%0A%20%20%7D%0A%7D%20 34 | income-1,Median Income 2012 by District,https://data.stadt-zuerich.ch/dataset/fd-median-einkommen-kreis,DistrictBar,"{ 35 | ""data"": ""https://gist.githubusercontent.com/tpreusse/718e1268529173a03cd4a01865f15ffa/raw/54e1deb2e13b4374c05661d8d05f557bd2e715dc/test.csv"", 36 | ""filter"": ""datum.SteuerJahr == 2012 && datum.SteuerTarifLang == 'Grundtarif'"", 37 | ""district"": ""+datum.KreisSort"", 38 | ""value"": ""datum.SteuerEinkommen_p50 * 1000"", 39 | ""valueTitle"": ""Median Taxable Income (Basic Rate)"" 40 | } ",,https://chart-server.now.sh/DistrictBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2F718e1268529173a03cd4a01865f15ffa%2Fraw%2F54e1deb2e13b4374c05661d8d05f557bd2e715dc%2Ftest.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.SteuerJahr%20%3D%3D%202012%20%26%26%20datum.SteuerTarifLang%20%3D%3D%20'Grundtarif'%22%2C%0A%20%20%22district%22%3A%20%22%2Bdatum.KreisSort%22%2C%0A%20%20%22value%22%3A%20%22datum.SteuerEinkommen_p50%20*%201000%22%2C%0A%20%20%22valueTitle%22%3A%20%22Median%20Taxable%20Income%20(Basic%20Rate)%22%0A%7D%20,http://localhost:3000/DistrictBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2F718e1268529173a03cd4a01865f15ffa%2Fraw%2F54e1deb2e13b4374c05661d8d05f557bd2e715dc%2Ftest.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.SteuerJahr%20%3D%3D%202012%20%26%26%20datum.SteuerTarifLang%20%3D%3D%20'Grundtarif'%22%2C%0A%20%20%22district%22%3A%20%22%2Bdatum.KreisSort%22%2C%0A%20%20%22value%22%3A%20%22datum.SteuerEinkommen_p50%20*%201000%22%2C%0A%20%20%22valueTitle%22%3A%20%22Median%20Taxable%20Income%20(Basic%20Rate)%22%0A%7D%20 41 | wealth-1,Median Wealth 2012 by District,https://data.stadt-zuerich.ch/dataset/fd-median-vermoegen-kreis,DistrictBar,"{ 42 | ""data"": ""https://gist.githubusercontent.com/tpreusse/1a003b0d1830c0d056e91d460ef8f9f7/raw/8894478bcdd0dfcd5a54cb178d04b1da80e6ec61/wealth.csv"", 43 | ""filter"": ""datum.SteuerJahr == 2012 && datum.SteuerTarifLang == 'Grundtarif'"", 44 | ""district"": ""+datum.KreisSort"", 45 | ""value"": ""datum.SteuerVermoegen_p50 * 1000"", 46 | ""valueTitle"": ""Median Taxable Wealth (Basic Rate)"" 47 | } ",,https://chart-server.now.sh/DistrictBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2F1a003b0d1830c0d056e91d460ef8f9f7%2Fraw%2F8894478bcdd0dfcd5a54cb178d04b1da80e6ec61%2Fwealth.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.SteuerJahr%20%3D%3D%202012%20%26%26%20datum.SteuerTarifLang%20%3D%3D%20'Grundtarif'%22%2C%0A%20%20%22district%22%3A%20%22%2Bdatum.KreisSort%22%2C%0A%20%20%22value%22%3A%20%22datum.SteuerVermoegen_p50%20*%201000%22%2C%0A%20%20%22valueTitle%22%3A%20%22Median%20Taxable%20Wealth%20(Basic%20Rate)%22%0A%7D%20,http://localhost:3000/DistrictBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2F1a003b0d1830c0d056e91d460ef8f9f7%2Fraw%2F8894478bcdd0dfcd5a54cb178d04b1da80e6ec61%2Fwealth.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.SteuerJahr%20%3D%3D%202012%20%26%26%20datum.SteuerTarifLang%20%3D%3D%20'Grundtarif'%22%2C%0A%20%20%22district%22%3A%20%22%2Bdatum.KreisSort%22%2C%0A%20%20%22value%22%3A%20%22datum.SteuerVermoegen_p50%20*%201000%22%2C%0A%20%20%22valueTitle%22%3A%20%22Median%20Taxable%20Wealth%20(Basic%20Rate)%22%0A%7D%20 48 | pop-2,Population 1993 to 2015 by District,https://data.stadt-zuerich.ch/dataset/bev_bestand_jahr_quartier_alter_herkunft_geschlecht,VegaLite,"{ 49 | ""data"": { 50 | ""url"": ""https://gist.githubusercontent.com/tpreusse/a0c00ad2a585994f3e8ecfa4a2f8cff8/raw/857911d7009abc871635400d47c783a3ad6abe36/bevbestandjahrquartieralterherkunftgeschlecht-optimized.csv"" 51 | }, 52 | ""transform"": { 53 | ""calculate"": [{""field"": ""District"", ""expr"": ""+slice(datum.QuarCd, 0, 2)""}] 54 | }, 55 | ""mark"": ""line"", 56 | ""encoding"": { 57 | ""x"": { 58 | ""field"": ""StichtagDatJahr"", ""type"": ""temporal"", ""title"": ""Year"", 59 | ""axis"": {""axisWidth"": 0, ""format"": ""%Y"", ""labelAngle"": 0} 60 | }, 61 | ""y"": { 62 | ""title"": ""Population"", ""aggregate"": ""sum"", 63 | ""field"": ""AnzBestWir"", ""type"": ""quantitative"" 64 | }, 65 | ""color"": {""field"": ""District"", ""type"": ""nominal"", ""scale"": {""range"": ""category20""}} 66 | } 67 | } ",,https://chart-server.now.sh/VegaLite?spec=%7B%0A%20%20%22data%22%3A%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2Fa0c00ad2a585994f3e8ecfa4a2f8cff8%2Fraw%2F857911d7009abc871635400d47c783a3ad6abe36%2Fbevbestandjahrquartieralterherkunftgeschlecht-optimized.csv%22%0A%20%20%7D%2C%0A%20%20%22transform%22%3A%20%7B%0A%20%20%20%20%22calculate%22%3A%20%5B%7B%22field%22%3A%20%22District%22%2C%20%22expr%22%3A%20%22%2Bslice(datum.QuarCd%2C%200%2C%202)%22%7D%5D%0A%20%20%7D%2C%0A%20%20%22mark%22%3A%20%22line%22%2C%0A%20%20%22encoding%22%3A%20%7B%0A%20%20%20%20%22x%22%3A%20%7B%0A%20%20%20%20%20%20%22field%22%3A%20%22StichtagDatJahr%22%2C%20%22type%22%3A%20%22temporal%22%2C%20%22title%22%3A%20%22Year%22%2C%0A%20%20%20%20%20%20%22axis%22%3A%20%7B%22axisWidth%22%3A%200%2C%20%22format%22%3A%20%22%25Y%22%2C%20%22labelAngle%22%3A%200%7D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22y%22%3A%20%7B%0A%20%20%20%20%20%20%22title%22%3A%20%22Population%22%2C%20%22aggregate%22%3A%20%22sum%22%2C%0A%20%20%20%20%20%20%22field%22%3A%20%22AnzBestWir%22%2C%20%22type%22%3A%20%22quantitative%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22color%22%3A%20%7B%22field%22%3A%20%22District%22%2C%20%22type%22%3A%20%22nominal%22%2C%20%22scale%22%3A%20%7B%22range%22%3A%20%22category20%22%7D%7D%0A%20%20%7D%0A%7D%20,http://localhost:3000/VegaLite?spec=%7B%0A%20%20%22data%22%3A%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2Fa0c00ad2a585994f3e8ecfa4a2f8cff8%2Fraw%2F857911d7009abc871635400d47c783a3ad6abe36%2Fbevbestandjahrquartieralterherkunftgeschlecht-optimized.csv%22%0A%20%20%7D%2C%0A%20%20%22transform%22%3A%20%7B%0A%20%20%20%20%22calculate%22%3A%20%5B%7B%22field%22%3A%20%22District%22%2C%20%22expr%22%3A%20%22%2Bslice(datum.QuarCd%2C%200%2C%202)%22%7D%5D%0A%20%20%7D%2C%0A%20%20%22mark%22%3A%20%22line%22%2C%0A%20%20%22encoding%22%3A%20%7B%0A%20%20%20%20%22x%22%3A%20%7B%0A%20%20%20%20%20%20%22field%22%3A%20%22StichtagDatJahr%22%2C%20%22type%22%3A%20%22temporal%22%2C%20%22title%22%3A%20%22Year%22%2C%0A%20%20%20%20%20%20%22axis%22%3A%20%7B%22axisWidth%22%3A%200%2C%20%22format%22%3A%20%22%25Y%22%2C%20%22labelAngle%22%3A%200%7D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22y%22%3A%20%7B%0A%20%20%20%20%20%20%22title%22%3A%20%22Population%22%2C%20%22aggregate%22%3A%20%22sum%22%2C%0A%20%20%20%20%20%20%22field%22%3A%20%22AnzBestWir%22%2C%20%22type%22%3A%20%22quantitative%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22color%22%3A%20%7B%22field%22%3A%20%22District%22%2C%20%22type%22%3A%20%22nominal%22%2C%20%22scale%22%3A%20%7B%22range%22%3A%20%22category20%22%7D%7D%0A%20%20%7D%0A%7D%20 68 | pop-3,Population 2015 by Age,https://data.stadt-zuerich.ch/dataset/bev_bestand_jahr_quartier_alter_herkunft_geschlecht,VegaLite,"{ 69 | ""data"": { 70 | ""url"": ""https://gist.githubusercontent.com/tpreusse/a0c00ad2a585994f3e8ecfa4a2f8cff8/raw/c2820d5391be2faefb478f28bfc76578ceadf63e/bevbestandjahrquartieralterherkunftgeschlecht-optimized.csv"", 71 | ""format"": { ""parse"": {""AlterVKurz"":""number""}} 72 | }, 73 | ""transform"": { 74 | ""filter"": ""datum.StichtagDatJahr == 2015"" 75 | }, 76 | ""mark"": ""bar"", 77 | ""encoding"": { 78 | ""x"": {""title"": ""Age"", ""field"": ""AlterVKurz"", ""type"": ""ordinal""}, 79 | ""y"": { 80 | ""title"": ""Population"", ""aggregate"": ""sum"", 81 | ""field"": ""AnzBestWir"", ""type"": ""quantitative"" 82 | } 83 | } 84 | }",,https://chart-server.now.sh/VegaLite?spec=%7B%0A%20%20%22data%22%3A%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2Fa0c00ad2a585994f3e8ecfa4a2f8cff8%2Fraw%2Fc2820d5391be2faefb478f28bfc76578ceadf63e%2Fbevbestandjahrquartieralterherkunftgeschlecht-optimized.csv%22%2C%0A%20%20%20%20%22format%22%3A%20%7B%20%22parse%22%3A%20%7B%22AlterVKurz%22%3A%22number%22%7D%7D%0A%20%20%7D%2C%0A%20%20%22transform%22%3A%20%7B%0A%20%20%20%20%22filter%22%3A%20%22datum.StichtagDatJahr%20%3D%3D%202015%22%0A%20%20%7D%2C%0A%20%20%22mark%22%3A%20%22bar%22%2C%0A%20%20%22encoding%22%3A%20%7B%0A%20%20%20%20%22x%22%3A%20%7B%22title%22%3A%20%22Age%22%2C%20%22field%22%3A%20%22AlterVKurz%22%2C%20%22type%22%3A%20%22ordinal%22%7D%2C%0A%20%20%20%20%22y%22%3A%20%7B%0A%20%20%20%20%20%20%22title%22%3A%20%22Population%22%2C%20%22aggregate%22%3A%20%22sum%22%2C%0A%20%20%20%20%20%20%22field%22%3A%20%22AnzBestWir%22%2C%20%22type%22%3A%20%22quantitative%22%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D,http://localhost:3000/VegaLite?spec=%7B%0A%20%20%22data%22%3A%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2Fa0c00ad2a585994f3e8ecfa4a2f8cff8%2Fraw%2Fc2820d5391be2faefb478f28bfc76578ceadf63e%2Fbevbestandjahrquartieralterherkunftgeschlecht-optimized.csv%22%2C%0A%20%20%20%20%22format%22%3A%20%7B%20%22parse%22%3A%20%7B%22AlterVKurz%22%3A%22number%22%7D%7D%0A%20%20%7D%2C%0A%20%20%22transform%22%3A%20%7B%0A%20%20%20%20%22filter%22%3A%20%22datum.StichtagDatJahr%20%3D%3D%202015%22%0A%20%20%7D%2C%0A%20%20%22mark%22%3A%20%22bar%22%2C%0A%20%20%22encoding%22%3A%20%7B%0A%20%20%20%20%22x%22%3A%20%7B%22title%22%3A%20%22Age%22%2C%20%22field%22%3A%20%22AlterVKurz%22%2C%20%22type%22%3A%20%22ordinal%22%7D%2C%0A%20%20%20%20%22y%22%3A%20%7B%0A%20%20%20%20%20%20%22title%22%3A%20%22Population%22%2C%20%22aggregate%22%3A%20%22sum%22%2C%0A%20%20%20%20%20%20%22field%22%3A%20%22AnzBestWir%22%2C%20%22type%22%3A%20%22quantitative%22%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D 85 | pop-4,Population 2015 by Age and Gender,https://data.stadt-zuerich.ch/dataset/bev_bestand_jahr_quartier_alter_herkunft_geschlecht,DemographicBar,"{ 86 | ""data"": ""https://gist.githubusercontent.com/tpreusse/a0c00ad2a585994f3e8ecfa4a2f8cff8/raw/c2820d5391be2faefb478f28bfc76578ceadf63e/bevbestandjahrquartieralterherkunftgeschlecht-optimized.csv"", 87 | ""filter"": ""datum.StichtagDatJahr == 2015"", 88 | ""age"": ""+datum.AlterVKurz"", 89 | ""sex"": ""datum.SexKurz == 'M' ? 'M' : 'F'"", 90 | ""value"": ""+datum.AnzBestWir"", 91 | ""bandSize"": 12 92 | }",,https://chart-server.now.sh/DemographicBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2Fa0c00ad2a585994f3e8ecfa4a2f8cff8%2Fraw%2Fc2820d5391be2faefb478f28bfc76578ceadf63e%2Fbevbestandjahrquartieralterherkunftgeschlecht-optimized.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.StichtagDatJahr%20%3D%3D%202015%22%2C%0A%20%20%22age%22%3A%20%22%2Bdatum.AlterVKurz%22%2C%0A%20%20%22sex%22%3A%20%22datum.SexKurz%20%3D%3D%20'M'%20%3F%20'M'%20%3A%20'F'%22%2C%0A%20%20%22value%22%3A%20%22%2Bdatum.AnzBestWir%22%2C%0A%20%20%22bandSize%22%3A%2012%0A%7D,http://localhost:3000/DemographicBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2Fa0c00ad2a585994f3e8ecfa4a2f8cff8%2Fraw%2Fc2820d5391be2faefb478f28bfc76578ceadf63e%2Fbevbestandjahrquartieralterherkunftgeschlecht-optimized.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.StichtagDatJahr%20%3D%3D%202015%22%2C%0A%20%20%22age%22%3A%20%22%2Bdatum.AlterVKurz%22%2C%0A%20%20%22sex%22%3A%20%22datum.SexKurz%20%3D%3D%20'M'%20%3F%20'M'%20%3A%20'F'%22%2C%0A%20%20%22value%22%3A%20%22%2Bdatum.AnzBestWir%22%2C%0A%20%20%22bandSize%22%3A%2012%0A%7D 93 | pop-5,Population 2015 over 100 Years Old by Age and Gender,https://data.stadt-zuerich.ch/dataset/bev_bestand_jahr_quartier_alter_herkunft_geschlecht,DemographicBar,"{ 94 | ""data"": ""https://gist.githubusercontent.com/tpreusse/a0c00ad2a585994f3e8ecfa4a2f8cff8/raw/c2820d5391be2faefb478f28bfc76578ceadf63e/bevbestandjahrquartieralterherkunftgeschlecht-optimized.csv"", 95 | ""filter"": ""datum.StichtagDatJahr == 2015 && datum.AlterVKurz >= 100"", 96 | ""age"": ""+datum.AlterVKurz"", 97 | ""sex"": ""datum.SexKurz == 'M' ? 'M' : 'F'"", 98 | ""value"": ""+datum.AnzBestWir"", 99 | ""orient"": ""horizontal"" 100 | }",,https://chart-server.now.sh/DemographicBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2Fa0c00ad2a585994f3e8ecfa4a2f8cff8%2Fraw%2Fc2820d5391be2faefb478f28bfc76578ceadf63e%2Fbevbestandjahrquartieralterherkunftgeschlecht-optimized.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.StichtagDatJahr%20%3D%3D%202015%20%26%26%20datum.AlterVKurz%20%3E%3D%20100%22%2C%0A%20%20%22age%22%3A%20%22%2Bdatum.AlterVKurz%22%2C%0A%20%20%22sex%22%3A%20%22datum.SexKurz%20%3D%3D%20'M'%20%3F%20'M'%20%3A%20'F'%22%2C%0A%20%20%22value%22%3A%20%22%2Bdatum.AnzBestWir%22%2C%0A%20%20%22orient%22%3A%20%22horizontal%22%0A%7D,http://localhost:3000/DemographicBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2Fa0c00ad2a585994f3e8ecfa4a2f8cff8%2Fraw%2Fc2820d5391be2faefb478f28bfc76578ceadf63e%2Fbevbestandjahrquartieralterherkunftgeschlecht-optimized.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.StichtagDatJahr%20%3D%3D%202015%20%26%26%20datum.AlterVKurz%20%3E%3D%20100%22%2C%0A%20%20%22age%22%3A%20%22%2Bdatum.AlterVKurz%22%2C%0A%20%20%22sex%22%3A%20%22datum.SexKurz%20%3D%3D%20'M'%20%3F%20'M'%20%3A%20'F'%22%2C%0A%20%20%22value%22%3A%20%22%2Bdatum.AnzBestWir%22%2C%0A%20%20%22orient%22%3A%20%22horizontal%22%0A%7D 101 | pop-5b,Population 2015 over 100 Years,https://data.stadt-zuerich.ch/dataset/bev_bestand_jahr_quartier_alter_herkunft_geschlecht,VegaLite,"{ 102 | ""data"": { 103 | ""url"": ""https://gist.githubusercontent.com/tpreusse/a0c00ad2a585994f3e8ecfa4a2f8cff8/raw/55185e48f723c0792b3d5a557559eae847e20cc7/bevbestandjahrquartieralterherkunftgeschlecht-optimized.csv"" 104 | }, 105 | ""transform"": { 106 | ""filter"": ""datum.StichtagDatJahr == 2015 && datum.AlterVKurz >= 100"" 107 | }, 108 | ""mark"": ""text"", 109 | ""encoding"": { 110 | ""column"": {""title"": ""Gender"", ""field"": ""SexKurz"", ""type"": ""nominal"", ""sort"": ""descending""}, 111 | ""color"": {""field"": ""SexKurz"", ""type"": ""nominal"",""scale"": {""range"": [""#659CCA"",""#EA98D2""]}}, 112 | ""text"": {""aggregate"": ""sum"", ""field"": ""AnzBestWir"", ""type"": ""quantitative""} 113 | } 114 | }",,https://chart-server.now.sh/VegaLite?spec=%7B%0A%20%20%22data%22%3A%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2Fa0c00ad2a585994f3e8ecfa4a2f8cff8%2Fraw%2F55185e48f723c0792b3d5a557559eae847e20cc7%2Fbevbestandjahrquartieralterherkunftgeschlecht-optimized.csv%22%0A%20%20%7D%2C%0A%20%20%22transform%22%3A%20%7B%0A%20%20%20%20%22filter%22%3A%20%22datum.StichtagDatJahr%20%3D%3D%202015%20%26%26%20datum.AlterVKurz%20%3E%3D%20100%22%0A%20%20%7D%2C%0A%20%20%22mark%22%3A%20%22text%22%2C%0A%20%20%22encoding%22%3A%20%7B%0A%20%20%20%20%22column%22%3A%20%7B%22title%22%3A%20%22Gender%22%2C%20%22field%22%3A%20%22SexKurz%22%2C%20%22type%22%3A%20%22nominal%22%2C%20%22sort%22%3A%20%22descending%22%7D%2C%0A%20%20%20%20%22color%22%3A%20%7B%22field%22%3A%20%22SexKurz%22%2C%20%22type%22%3A%20%22nominal%22%2C%22scale%22%3A%20%7B%22range%22%3A%20%5B%22%23659CCA%22%2C%22%23EA98D2%22%5D%7D%7D%2C%0A%20%20%20%20%22text%22%3A%20%7B%22aggregate%22%3A%20%22sum%22%2C%20%22field%22%3A%20%22AnzBestWir%22%2C%20%22type%22%3A%20%22quantitative%22%7D%0A%20%20%7D%0A%7D,http://localhost:3000/VegaLite?spec=%7B%0A%20%20%22data%22%3A%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2Fa0c00ad2a585994f3e8ecfa4a2f8cff8%2Fraw%2F55185e48f723c0792b3d5a557559eae847e20cc7%2Fbevbestandjahrquartieralterherkunftgeschlecht-optimized.csv%22%0A%20%20%7D%2C%0A%20%20%22transform%22%3A%20%7B%0A%20%20%20%20%22filter%22%3A%20%22datum.StichtagDatJahr%20%3D%3D%202015%20%26%26%20datum.AlterVKurz%20%3E%3D%20100%22%0A%20%20%7D%2C%0A%20%20%22mark%22%3A%20%22text%22%2C%0A%20%20%22encoding%22%3A%20%7B%0A%20%20%20%20%22column%22%3A%20%7B%22title%22%3A%20%22Gender%22%2C%20%22field%22%3A%20%22SexKurz%22%2C%20%22type%22%3A%20%22nominal%22%2C%20%22sort%22%3A%20%22descending%22%7D%2C%0A%20%20%20%20%22color%22%3A%20%7B%22field%22%3A%20%22SexKurz%22%2C%20%22type%22%3A%20%22nominal%22%2C%22scale%22%3A%20%7B%22range%22%3A%20%5B%22%23659CCA%22%2C%22%23EA98D2%22%5D%7D%7D%2C%0A%20%20%20%20%22text%22%3A%20%7B%22aggregate%22%3A%20%22sum%22%2C%20%22field%22%3A%20%22AnzBestWir%22%2C%20%22type%22%3A%20%22quantitative%22%7D%0A%20%20%7D%0A%7D 115 | dog-1,Dogs by District (07.03.2016),https://data.stadt-zuerich.ch/dataset/pd-stapo-hundebestand,DistrictBar,"{ 116 | ""data"": ""https://data.stadt-zuerich.ch/dataset/pd_stapo_hundebestand/resource/9e163ae4-ca75-45ca-95f6-5a209fbd226a/download/20160307hundehalter.csv"", 117 | ""filter"": ""datum.STADTKREIS"", 118 | ""district"": ""+datum.STADTKREIS"", 119 | ""aggregate"": ""count"", 120 | ""valueTitle"": ""Dogs"" 121 | } ",,https://chart-server.now.sh/DistrictBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.STADTKREIS%22%2C%0A%20%20%22district%22%3A%20%22%2Bdatum.STADTKREIS%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D%20,http://localhost:3000/DistrictBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.STADTKREIS%22%2C%0A%20%20%22district%22%3A%20%22%2Bdatum.STADTKREIS%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D%20 122 | dog-1b,Dogs with District Count (07.03.2016),https://data.stadt-zuerich.ch/dataset/pd-stapo-hundebestand,VegaLite,"{ 123 | ""data"": { 124 | ""url"": ""https://data.stadt-zuerich.ch/dataset/pd_stapo_hundebestand/resource/9e163ae4-ca75-45ca-95f6-5a209fbd226a/download/20160307hundehalter.csv"" 125 | }, 126 | ""transform"": { 127 | ""filter"": ""datum.STADTKREIS"" 128 | }, 129 | ""mark"": ""text"", 130 | ""encoding"": { 131 | ""text"": {""aggregate"": ""count"", ""field"": ""*"", ""type"": ""quantitative""} 132 | } 133 | }",,https://chart-server.now.sh/VegaLite?spec=%7B%0A%20%20%22data%22%3A%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%0A%20%20%7D%2C%0A%20%20%22transform%22%3A%20%7B%0A%20%20%20%20%22filter%22%3A%20%22datum.STADTKREIS%22%0A%20%20%7D%2C%0A%20%20%22mark%22%3A%20%22text%22%2C%0A%20%20%22encoding%22%3A%20%7B%0A%20%20%20%20%22text%22%3A%20%7B%22aggregate%22%3A%20%22count%22%2C%20%22field%22%3A%20%22*%22%2C%20%22type%22%3A%20%22quantitative%22%7D%0A%20%20%7D%0A%7D,http://localhost:3000/VegaLite?spec=%7B%0A%20%20%22data%22%3A%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%0A%20%20%7D%2C%0A%20%20%22transform%22%3A%20%7B%0A%20%20%20%20%22filter%22%3A%20%22datum.STADTKREIS%22%0A%20%20%7D%2C%0A%20%20%22mark%22%3A%20%22text%22%2C%0A%20%20%22encoding%22%3A%20%7B%0A%20%20%20%20%22text%22%3A%20%7B%22aggregate%22%3A%20%22count%22%2C%20%22field%22%3A%20%22*%22%2C%20%22type%22%3A%20%22quantitative%22%7D%0A%20%20%7D%0A%7D 134 | dog-1c,Dogs without District Count (07.03.2016),https://data.stadt-zuerich.ch/dataset/pd-stapo-hundebestand,VegaLite,"{ 135 | ""data"": { 136 | ""url"": ""https://data.stadt-zuerich.ch/dataset/pd_stapo_hundebestand/resource/9e163ae4-ca75-45ca-95f6-5a209fbd226a/download/20160307hundehalter.csv"" 137 | }, 138 | ""transform"": { 139 | ""filter"": ""!datum.STADTKREIS"" 140 | }, 141 | ""mark"": ""text"", 142 | ""encoding"": { 143 | ""text"": {""aggregate"": ""count"", ""field"": ""*"", ""type"": ""quantitative""} 144 | } 145 | }",,https://chart-server.now.sh/VegaLite?spec=%7B%0A%20%20%22data%22%3A%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%0A%20%20%7D%2C%0A%20%20%22transform%22%3A%20%7B%0A%20%20%20%20%22filter%22%3A%20%22!datum.STADTKREIS%22%0A%20%20%7D%2C%0A%20%20%22mark%22%3A%20%22text%22%2C%0A%20%20%22encoding%22%3A%20%7B%0A%20%20%20%20%22text%22%3A%20%7B%22aggregate%22%3A%20%22count%22%2C%20%22field%22%3A%20%22*%22%2C%20%22type%22%3A%20%22quantitative%22%7D%0A%20%20%7D%0A%7D,http://localhost:3000/VegaLite?spec=%7B%0A%20%20%22data%22%3A%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%0A%20%20%7D%2C%0A%20%20%22transform%22%3A%20%7B%0A%20%20%20%20%22filter%22%3A%20%22!datum.STADTKREIS%22%0A%20%20%7D%2C%0A%20%20%22mark%22%3A%20%22text%22%2C%0A%20%20%22encoding%22%3A%20%7B%0A%20%20%20%20%22text%22%3A%20%7B%22aggregate%22%3A%20%22count%22%2C%20%22field%22%3A%20%22*%22%2C%20%22type%22%3A%20%22quantitative%22%7D%0A%20%20%7D%0A%7D 146 | dog-2,Dogs by Primary Breed (07.03.2016),https://data.stadt-zuerich.ch/dataset/pd-stapo-hundebestand,Bar,"{ 147 | ""data"": ""https://data.stadt-zuerich.ch/dataset/pd_stapo_hundebestand/resource/9e163ae4-ca75-45ca-95f6-5a209fbd226a/download/20160307hundehalter.csv"", 148 | ""y"": ""datum.RASSE1"", 149 | ""aggregate"": ""count"", 150 | ""valueTitle"": ""Dogs"" 151 | } ",,https://chart-server.now.sh/Bar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22y%22%3A%20%22datum.RASSE1%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D%20,http://localhost:3000/Bar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22y%22%3A%20%22datum.RASSE1%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D%20 152 | dog-2b7,Dogs by Primary Breed in District 7 (07.03.2016),https://data.stadt-zuerich.ch/dataset/pd-stapo-hundebestand,Bar,"{ 153 | ""data"": ""https://data.stadt-zuerich.ch/dataset/pd_stapo_hundebestand/resource/9e163ae4-ca75-45ca-95f6-5a209fbd226a/download/20160307hundehalter.csv"", 154 | ""filter"": ""datum.STADTKREIS == 7"", 155 | ""y"": ""datum.RASSE1"", 156 | ""aggregate"": ""count"", 157 | ""valueTitle"": ""Dogs"" 158 | }",,https://chart-server.now.sh/Bar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.STADTKREIS%20%3D%3D%207%22%2C%0A%20%20%22y%22%3A%20%22datum.RASSE1%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D,http://localhost:3000/Bar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.STADTKREIS%20%3D%3D%207%22%2C%0A%20%20%22y%22%3A%20%22datum.RASSE1%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D 159 | dog-2b11,Dogs by Primary Breed in District 11 (07.03.2016),https://data.stadt-zuerich.ch/dataset/pd-stapo-hundebestand,Bar,"{ 160 | ""data"": ""https://data.stadt-zuerich.ch/dataset/pd_stapo_hundebestand/resource/9e163ae4-ca75-45ca-95f6-5a209fbd226a/download/20160307hundehalter.csv"", 161 | ""filter"": ""datum.STADTKREIS == 11"", 162 | ""y"": ""datum.RASSE1"", 163 | ""aggregate"": ""count"", 164 | ""valueTitle"": ""Dogs"" 165 | }",,https://chart-server.now.sh/Bar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.STADTKREIS%20%3D%3D%2011%22%2C%0A%20%20%22y%22%3A%20%22datum.RASSE1%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D,http://localhost:3000/Bar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.STADTKREIS%20%3D%3D%2011%22%2C%0A%20%20%22y%22%3A%20%22datum.RASSE1%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D 166 | dog-2c,Dogs by Primary Breed and Owner Gender (07.03.2016),https://data.stadt-zuerich.ch/dataset/pd-stapo-hundebestand,Bar,"{ 167 | ""data"": ""https://data.stadt-zuerich.ch/dataset/pd_stapo_hundebestand/resource/9e163ae4-ca75-45ca-95f6-5a209fbd226a/download/20160307hundehalter.csv"", 168 | ""facet"": ""datum.GESCHLECHT == 'm' ? 'M' : 'F'"", 169 | ""facetTitle"": ""Gender"", 170 | ""y"": ""datum.RASSE1"", 171 | ""aggregate"": ""count"", 172 | ""valueTitle"": ""Dogs"" 173 | }",,https://chart-server.now.sh/Bar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22facet%22%3A%20%22datum.GESCHLECHT%20%3D%3D%20'm'%20%3F%20'M'%20%3A%20'F'%22%2C%0A%20%20%22facetTitle%22%3A%20%22Gender%22%2C%0A%20%20%22y%22%3A%20%22datum.RASSE1%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D,http://localhost:3000/Bar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22facet%22%3A%20%22datum.GESCHLECHT%20%3D%3D%20'm'%20%3F%20'M'%20%3A%20'F'%22%2C%0A%20%20%22facetTitle%22%3A%20%22Gender%22%2C%0A%20%20%22y%22%3A%20%22datum.RASSE1%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D 174 | dog-3,Top 10 Primary Dog Breeds (07.03.2016),https://data.stadt-zuerich.ch/dataset/pd-stapo-hundebestand,Bar,"{ 175 | ""data"": ""https://data.stadt-zuerich.ch/dataset/pd_stapo_hundebestand/resource/9e163ae4-ca75-45ca-95f6-5a209fbd226a/download/20160307hundehalter.csv"", 176 | ""filter"": {""field"": ""RASSE1"", ""in"":[""Mischling klein"", ""Golden Retriever"", ""Französische Bulldogge"", ""Mops"", ""Malteser"", ""Yorkshire Terrier"", ""Jack Russel Terrier"", ""Labrador Retriever"", ""Chihuahua"", ""Mischling gross""]}, 177 | ""y"": ""datum.RASSE1"", 178 | ""aggregate"": ""count"", 179 | ""valueTitle"": ""Dogs"" 180 | }",,https://chart-server.now.sh/Bar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%7B%22field%22%3A%20%22RASSE1%22%2C%20%22in%22%3A%5B%22Mischling%20klein%22%2C%20%22Golden%20Retriever%22%2C%20%22Franz%C3%B6sische%20Bulldogge%22%2C%20%22Mops%22%2C%20%22Malteser%22%2C%20%22Yorkshire%20Terrier%22%2C%20%22Jack%20Russel%20Terrier%22%2C%20%22Labrador%20Retriever%22%2C%20%22Chihuahua%22%2C%20%22Mischling%20gross%22%5D%7D%2C%0A%20%20%22y%22%3A%20%22datum.RASSE1%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D,http://localhost:3000/Bar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%7B%22field%22%3A%20%22RASSE1%22%2C%20%22in%22%3A%5B%22Mischling%20klein%22%2C%20%22Golden%20Retriever%22%2C%20%22Franz%C3%B6sische%20Bulldogge%22%2C%20%22Mops%22%2C%20%22Malteser%22%2C%20%22Yorkshire%20Terrier%22%2C%20%22Jack%20Russel%20Terrier%22%2C%20%22Labrador%20Retriever%22%2C%20%22Chihuahua%22%2C%20%22Mischling%20gross%22%5D%7D%2C%0A%20%20%22y%22%3A%20%22datum.RASSE1%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D 181 | dog-4,Top 10 Primary Dog Breeds by District (07.03.2016),https://data.stadt-zuerich.ch/dataset/pd-stapo-hundebestand,DistrictBar,"{ 182 | ""data"": ""https://data.stadt-zuerich.ch/dataset/pd_stapo_hundebestand/resource/9e163ae4-ca75-45ca-95f6-5a209fbd226a/download/20160307hundehalter.csv"", 183 | ""filter"": [ 184 | ""datum.STADTKREIS"", 185 | {""field"": ""RASSE1"", ""in"": [""Mischling klein"", ""Golden Retriever"", ""Französische Bulldogge"", ""Mops"", ""Malteser"", ""Yorkshire Terrier"", ""Jack Russel Terrier"", ""Labrador Retriever"", ""Chihuahua"", ""Mischling gross""]} 186 | ], 187 | ""district"": ""+datum.STADTKREIS"", 188 | ""aggregate"": ""count"", 189 | ""valueTitle"": ""Dogs"", 190 | ""facet"": ""datum.RASSE1"", 191 | ""facetTitle"": ""Primary Breed"" 192 | } ",,https://chart-server.now.sh/DistrictBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%5B%0A%20%20%20%20%22datum.STADTKREIS%22%2C%0A%20%20%20%20%7B%22field%22%3A%20%22RASSE1%22%2C%20%22in%22%3A%20%5B%22Mischling%20klein%22%2C%20%22Golden%20Retriever%22%2C%20%22Franz%C3%B6sische%20Bulldogge%22%2C%20%22Mops%22%2C%20%22Malteser%22%2C%20%22Yorkshire%20Terrier%22%2C%20%22Jack%20Russel%20Terrier%22%2C%20%22Labrador%20Retriever%22%2C%20%22Chihuahua%22%2C%20%22Mischling%20gross%22%5D%7D%0A%20%20%5D%2C%0A%20%20%22district%22%3A%20%22%2Bdatum.STADTKREIS%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%2C%0A%20%20%22facet%22%3A%20%22datum.RASSE1%22%2C%0A%20%20%22facetTitle%22%3A%20%22Primary%20Breed%22%0A%7D%20,http://localhost:3000/DistrictBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%5B%0A%20%20%20%20%22datum.STADTKREIS%22%2C%0A%20%20%20%20%7B%22field%22%3A%20%22RASSE1%22%2C%20%22in%22%3A%20%5B%22Mischling%20klein%22%2C%20%22Golden%20Retriever%22%2C%20%22Franz%C3%B6sische%20Bulldogge%22%2C%20%22Mops%22%2C%20%22Malteser%22%2C%20%22Yorkshire%20Terrier%22%2C%20%22Jack%20Russel%20Terrier%22%2C%20%22Labrador%20Retriever%22%2C%20%22Chihuahua%22%2C%20%22Mischling%20gross%22%5D%7D%0A%20%20%5D%2C%0A%20%20%22district%22%3A%20%22%2Bdatum.STADTKREIS%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%2C%0A%20%20%22facet%22%3A%20%22datum.RASSE1%22%2C%0A%20%20%22facetTitle%22%3A%20%22Primary%20Breed%22%0A%7D%20 193 | dog-5,"Chihuahuas by District (Primary Breed, 07.03.2016)",https://data.stadt-zuerich.ch/dataset/pd-stapo-hundebestand,DistrictBar,"{ 194 | ""data"": ""https://data.stadt-zuerich.ch/dataset/pd_stapo_hundebestand/resource/9e163ae4-ca75-45ca-95f6-5a209fbd226a/download/20160307hundehalter.csv"", 195 | ""filter"": ""datum.STADTKREIS && datum.RASSE1 == 'Chihuahua'"", 196 | ""district"": ""+datum.STADTKREIS"", 197 | ""aggregate"": ""count"", 198 | ""valueTitle"": ""Dogs"" 199 | } ",,https://chart-server.now.sh/DistrictBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.STADTKREIS%20%26%26%20datum.RASSE1%20%3D%3D%20'Chihuahua'%22%2C%0A%20%20%22district%22%3A%20%22%2Bdatum.STADTKREIS%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D%20,http://localhost:3000/DistrictBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.STADTKREIS%20%26%26%20datum.RASSE1%20%3D%3D%20'Chihuahua'%22%2C%0A%20%20%22district%22%3A%20%22%2Bdatum.STADTKREIS%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D%20 200 | dog-6,"Labrador Retrievers by District (Primary Breed, 07.03.2016)",https://data.stadt-zuerich.ch/dataset/pd-stapo-hundebestand,DistrictBar,"{ 201 | ""data"": ""https://data.stadt-zuerich.ch/dataset/pd_stapo_hundebestand/resource/9e163ae4-ca75-45ca-95f6-5a209fbd226a/download/20160307hundehalter.csv"", 202 | ""filter"": ""datum.STADTKREIS && datum.RASSE1 == 'Labrador Retriever'"", 203 | ""district"": ""+datum.STADTKREIS"", 204 | ""aggregate"": ""count"", 205 | ""valueTitle"": ""Dogs"" 206 | } ",,https://chart-server.now.sh/DistrictBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.STADTKREIS%20%26%26%20datum.RASSE1%20%3D%3D%20'Labrador%20Retriever'%22%2C%0A%20%20%22district%22%3A%20%22%2Bdatum.STADTKREIS%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D%20,http://localhost:3000/DistrictBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.STADTKREIS%20%26%26%20datum.RASSE1%20%3D%3D%20'Labrador%20Retriever'%22%2C%0A%20%20%22district%22%3A%20%22%2Bdatum.STADTKREIS%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D%20 207 | dog-7,Dogs by Owner Gender and Age Group (07.03.2016),https://data.stadt-zuerich.ch/dataset/pd-stapo-hundebestand,DemographicBar,"{ 208 | ""data"": ""https://data.stadt-zuerich.ch/dataset/pd_stapo_hundebestand/resource/9e163ae4-ca75-45ca-95f6-5a209fbd226a/download/20160307hundehalter.csv"", 209 | ""filter"": ""datum.ALTER && datum.GESCHLECHT"", 210 | ""age"": ""datum.ALTER"", 211 | ""sex"": ""datum.GESCHLECHT == 'm' ? 'M' : 'F'"", 212 | ""aggregate"": ""count"", 213 | ""orient"": ""horizontal"", 214 | ""valueTitle"": ""Dogs"" 215 | }",,https://chart-server.now.sh/DemographicBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.ALTER%20%26%26%20datum.GESCHLECHT%22%2C%0A%20%20%22age%22%3A%20%22datum.ALTER%22%2C%0A%20%20%22sex%22%3A%20%22datum.GESCHLECHT%20%3D%3D%20'm'%20%3F%20'M'%20%3A%20'F'%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22orient%22%3A%20%22horizontal%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D,http://localhost:3000/DemographicBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.ALTER%20%26%26%20datum.GESCHLECHT%22%2C%0A%20%20%22age%22%3A%20%22datum.ALTER%22%2C%0A%20%20%22sex%22%3A%20%22datum.GESCHLECHT%20%3D%3D%20'm'%20%3F%20'M'%20%3A%20'F'%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22orient%22%3A%20%22horizontal%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D 216 | dog-7b,Dog Count by Owner Gender (07.03.2016),https://data.stadt-zuerich.ch/dataset/pd-stapo-hundebestand,VegaLite,"{ 217 | ""data"": { 218 | ""url"": ""https://data.stadt-zuerich.ch/dataset/pd_stapo_hundebestand/resource/9e163ae4-ca75-45ca-95f6-5a209fbd226a/download/20160307hundehalter.csv"" 219 | }, 220 | ""transform"": { 221 | ""filter"": ""datum.GESCHLECHT"" 222 | }, 223 | ""mark"": ""text"", 224 | ""encoding"": { 225 | ""column"": {""title"": ""Gender"", ""field"": ""GESCHLECHT"", ""type"": ""nominal"", ""sort"": ""descending""}, 226 | ""color"": {""field"": ""GESCHLECHT"", ""type"": ""nominal"",""scale"": {""range"": [""#659CCA"",""#EA98D2""]}}, 227 | ""text"": {""aggregate"": ""count"", ""field"": ""*"", ""type"": ""quantitative""} 228 | } 229 | }",,https://chart-server.now.sh/VegaLite?spec=%7B%0A%20%20%22data%22%3A%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%0A%20%20%7D%2C%0A%20%20%22transform%22%3A%20%7B%0A%20%20%20%20%22filter%22%3A%20%22datum.GESCHLECHT%22%0A%20%20%7D%2C%0A%20%20%22mark%22%3A%20%22text%22%2C%0A%20%20%22encoding%22%3A%20%7B%0A%20%20%20%20%22column%22%3A%20%7B%22title%22%3A%20%22Gender%22%2C%20%22field%22%3A%20%22GESCHLECHT%22%2C%20%22type%22%3A%20%22nominal%22%2C%20%22sort%22%3A%20%22descending%22%7D%2C%0A%20%20%20%20%22color%22%3A%20%7B%22field%22%3A%20%22GESCHLECHT%22%2C%20%22type%22%3A%20%22nominal%22%2C%22scale%22%3A%20%7B%22range%22%3A%20%5B%22%23659CCA%22%2C%22%23EA98D2%22%5D%7D%7D%2C%0A%20%20%20%20%22text%22%3A%20%7B%22aggregate%22%3A%20%22count%22%2C%20%22field%22%3A%20%22*%22%2C%20%22type%22%3A%20%22quantitative%22%7D%0A%20%20%7D%0A%7D,http://localhost:3000/VegaLite?spec=%7B%0A%20%20%22data%22%3A%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%0A%20%20%7D%2C%0A%20%20%22transform%22%3A%20%7B%0A%20%20%20%20%22filter%22%3A%20%22datum.GESCHLECHT%22%0A%20%20%7D%2C%0A%20%20%22mark%22%3A%20%22text%22%2C%0A%20%20%22encoding%22%3A%20%7B%0A%20%20%20%20%22column%22%3A%20%7B%22title%22%3A%20%22Gender%22%2C%20%22field%22%3A%20%22GESCHLECHT%22%2C%20%22type%22%3A%20%22nominal%22%2C%20%22sort%22%3A%20%22descending%22%7D%2C%0A%20%20%20%20%22color%22%3A%20%7B%22field%22%3A%20%22GESCHLECHT%22%2C%20%22type%22%3A%20%22nominal%22%2C%22scale%22%3A%20%7B%22range%22%3A%20%5B%22%23659CCA%22%2C%22%23EA98D2%22%5D%7D%7D%2C%0A%20%20%20%20%22text%22%3A%20%7B%22aggregate%22%3A%20%22count%22%2C%20%22field%22%3A%20%22*%22%2C%20%22type%22%3A%20%22quantitative%22%7D%0A%20%20%7D%0A%7D 230 | dog-7c,"Dogs by Top 10 Breeds, Owner Gender and Age Group (07.03.2016)",https://data.stadt-zuerich.ch/dataset/pd-stapo-hundebestand,DemographicBar,"{ 231 | ""data"": ""https://data.stadt-zuerich.ch/dataset/pd_stapo_hundebestand/resource/9e163ae4-ca75-45ca-95f6-5a209fbd226a/download/20160307hundehalter.csv"", 232 | ""filter"": [""datum.ALTER && datum.GESCHLECHT"", {""field"": ""RASSE1"", ""in"":[""Mischling klein"", ""Golden Retriever"", ""Französische Bulldogge"", ""Mops"", ""Malteser"", ""Yorkshire Terrier"", ""Jack Russel Terrier"", ""Labrador Retriever"", ""Chihuahua"", ""Mischling gross""]}], 233 | ""age"": ""datum.ALTER"", 234 | ""sex"": ""datum.GESCHLECHT == 'm' ? 'M' : 'F'"", 235 | ""aggregate"": ""count"", 236 | ""facet"": ""datum.RASSE1"", 237 | ""facetTitle"": ""Primary Breed"", 238 | ""valueTitle"": ""Dogs"" 239 | } ",,https://chart-server.now.sh/DemographicBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%5B%22datum.ALTER%20%26%26%20datum.GESCHLECHT%22%2C%20%7B%22field%22%3A%20%22RASSE1%22%2C%20%22in%22%3A%5B%22Mischling%20klein%22%2C%20%22Golden%20Retriever%22%2C%20%22Franz%C3%B6sische%20Bulldogge%22%2C%20%22Mops%22%2C%20%22Malteser%22%2C%20%22Yorkshire%20Terrier%22%2C%20%22Jack%20Russel%20Terrier%22%2C%20%22Labrador%20Retriever%22%2C%20%22Chihuahua%22%2C%20%22Mischling%20gross%22%5D%7D%5D%2C%0A%20%20%22age%22%3A%20%22datum.ALTER%22%2C%0A%20%20%22sex%22%3A%20%22datum.GESCHLECHT%20%3D%3D%20'm'%20%3F%20'M'%20%3A%20'F'%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22facet%22%3A%20%22datum.RASSE1%22%2C%0A%20%20%22facetTitle%22%3A%20%22Primary%20Breed%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D%20,http://localhost:3000/DemographicBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%5B%22datum.ALTER%20%26%26%20datum.GESCHLECHT%22%2C%20%7B%22field%22%3A%20%22RASSE1%22%2C%20%22in%22%3A%5B%22Mischling%20klein%22%2C%20%22Golden%20Retriever%22%2C%20%22Franz%C3%B6sische%20Bulldogge%22%2C%20%22Mops%22%2C%20%22Malteser%22%2C%20%22Yorkshire%20Terrier%22%2C%20%22Jack%20Russel%20Terrier%22%2C%20%22Labrador%20Retriever%22%2C%20%22Chihuahua%22%2C%20%22Mischling%20gross%22%5D%7D%5D%2C%0A%20%20%22age%22%3A%20%22datum.ALTER%22%2C%0A%20%20%22sex%22%3A%20%22datum.GESCHLECHT%20%3D%3D%20'm'%20%3F%20'M'%20%3A%20'F'%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22facet%22%3A%20%22datum.RASSE1%22%2C%0A%20%20%22facetTitle%22%3A%20%22Primary%20Breed%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D%20 240 | dog-8,"Labrador Retrievers by Owner Gender and Age Group (Primary Breed, 07.03.2016)",https://data.stadt-zuerich.ch/dataset/pd-stapo-hundebestand,DemographicBar,"{ 241 | ""data"": ""https://data.stadt-zuerich.ch/dataset/pd_stapo_hundebestand/resource/9e163ae4-ca75-45ca-95f6-5a209fbd226a/download/20160307hundehalter.csv"", 242 | ""filter"": ""datum.ALTER && datum.GESCHLECHT && datum.RASSE1 == 'Labrador Retriever'"", 243 | ""age"": ""datum.ALTER"", 244 | ""sex"": ""datum.GESCHLECHT == 'm' ? 'M' : 'F'"", 245 | ""aggregate"": ""count"", 246 | ""valueTitle"": ""Dogs"" 247 | }",,https://chart-server.now.sh/DemographicBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.ALTER%20%26%26%20datum.GESCHLECHT%20%26%26%20datum.RASSE1%20%3D%3D%20'Labrador%20Retriever'%22%2C%0A%20%20%22age%22%3A%20%22datum.ALTER%22%2C%0A%20%20%22sex%22%3A%20%22datum.GESCHLECHT%20%3D%3D%20'm'%20%3F%20'M'%20%3A%20'F'%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D,http://localhost:3000/DemographicBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.ALTER%20%26%26%20datum.GESCHLECHT%20%26%26%20datum.RASSE1%20%3D%3D%20'Labrador%20Retriever'%22%2C%0A%20%20%22age%22%3A%20%22datum.ALTER%22%2C%0A%20%20%22sex%22%3A%20%22datum.GESCHLECHT%20%3D%3D%20'm'%20%3F%20'M'%20%3A%20'F'%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D 248 | dog-9,"Chihuahuas by Owner Gender and Age Group (Primary Breed, 07.03.2016)",https://data.stadt-zuerich.ch/dataset/pd-stapo-hundebestand,DemographicBar,"{ 249 | ""data"": ""https://data.stadt-zuerich.ch/dataset/pd_stapo_hundebestand/resource/9e163ae4-ca75-45ca-95f6-5a209fbd226a/download/20160307hundehalter.csv"", 250 | ""filter"": ""datum.ALTER && datum.GESCHLECHT && datum.RASSE1 == 'Chihuahua'"", 251 | ""age"": ""datum.ALTER"", 252 | ""sex"": ""datum.GESCHLECHT == 'm' ? 'M' : 'F'"", 253 | ""aggregate"": ""count"", 254 | ""valueTitle"": ""Dogs"" 255 | }",,https://chart-server.now.sh/DemographicBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.ALTER%20%26%26%20datum.GESCHLECHT%20%26%26%20datum.RASSE1%20%3D%3D%20'Chihuahua'%22%2C%0A%20%20%22age%22%3A%20%22datum.ALTER%22%2C%0A%20%20%22sex%22%3A%20%22datum.GESCHLECHT%20%3D%3D%20'm'%20%3F%20'M'%20%3A%20'F'%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D,http://localhost:3000/DemographicBar?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fdata.stadt-zuerich.ch%2Fdataset%2Fpd_stapo_hundebestand%2Fresource%2F9e163ae4-ca75-45ca-95f6-5a209fbd226a%2Fdownload%2F20160307hundehalter.csv%22%2C%0A%20%20%22filter%22%3A%20%22datum.ALTER%20%26%26%20datum.GESCHLECHT%20%26%26%20datum.RASSE1%20%3D%3D%20'Chihuahua'%22%2C%0A%20%20%22age%22%3A%20%22datum.ALTER%22%2C%0A%20%20%22sex%22%3A%20%22datum.GESCHLECHT%20%3D%3D%20'm'%20%3F%20'M'%20%3A%20'F'%22%2C%0A%20%20%22aggregate%22%3A%20%22count%22%2C%0A%20%20%22valueTitle%22%3A%20%22Dogs%22%0A%7D 256 | baths-1,Bathing Spots,https://gist.github.com/tpreusse/e4c166de85211a2a9294207acd23210c,ZurichMap,"{ 257 | ""data"": ""https://gist.githubusercontent.com/tpreusse/e4c166de85211a2a9294207acd23210c/raw/4abb0a423bd3bf46801eb5431e0480a7f387527e/baths.csv"", 258 | ""category"": ""Type"" 259 | }",,https://chart-server.now.sh/ZurichMap?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2Fe4c166de85211a2a9294207acd23210c%2Fraw%2F4abb0a423bd3bf46801eb5431e0480a7f387527e%2Fbaths.csv%22%2C%0A%20%20%22category%22%3A%20%22Type%22%0A%7D,http://localhost:3000/ZurichMap?spec=%7B%0A%20%20%22data%22%3A%20%22https%3A%2F%2Fgist.githubusercontent.com%2Ftpreusse%2Fe4c166de85211a2a9294207acd23210c%2Fraw%2F4abb0a423bd3bf46801eb5431e0480a7f387527e%2Fbaths.csv%22%2C%0A%20%20%22category%22%3A%20%22Type%22%0A%7D -------------------------------------------------------------------------------- /docs/example.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 |
27 | A short data-driven essay with random facts about Zurich. Written to demonstrate a charting system and workflow.
28 |
Thomas Preusse, November 11th 2016
29 |
Zurich has 18 outdoor bathing spots and 7 indoors. Who celebrates this bathing high culture?
37 | 38 |44 | The municipality has 410'404 inhabitants. 45 | It's organized in 12 districts. 46 | Most, 72'831, live in district 11 – in the quarters Affoltern, Oerlikon and Seebach. 47 | District 11 has also grown rapidly from 2000 to 2015. 48 |
49 | 50 |56 | The median taxable income is the highest in district 8, Seefeld, where I work and the 3rd lowest in district 4, Aussersihl, where I live. The statistic is measured based on residence. 57 |
58 | 59 |62 | Inhabitans are between 0 and 107 years old. 89 women and 17 men are 100 or more years old. 63 |
64 | 65 |68 | Enough about human inhabitants, what else is there? 69 |
70 | 71 |74 | There are 6'928 dogs registered as of March 7th 2016, calling one of the twelve districts their home. Two mystery dogs do not live in a specific district: 75 |
91 | If you want to see a labrador retriever head to district 7, for chihuahuas district 11 should deliver. 92 |
93 | 94 |4'766 dogs are registered by women, 2'164 by men.
97 |The most populous primary breed with female owners is chihuahuas, with male owners labrador retrievers.
98 | 99 |Back to the bathing, here is a map of all the spots for you:
117 | 118 |Go forth and swim and chart!
121 | 122 | 123 | 124 | 154 | -------------------------------------------------------------------------------- /docs/labrador-retriever.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/interactivethings/chart-server/4d3f29b9b6bef653ef270b4da006d4025b30e3a2/docs/labrador-retriever.jpg -------------------------------------------------------------------------------- /docs/playground.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/interactivethings/chart-server/4d3f29b9b6bef653ef270b4da006d4025b30e3a2/docs/playground.gif -------------------------------------------------------------------------------- /docs/zurich.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/interactivethings/chart-server/4d3f29b9b6bef653ef270b4da006d4025b30e3a2/docs/zurich.jpg -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const vg = require('vega'); 3 | 4 | vg.config.load.baseURL = 'https://vega.github.io/vega-editor/app/'; 5 | 6 | const TYPES = { 7 | VegaLite: require('./charts/VegaLite'), 8 | Bar: require('./charts/Bar'), 9 | DistrictBar: require('./charts/DistrictBar'), 10 | DemographicBar: require('./charts/DemographicBar'), 11 | ZurichMap: require('./charts/ZurichMap') 12 | }; 13 | 14 | const app = express(); 15 | app.get('/:type', (request, response) => { 16 | if (!TYPES[request.params.type]) { 17 | return response.status(404).send('Not Found'); 18 | } 19 | 20 | const spec = TYPES[request.params.type]({ 21 | spec: JSON.parse(request.query.spec) 22 | }); 23 | vg.parse.spec(spec, (error, chart) => { 24 | if (error) { 25 | return response.status(400).send(error.toString()); 26 | } 27 | const view = chart({renderer: 'svg'}); 28 | const svg = view.update().svg(); 29 | response 30 | .set('Cache-Control', `public, max-age=${60 * 60}`) 31 | .type('svg').send(svg); 32 | view.destroy(); 33 | }); 34 | }); 35 | 36 | const PORT = process.env.PORT || 3000; 37 | app.listen(PORT, () => console.log(`Listening on ${PORT}`)); // eslint-disable-line no-console 38 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chart-server", 3 | "version": "0.0.1", 4 | "engines": { 5 | "node": "6.3.0" 6 | }, 7 | "description": "", 8 | "main": "index.js", 9 | "scripts": { 10 | "start": "node index.js" 11 | }, 12 | "license": "BSD-3-Clause", 13 | "dependencies": { 14 | "express": "^4.14.0", 15 | "vega": "^2.6.0", 16 | "vega-lite": "^1.3.1" 17 | }, 18 | "devDependencies": { 19 | "eslint": "^3.9.1", 20 | "gsheets": "^1.2.3", 21 | "nodemon": "^1.11.0" 22 | } 23 | } 24 | --------------------------------------------------------------------------------