Schedule view

Frequent Visitor
1377 Views
Highlighted
Frequent Visitor
Posts: 6
Registered: ‎09-15-2016

Schedule view

[ Edited ]

schedule

 

Description

A relatively simple visualization to show start-stop of events at locations. Can be roomscheduling but also a production process with specific states at a given time. Although it is only a few lines of R I've used it several times and think it is worth sharing!
  

Prerequisites (The sample .pbix files will not work without these prerequites completed)

1. Install R Engine

Power BI Desktop does not include, deploy or install the R engine. To run R scripts in Power BI Desktop, you must separately installR on your local computer. You can download and install R for free from many locations, including the Revolution Open download page, and the CRAN Repository.

 

2. Install the required R packages.

Download the R script attached to this message and run it to install all required packages on your local machine. 

 

Required R packages:

ggplot2


Tested on:

CRAN 3.3.1, MRO 3.3.0, powerbi.com

Attachment
Attachment
Established Member
Posts: 149
Registered: ‎06-28-2015

Re: Schedule view

There doesnt appear to be any R packages attached to this topic?

Mike Honey - Manga Solutions
www.mangasolutions.com
Frequent Visitor
Posts: 6
Registered: ‎09-15-2016

Re: Schedule view

Hi Mike,

 

The R code is inside the powerbi dashboard file. 

 

Visitor
Posts: 1
Registered: ‎07-10-2016

Re: Schedule view

This is great, exactly what I was looking for. I am quite new tto R, but was wondering......using the below script:

 

## Show schedule of projects by start / end date
#

library(ggplot2) # Visualization

# Convert timestamp to POSIXct. What do I do here to make the x-axis format to show yyyy/mm/dd? or alternatively mmm-yy?
dataset$From<-as.POSIXct(dataset$From,format="%Y-%m-%dT%H:%M:%OS")
dataset$To<-as.POSIXct(dataset$To,format="%Y-%m-%dT%H:%M:%OS")

ggplot(dataset,aes(x=datetime_start, y=dataset$Room, color=Person)) +
geom_segment(aes(x=From,xend=To,yend=dataset$Room),size=15) +
scale_colour_discrete(guide=guide_legend(override.aes=list(size=10))) +
ggtitle("Room reservations for building X") + xlab("") + ylab("") + theme_bw()

 

Thanks again and keep up the good work!!

 

Kind Regards, 

Llewellyn

Established Member
Posts: 247
Registered: ‎09-21-2016

Re: Schedule view

[ Edited ]

@PolymathConsult,

Try adding a datetime scale similar to below:

scale_x_datetime(breaks = date_breaks("1 month"), labels=date_format("%d/%m/%Y"))

 You may also want to turn the date on the X axis for easier reading

theme(axis.text.x = element_text(angle = 90))

 

P.S. You'll need to load library(scales) to use the scale_x_datetime function... 

Moderator
Posts: 40
Registered: ‎08-10-2016

Re: Schedule view

Hi Frank,

Thanks for your new R-showcases. They are very useful.  If you consider to convert some of your R-visuals to R-powered-custom visuals, out team will be happy to assist you. 

 

The visibility of R-powered custom visuals is greater and it is not limited for R-users.