HTML Visualizations
Your code can generate and display HTML.
To create an HTML widget, paste in the following:
R
library("cdsw") html('<svg><circle cx="50" cy="50" r="50" fill="red" /></svg>')
Python
from IPython.display import HTML HTML('<svg><circle cx="50" cy="50" r="50" fill="red" /></svg>')
Scala
Cloudera Data Science Workbench allows you to build visualization libraries for Scala
using jvm-repr. The following example demonstrates how to register a custom HTML
representation with the "text/html"
mimetype in Cloudera Data Science
Workbench. This output will render as HTML in your workbench session.
//HTML representation case class HTML(html: String) //Register a displayer to render html Displayers.register(classOf[HTML], new Displayer[HTML] { override def display(html: HTML): java.util.Map[String, String] = { Map( "text/html" -> html.html ).asJava } }) val helloHTML = HTML("<h1> <em> Hello World </em> </h1>") display(helloHTML)