Interactive sunbuRst graphs in Power BI in 5 minutes!!

July 13, 2017
By

(This article was first published on R – Longhow Lam's Blog, and kindly contributed to R-bloggers)

pbiviztool

Introduction

If I mention Power BI to fellow data scientists I often get strange looks. However, I quite like the tool, it is an easy and fast way to share results, KPI’s and graphs with others. With the latest release, Power BI now supports interactive R graphs, and they are easy to create as well.

Steps to follow

1. Install Node.JS from here and then you can install the power bi tools with:

>npm install -g powerbi-visuals-tools

2. Create a new custom R visual:

>pbiviz new sunburstRHTMLVisual -t rhtml

3. This will create a directory sunburstRHTMLVisual. In that directory, edit the R script file script.r. It’s a one-liner to create a sunburst graph with the sunburstR package.

 

Values is the name of the input data frame, the data that is received from within the Power BI desktop application.

4. Now create the custom R visual as package with the following command: (issue this command inside the directory sunburstRHTMLVisual)

>pbiviz package

5. Inside the sub folder dist you will now find the file sunburstRHTMLVisual.pbiviz, this can be used in Power BI. Open the Power BI desktop application and import a custom visual from file. Select the sunburstRHTMLVisual.pbiviz file

 

That’s it, you’re done!

The resulting graph in a dashboard

To use the visual you will need a data set in power bi with two columns, one with the sequences and one with the number of occurrences of the corresponding sequence.

 

Click on the icon of the custom R visual you’ve just imported and select the two columns to get the interactive sunburst graph. Once the graph is created, you can hover over the rings to get more info, and you can turn on/off the legend.

 

Cheers, Longhow.

To leave a comment for the author, please follow the link and comment on their blog: R – Longhow Lam's Blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers

Sponsors

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)