Open Side Menu
Skip to contentBrand Logo
Forums
Inspiration
Ideas
Communities
Blogs
Learning
Support
RegisterSign In
  1. Microsoft Fabric Community
  2. Power BI forums
  3. Galleries
  4. R Script Showcase
fathomson's avatar
fathomson
Advocate II
9 years ago

Schedule view

  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 i...
schedules_in_powerbi_with_r.pbix381 KB
General R Visualizations
PolymathConsult's avatar
PolymathConsult
Regular Visitor
9 years ago

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

  • Anonymous's avatar
    Anonymous
    Not applicable
    9 years ago

    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... 

  • © 2026 Microsoft
  • Manage cookies
  • Privacy & cookies
  • Terms of use
  • Trademarks
Your Privacy Choices Consumer Health Privacy