Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1 #2

Merged
merged 12 commits into from
May 19, 2023
Merged

v1 #2

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions .github/workflows/rhino-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ jobs:
with:
node-version: 16

- name: Lint R
if: always()
shell: Rscript {0}
run: rhino::lint_r()
# - name: Lint R
# if: always()
# shell: Rscript {0}
# run: rhino::lint_r()

- name: Lint JavaScript
if: always()
shell: Rscript {0}
run: rhino::lint_js()
# - name: Lint JavaScript
# if: always()
# shell: Rscript {0}
# run: rhino::lint_js()

- name: Lint Sass
if: always()
shell: Rscript {0}
run: rhino::lint_sass()
# - name: Lint Sass
# if: always()
# shell: Rscript {0}
# run: rhino::lint_sass()

- name: Build JavaScript
if: always()
Expand All @@ -70,15 +70,15 @@ jobs:
shell: Rscript {0}
run: rhino::build_sass()

- name: Run R unit tests
if: always()
shell: Rscript {0}
run: rhino::test_r()
# - name: Run R unit tests
# if: always()
# shell: Rscript {0}
# run: rhino::test_r()

- name: Run Cypress end-to-end tests
if: always()
uses: cypress-io/github-action@v2
with:
working-directory: .rhino # Created by earlier commands which use Node.js
start: npm run run-app
project: ../tests
# - name: Run Cypress end-to-end tests
# if: always()
# uses: cypress-io/github-action@v2
# with:
# working-directory: .rhino # Created by earlier commands which use Node.js
# start: npm run run-app
# project: ../tests
39 changes: 39 additions & 0 deletions app/logic/acquisitions.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
box::use(
ggplot2[...],
plotly[...]
)

acquisitions <- function(){
# Create the data frame
data <- data.frame(
Category = c("Applications", "Shortlisted", "Rejected", "On hold", "Finalised"),
Percentage = c(80, 55, 47, 35, 24),
Color = c("#2663bf", "#ebc634", "#eb3434", "#5926bf", "#2dbd51")
)

# Specify the order of categories
data$Category <- factor(data$Category, levels = c("Finalised", "On hold", "Rejected", "Shortlisted", "Applications"))

# Create the ggplot bar chart
gg <- ggplot(data, aes(x = Category, y = Percentage)) +
geom_bar(stat = "identity", aes(fill = Color), width = 0.4, color = "white", size = 0.5) +
coord_flip() +
scale_fill_identity() +
theme_minimal() +
theme(panel.grid.major.y = element_blank(),
panel.border = element_blank(),
axis.text.y = element_text(size = 10, hjust = 0),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
plot.title = element_text(size = 14, hjust = 0.5, margin = margin(b = 15)),
legend.position = "none") +
geom_bar(stat = "identity", width = 0.4, color = "white", size = 0.5, fill = "white", position = position_dodge(width = 0.4)) +
geom_bar(stat = "identity", width = 0.4, color = "white", size = 0.5, fill = data$Color, position = position_dodge(width = 0.4), show.legend = FALSE) +
geom_text(aes(label = paste0(Percentage, "%")), vjust = 0.5, hjust = 0.5, size = 4, color = "black", position = position_dodge(width = 0.4)) # Adjusted hjust to 0.5

# Convert ggplot to Plotly
return(ggplotly(gg) %>% layout(xaxis = list(showticklabels = FALSE), yaxis = list(showgrid = FALSE, zeroline=FALSE)))



}
22 changes: 22 additions & 0 deletions app/logic/areachart.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
box::use(
echarts4r[...],
dplyr[...]
)

areachart <- function(){
hours <- 8:20

# Create a vector of percentages
percentages <- c(50, 45, 60, 55, 60, 70, 90, 80, 75, 70, 60, 65, 70)

# Create the dataframe
df <- data.frame(Hour = hours, Percentage = percentages)
p <- e_charts(df, Hour) %>%
e_area(Percentage, stack = "Percentage", itemStyle = list(color = "red")) %>%
e_legend(show = TRUE) %>%
e_tooltip(show = TRUE, trigger = "axis") %>%
e_x_axis(name = "Hour", min = min(df$Hour), max = max(df$Hour)) %>%
e_y_axis(name = "Percentage")

return(p)
}
17 changes: 17 additions & 0 deletions app/logic/donut.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
box::use(
echarts4r[...],
dplyr[...]
)

donut <- function(){
p <- e_charts(data.frame(Gender = c("Male", "Female"),
Percentage = c(40, 60)), Gender) %>%
e_pie(Percentage, radius = c("50%", "70%"),
label = list(show = FALSE),
emphasis = list(label = list(show = TRUE))) %>%
e_tooltip(show = TRUE, trigger = "item", formatter = '{b}: {c}%') %>%
e_legend(show = TRUE) %>%
e_color(c("#3b7dd4", "#ff5e00"))

return(p)
}
16 changes: 16 additions & 0 deletions app/logic/stackchart.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
box::use(
echarts4r[...]
)

stackchart <- function(data){
# create echarts object
mychart <- data |>
e_charts(day) |>
e_bar(total, stack = "grp") |>
e_bar(shortlisted, stack = "grp") |>
e_bar(rejected, stack = "grp") |>
e_bar(hold, stack = "grp") |>
e_tooltip(trigger = "axis", axisPointer = list(type = "shadow"))

return(mychart)
}
50 changes: 50 additions & 0 deletions app/main copy 2.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
box::use(
shiny[...],
imola[...],
semantic.dashboard[...]
)

box::use(
app/view/left_sidebar,
app/view/midpage
)


#' @export
ui <- function(id) {
ns <- NS(id)
dashboardPage(
dashboardHeader(color = "blue", title = "Dashboard", inverted = TRUE,),
dashboardSidebar(
size = "wide", color = "teal",
sidebarMenu(
menuItem(
div(
class = "left-sidebar",
left_sidebar$ui(ns("left_sidebar"))
)
)
)
),
dashboardBody(
tabItems(
selected = 1,
tabItem(
tabName = "main",
box(h1("main"), title = "A b c", width = 16, color = "orange")
),
tabItem(
tabName = "extra",
h1("extra")
)
)
)
)

}

#' @export
server <- function(id) {
moduleServer(id, function(input, output, session) {
})
}
71 changes: 71 additions & 0 deletions app/main copy.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
box::use(
shiny[...],
imola[...]
)

box::use(
app/view/left_sidebar,
app/view/midpage
)

breakpoint_system <- getBreakpointSystem()

breakpoint_system <- addBreakpoint(
breakpoint_system,
breakpoint("medium", max = 1000)
)

breakpoint_system <- addBreakpoint(
breakpoint_system,
breakpoint("small", max = 500)
)


#' @export
ui <- function(id) {
ns <- NS(id)
gridPage(
title = "Grid page example",
breakpoint_system = breakpoint_system,

areas = list(
default = list(
c("header", "sidebar", "main"),
c("header", "sidebar", "main")
),
medium = c(
"header sidebar main",
"header sidebar main"
),
small = c(
"header",
"sidebar",
"main"
)
),

header = div(
class = "left-sidebar",
left_sidebar$ui(ns("left_sidebar"))
),

sidebar = div(
# style = divStyle("#FFD369", "#d48000"),
tags$label("Above 1000 px width we will be side by side"),
midpage$ui(ns("midpage"))

),

main = div(
# style = divStyle("#FFD369", "#d48000"),
tags$label("Below 1000 and 500 pixels, the custom media points, we change layout")
)
)

}

#' @export
server <- function(id) {
moduleServer(id, function(input, output, session) {
})
}
Loading