Using Interactive D3.js charts from within Tiki with rNVD3

[This article was first published on UEB Blog. Musings on R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I’ve recently managed to reproduce my first charts using the nice package rNVD3 from Ramnath Vaidyanathan:
https://github.com/ramnathv/rNVD3

This rNVD3 package uses NVD3, which provides re-usable charts with d3.js, without taking away the power that d3.js brings with itself. But let’s make a “Hello world” type of example, with the minimum complexity in it.

For this, I just needed to copy one of Ramnath’s examples, but I will save the html to disk, with something like object$save('foo.html') instead of object$printChart('foo.html'). used in his example

And then, you can load the html in a wiki page with an iframe. Easy.

Proof of concept

A working proof-of-concept reusing your rNVD3 package can be found here:
http://r-es.org/r_test8

The main code is this one:


	
			Plugin execution pending approval
	

			This plugin was recently added or modified. Until an editor of the site validates the parameters, execution will not be possible. 
					






	
			Plugin execution pending approval
	

			This plugin was recently added or modified. Until an editor of the site validates the parameters, execution will not be possible. 
					

Results

And once everything is ready in your system (all packages installed, etc), you’ll see something like this:

Click to enlarge
Click to enlarge


And when you change from “Grouped display” to “Stacked display”, you will see a transition of data changing from one display to the other in real time in your browser, ending with this:

Click to enlarge
Click to enlarge

Details

The Web platform to manage the whole thing is Tiki ( https://tiki.org ), and the communication with R is handled by PluginR ( https://doc.tiki.org/PluginR ), as usual with most of our work.

This example has been added as a new test (r_test7) in the Tiki configuration profile http://profiles.tiki.org/r_test . Therefore, when you apply ( ~ install) this profile in your Tiki, you’ll have this whole test loaded in a new wiki page, handy for you to play with it.

Future work

For later I leave my goal to achieve running some shiny app from a Wiki page in Tiki (in case this is possible!, which I’m not sure yet, maybe some new development is needed)

First impressions

For the time being, I’m quite glad with the first impression by the rNVD3 author (Ramnath Vaidyanathan) when he first knew about this proof-of-concept a few hours ago:

Ramnath Vaidyanathan wrote:
First off, nice work embedding it in a Wiki. A key objective of rCharts is to make it easy to share charts and this is a great way to do it.


Oh well, thanks for you nice words. Some more work is in the oven with PluginR, so stay tuned! :-)

To leave a comment for the author, please follow the link and comment on their blog: UEB Blog. Musings on R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)