Created
June 9, 2020 12:05
-
-
Save bkamapantula/1ac2053ab77acecedbf3b49d13ed299c to your computer and use it in GitHub Desktop.
Created with Gramex Charts. Visit at https://gramener.com/gramexcharts
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
[ | |
{ | |
"a": 1, | |
"b": 2 | |
} | |
] |
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
data = { | |
// JSON or a CSV endpoint | |
url: "https://gist.githubusercontent.com/LakshmiVSeelam/9f8dedc6018457c40e91cac9009e0951/raw/a7d3b580bb01d5770f1806c12e05179f5ee7b02e/horz_bar_data.json" | |
} | |
base_spec = "https://gist.githubusercontent.com/LakshmiVSeelam/8061a0e1a5a948f3f0611835da8ae093/raw/bfdaf46b986214b7b1b368c24363665b530d0283/horz_bar_config.json" | |
function draw(data, el, opts) { | |
$.getJSON(base_spec, function(spec) { | |
var mark_bar = _.filter(spec.marks, function(mark) { return mark.name == 'bars' })[0] | |
mark_bar.encode.update.tooltip = {signal: "datum"} | |
new vega.View(vega.parse(spec)) | |
.renderer('svg') | |
.tooltip(new vegaTooltip.Handler().call) | |
.logLevel(vega.Warn) | |
.initialize(el) | |
.hover() | |
.run() | |
}) // getJSON | |
} | |
scripts = [ | |
"https://unpkg.com/[email protected]/build/vega.min.js", | |
"https://unpkg.com/[email protected]/build/vega-tooltip.min.js" | |
] | |
options = { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment