Skip to content

Instantly share code, notes, and snippets.

@JuanBarros2
Last active November 15, 2017 23:25
Show Gist options
  • Save JuanBarros2/5f54da86f6e1f266caa8358ec95d23c8 to your computer and use it in GitHub Desktop.
Save JuanBarros2/5f54da86f6e1f266caa8358ec95d23c8 to your computer and use it in GitHub Desktop.
4 Visualizações de dados do açude de boqueirão

1- Contagem de pesquisas realizadas por mês 2- Ranquear médias anuais 3- Média mensal de volumes 4- Identificar declínios acentuados

{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"data": {
"url": "https://api.insa.gov.br/reservatorios/12172/monitoramento",
"format": {
"type": "json",
"property": "volumes",
"parse": { "DataInformacao": "utc:'%d/%m/%Y'" }
}
},
"width": 800,
"height": 120,
"mark": "bar",
"encoding": {
"x": {
"timeUnit": "year",
"field": "DataInformacao",
"type": "ordinal"
},
"y": {
"aggregate": "count",
"field": "DataInformacao",
"type": "quantitative"
}
}
}
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"data": {
"url": "https://api.insa.gov.br/reservatorios/12172/monitoramento",
"format": {
"type": "json",
"property": "volumes",
"parse": { "DataInformacao": "utc:'%d/%m/%Y'" }
}
},
"transform": [
{
"filter": {
"field": "DataInformacao",
"range": [{"year": 2007}, {"year": 2018}]
}
}
],
"height": 800,
"width": 100,
"mark": {
"type": "text",
"align": "center",
"baseline": "middle"
},
"encoding": {
"y": {
"axis": {
"title":"Média Volumétrica em Porcentagem"
},
"field": "VolumePercentual",
"type": "quantitative",
"aggregate": "mean"
},
"text":{
"field": "DataInformacao",
"type": "nominal",
"timeUnit": "year"
}
}
}
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"data": {
"url":"https://api.insa.gov.br/reservatorios/12172/monitoramento",
"format": {
"type": "json",
"property": "volumes",
"parse": {"DataInformacao": "utc:'%d/%m/%Y'" }
}
},
"mark":"line",
"width": 800,
"height": 600,
"transform": [
{
"filter": {
"field": "DataInformacao",
"range": [{"year": 2008}, {"year": 2018}]
}
}
],
"encoding":{
"x": {
"timeUnit": "month",
"field": "DataInformacao",
"type": "temporal",
"axis": { "title": "Mês"}
},
"y": {
"aggregate": "mean",
"field": "VolumePercentual",
"type": "quantitative",
"axis": { "title": "Média de Volume Mensal em Porcentagem"}
},
"color":{
"timeUnit": "year",
"field": "DataInformacao",
"type": "nominal",
"legend": {
"title": "Ano"
}
},
"size": {"value": 5}
}
}
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"data": {
"url": "https://api.insa.gov.br/reservatorios/12172/monitoramento",
"format": {
"type": "json",
"property": "volumes",
"parse": { "DataInformacao": "utc:'%d/%m/%Y'" }
}
},
"width": 800,
"height": 120,
"mark": "bar",
"encoding": {
"x": {
"timeUnit": "year",
"field": "DataInformacao",
"type": "ordinal"
},
"y": {
"aggregate": "count",
"field": "DataInformacao",
"type": "quantitative"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment