Last active
May 17, 2021 16:57
-
-
Save carlosalbaladejo/42f1ffae1930d410e9b1758b6bdedee0 to your computer and use it in GitHub Desktop.
Revenue by country
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://vega.github.io/schema/vega-lite/v3.json", | |
"width": 600, | |
"height": 400, | |
"data": { | |
"url": "https://api.tinybird.co/v0/sql?q=SELECT%20period%2C%20sum(total_revenues)%20as%20revenues%20FROM%20endpoint%20GROUP%20BY%20period%20FORMAT%20CSVWithNames&token=p.eyJ1IjogImM3NjkwNTQzLThjZTAtNDE2OC04NmQwLTNhMjgwNDE1NzdmOSIsICJpZCI6ICIxY2FhZTExYS05NWU5LTRiN2YtOThhZi1lZjhiY2ViZDE4ZDMifQ.ZM-S6tpGCcdUr_srDfRuSMB8raHeuW8E-NGoeWLL2dc&pipeline=orders_currency", | |
"format": { | |
"type": "csv", | |
"parse": { | |
"revenues": "number" | |
} | |
} | |
}, | |
"mark": { | |
"type": "line", | |
"interpolate": "monotone" | |
}, | |
"encoding": { | |
"x": { | |
"field": "period", | |
"type": "temporal", | |
"title": "period" | |
}, | |
"y": { | |
"field": "revenues", | |
"type": "quantitative", | |
"title": "revenues", | |
"scale": { | |
"domain": [30000, 55000] | |
} | |
}, | |
"tooltip": [ | |
{ | |
"field": "period", | |
"type": "temporal", | |
"title": "period", | |
"timeUnit": "utcyearmonthdatehoursminutes" | |
}, | |
{ | |
"field": "revenues", | |
"type": "quantitative" | |
} | |
] | |
}, | |
"layer": [ | |
{ | |
"mark": { | |
"type": "line" | |
}, | |
"encoding": { | |
"y": { | |
"title": "revenues", | |
"field": "revenues", | |
"type": "quantitative" | |
}, | |
"color": { | |
"value": "#E58606" | |
} | |
} | |
}, | |
{ | |
"mark": "rule", | |
"selection": { | |
"hover": { | |
"type": "single", | |
"on": "mouseover", | |
"empty": "none", | |
"nearest": true | |
} | |
}, | |
"encoding": { | |
"color": { | |
"condition": { | |
"selection": { | |
"not": "hover" | |
}, | |
"value": "transparent" | |
} | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment