This file contains hidden or 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
# this example is adapted from https://stackoverflow.com/a/50704456 | |
import requests, json | |
# handler below is a Gramex FunctionHandler object | |
# ref: https://learn.gramener.com/guide/functionhandler/ | |
# three arguments are passed from the user input: ?js=, ?json=, and ?md= | |
data = json.dumps({ | |
"public":"true", |
This file contains hidden or 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/v5.json", | |
"description": "Mobility changes for different aspects in Indian regions", | |
"width": 750, | |
"height": 700, | |
"padding": 5, | |
"title": { | |
"text": "India regional mobility changes", | |
"anchor": "middle", | |
"fontSize": 16, |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
[ | |
{ | |
"sub_region_1": "India", | |
"date": "2020-02-15", | |
"retail_and_recreation_percent_change_from_baseline": 1, | |
"grocery_and_pharmacy_percent_change_from_baseline": 2, | |
"parks_percent_change_from_baseline": 3, | |
"transit_stations_percent_change_from_baseline": 3, | |
"workplaces_percent_change_from_baseline": 5, | |
"residential_percent_change_from_baseline": 0 |
While external style definitions are retained for SVG they aren't for PNG export.
This file contains hidden or 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
// where data is a JSON object | |
let changeset = vega.changeset().remove(() => true).insert(data) | |
view.change('table', changeset) | |
.run() | |
// and where view is | |
view = new vega.View(vega.parse(spec)) | |
.renderer('svg') | |
.logLevel(vega.Warn) | |
.initialize('chart-container') |
This file contains hidden or 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/v5.json", | |
"description": "A basic bar chart example, with value labels shown upon mouse hover.", | |
"width": 650, | |
"height": 500, | |
"title": { | |
"text": "Bar Area Chart", | |
"anchor": "start", | |
"fontSize": 13, | |
"font": "Roboto", |