Performance Measures Comparison

The following is a comparison of nine KPIs for Call Center measures. Although labeled generically (Measure1, etc.), each is measured by converting raw averages to a 100-point scale with numbers plotted to show current results compared to previous results.

knitr::opts_chunk$set(echo = TRUE)
library(plotly)
Measures <- c("Measure 1",  "Measure 2",    "Measure 3",    "Measure 4",    "Measure 5",    "Measure 6",    "Measure 7",    "Measure 8",    "Measure 9")
Scores <- c(56.60,  98.05,  100,    81.38,  76.00,  95.00,  83.85,  
            35.20,  100)  #Current scores
Previous <- c(65.68,    78.75,  99.75,  77.81,  83.65,  93.65,  79.45,  7.57,
              100.00) #Previous scores
Red <- c(25, 25, 25, 25, 25, 25, 25, 25, 25)  # Plots the "Unsatisfactory" level
Yellow <- c(25, 25, 25, 25, 25, 25, 25, 25, 25) # plots the "Approaching Limit" level
White <- c(25, 25, 25, 25, 25, 25, 25, 25, 25)  # plots the "Meets Goal" level
Green <- c(25, 25, 25, 25, 25, 25, 25, 25, 25)  # Plots the "Exceeds Goal" level
width = c(2, 4, 2, 2, 2, 2, 2, 2, 2)
data <- data.frame(Measures, Scores, Previous, Red, Yellow, White, Green, width)
p <- plot_ly(data, x = ~Measures, y = ~Red, type = 'bar', width = 4, name = 'Unsatisfactory', 
             marker = list(color = "red", line = list(color = 'black', width = 2))) %>%
  add_trace(y = ~Yellow, name = 'Approaching Limit', 
            marker = list(color = "yellow", line = list(color = "black"))) %>%
  add_trace(y = ~White, name = 'Meets Goal', 
            marker = list(color = "white", line = list(color = "black"))) %>%
  add_trace(y = ~Green, name = 'Exceeds Goal', 
            marker = list(color = "green", line = list(color = "black"))) %>%
  add_markers(y = ~Previous, name = 'Previous Score', hoverinfo = 'text', text = ~Previous,
              marker = list(color = "blue", line = list(color = "blue"))) %>%
  add_markers(y = ~Scores, name = 'Current Score', hoverinfo = 'text', text = ~Scores,
              marker = list(color = "black", line = list(color = "black"))) %>%
  layout(width = 1000, autosize = TRUE) %>%
  add_annotations(text = Scores,
                  x = Measures,
                  y = Scores,
                  font = list(family = 'Arial',
                              size = 14,
                              color = 'black'),
                  xanchor = 'left',
                  showarrow = FALSE) %>%
  add_annotations(text = Previous,
                  x = Measures,
                  y = Previous,
                  font = list(family = 'Arial',
                              size = 14,
                              color = 'blue'),
                  xanchor = 'right',
                  showarrow = FALSE) %>%
  layout(title = 'Performance Comparison - APR 2018 vs. MAR 2018', 
         yaxis = list(title = 'Performance', nticks = 5, dtick = 25), 
         barmode = 'stack')
p

Note: Normally I would use echo = False in the code to show only the chart and not confuse the non-progammer viewer.