Description Usage Arguments Details Value Author(s) Examples
hexjsonwidget()
accepts a hexJSON object or path to a hexjson file and render it as an HTMLwidget using d3-hexjson.
1 2 3 4 5 6 | hexjsonwidget(jsondata = NA, jsonpath = NA, jsonbase = NA,
fromdataframe = NA, data = NA, keyid = "id", colour = "col",
label = "label", layout = "odd-r", r = "r", q = "q", grid = "off",
labels = "on", missinglabel = NA, col_gridfill = "#f0f0f0",
col_hexfill = "#b0e8f0", col_textfill = "#000000", width = NULL,
height = NULL, elementId = NULL)
|
jsondata |
hexJSON object |
jsonpath |
Path to hexJSON file |
jsonbase |
Name of bundled hexJSON file |
fromdataframe |
Dataframe to be used to create a hexJSON file |
data |
Dataframe containing data to merge with hexjson file |
keyid |
Name of data column for ID info |
colour |
Name of the hex attribute used to set the hex colour; set to |
label |
Name of the hex attribute used to set the hex label; set to |
r |
Dataframe column name used to defined a row (hex::r) when using fromdataframe |
q |
Dataframe column name used to defined a column (hex::q) when using fromdataframe |
grid |
Display a background grid in whitespace (either |
missinglabel |
Value to use for missing label; if set to |
col_gridfill |
Default fill colour for grid hex |
col_hexfill |
Default fill colour for data hex if "col" hex value not set |
col_textfill |
Default fill colour for hex text label |
width |
Widget width |
height |
Widget height |
elementId |
Widget element ID |
If a hexJSON hexobject includes a col
attribute, this will be used to colour the hex.
If it contains a label
attribute, it will be used to label the hex.
an HTMLwidget object
Tony Hirst (@psychemedia)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | hexjsonwidget( fromJSON('./example.hexjson') )
hexjsonwidget(jsonpath='./example-grid.hexjson')
hexjsonwidget(jj, grid='on', col_gridfill='#113355', col_hexfill='#FF0000')
hexjsonwidget(jj, grid='off', col_textfill="orange")
hexjsonwidget(jj, col_hexfill='#bb3388')
hexjsonwidget(jj, grid='off', col_textfill="orange",colour=NA)
df=data.frame(id=c("Q0R0","Q1R2"),colour=c('orange','#ffddbb'),label=c('','test a'))
hexjsonwidget(jsonbase="example-grid.hexjson",data=df,colour='colour')
jdf=data.frame(id=c("Q0R0","Q1R1","Q1R2"),q=c(0,1,1),
row=c(0,1,2), colour=c('yellow','#ddbb99','green'))
jjx=hexjsonfromdataframe(jdf,r='row', keyid='id')
hexjsonwidget(jjx, colour='colour')
hexjsonwidget(fromdataframe=jdf, r='row', keyid='key',colour='colour')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.