-
-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Table finalize hook fix and example (#1711)
* #1708 * Minor tweak to notebook * add additional URL * committing mostly to test failing Travis build * move file to new directory per @jlstevens suggestion
- Loading branch information
1 parent
1f410b9
commit 3035c7d
Showing
2 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
77 changes: 77 additions & 0 deletions
77
examples/reference/features/bokeh/table_hooks_example.ipynb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import holoviews as hv\n", | ||
"from bokeh.models import HTMLTemplateFormatter\n", | ||
"hv.extension('bokeh')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Declare Data" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"name = ['homepage', 'github', 'chat']\n", | ||
"link = ['http://holoviews.org', 'https://github.com/ioam/holoviews', 'https://gitter.im/ioam/holoviews']\n", | ||
"table = hv.Table({'Name':name, 'Link':link}, vdims = ['Name', 'Link'], kdims=[])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Plot" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%%opts Table [width=500]\n", | ||
"def apply_format(plot, element):\n", | ||
" plot.handles['plot'].columns[1].formatter=HTMLTemplateFormatter(template='<a href=\"<%= value %>\"><%= value %></a>')\n", | ||
"\n", | ||
"table.opts(plot=dict(finalize_hooks=[apply_format]))" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.5.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
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