Skip to content

Commit

Permalink
Merge pull request #21 from EVS-GIS/named_axis
Browse files Browse the repository at this point in the history
add name with profile and map labels
  • Loading branch information
LouisManiere authored Jan 22, 2024
2 parents 8479782 + 340e044 commit 3ac9767
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/fct_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ data_get_roe_in_region <- function(selected_region_id) {
data_get_axis <- function(selected_region_id) {
query <- glue::glue("
SELECT
network_axis.fid, axis, gid_region, network_axis.geom
network_axis.fid, axis, toponyme, gid_region, network_axis.geom
FROM network_axis
WHERE gid_region = {selected_region_id}")

Expand Down
30 changes: 30 additions & 0 deletions R/fct_lg_profile.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,21 @@ lg_profile_main <- function(data, y, y_label, y_label_category) {
title = paste0(y_label_category, " - ", y_label),
side = 'left'
),
# river name
annotations = list(
text = unique(data$toponyme),
x = 1, # x-coordinate (0 to 1, where 0 is left and 1 is right)
y = -0.18, # y-coordinate (0 to 1, where 0 is bottom and 1 is top)
xref = "paper", # Use "paper" to specify coordinates relative to the entire plot
yref = "paper",
showarrow = FALSE, # Don't show the arrow
font = list(
# family = "Open Sans",
size = 14,
# color = "black"
weight = "bold"
)
),
showlegend=TRUE,
legend = list(orientation = 'h'),
hovermode = "x unified",
Expand Down Expand Up @@ -163,6 +178,20 @@ lg_profile_update_main <- function(data, y, y_label, y_label_category){
yaxis = list(
title = paste0(y_label_category, " - ", y_label),
side = 'left'
),
# put all the annotation options to replace the river name
annotations = list(list(
text = unique(data$toponyme),
x = 1, # x-coordinate (0 to 1, where 0 is left and 1 is right)
y = -0.18, # y-coordinate (0 to 1, where 0 is bottom and 1 is top)
xref = "paper", # Use "paper" to specify coordinates relative to the entire plot
yref = "paper",
showarrow = FALSE, # Don't show the arrow
font = list(
size = 14,
weight = "bold"
)
)
)
)
proxy <- list("trace" = proxy_trace,
Expand Down Expand Up @@ -208,6 +237,7 @@ lg_profile_second <- function(data, y, y_label, y_label_category){
overlaying = 'y',
side = 'right',
showgrid = FALSE, # Hide the gridlines for the second y-axis
zeroline = FALSE,
showline = FALSE # Hide the axis line for the second y-axis
)
)
Expand Down
1 change: 1 addition & 0 deletions R/fct_map.R
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ map_axis <- function(map, data_axis) {
weight = 5,
color = "#ffffff00",
opacity = 1,
label = ~toponyme,
highlightOptions = highlightOptions(
color = "red",
bringToFront = TRUE
Expand Down

0 comments on commit 3ac9767

Please sign in to comment.