Skip to content

Commit

Permalink
add horizontal line equal to best performance score (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewelamb authored Nov 4, 2021
1 parent 4e4537e commit 4d053c1
Showing 1 changed file with 33 additions and 11 deletions.
44 changes: 33 additions & 11 deletions performance-dashboard.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ params:
plot_title": "Performance"
x_axis_label: "Date"
y_axis_label: "Score"
evaluation_id: 0
evaluation_id: 9614652

title: "`r params$title`"
---
Expand Down Expand Up @@ -57,7 +57,13 @@ score_table <-
dplyr::mutate(
"temp_max" = .data$score > cummax(dplyr::lag(.data$score, default = 0))
) %>%
dplyr::select("score", "date", "datetime", "temp_max", "tool__author", "tool__name")
dplyr::select("score", "date", "datetime", "temp_max", "tool__author", "tool__name") %>%
dplyr::mutate("text" = paste(
'</br> Team: ', .data$tool__author,
'</br> Tool: ', .data$tool__name,
'</br> Score: ', .data$score,
'</br> Date Time: ', .data$datetime
))
```

Expand All @@ -70,22 +76,27 @@ Row

```{r}
plot <-
best_tool <- score_table %>%
dplyr::select("score", "date", "text", "temp_max") %>%
dplyr::filter(.data$score == max(.data$score)) %>%
dplyr::add_row(
"score" = .$score,
"date" = seq(.$date, max(score_table$date), length.out = 20),
"text" = .$text,
"temp_max" = .$temp_max
)
plot <- score_table %>%
plotly::plot_ly(
data = score_table,
x = ~date,
y = ~score,
type = "scatter",
mode = "markers",
color = ~temp_max,
hoverinfo = 'text',
showlegend = FALSE,
text = ~paste(
'</br> Team: ', tool__author,
'</br> Tool: ', tool__name,
'</br> Score: ', score,
'</br> Date Time: ', datetime
)
text = ~text
) %>%
plotly::add_trace(
data = dplyr::filter(score_table, .data$temp_max),
Expand All @@ -94,17 +105,28 @@ plot <-
type ="scatter",
mode = "lines"
) %>%
plotly::add_trace(
data = best_tool,
x = ~date,
y = ~score,
type ="scatter",
mode = "lines",
hoverinfo = 'text',
text = ~text
) %>%
plotly::layout(
title = params$plot_title,
xaxis = list(title = params$x_axis_label),
yaxis = list(
title = params$y_axis_label,
range = list(0, 1)
)
) %>%
) %>%
plotly::partial_bundle()
plot
Expand Down

0 comments on commit 4d053c1

Please sign in to comment.