Skip to content

Commit 9d2273e

Browse files
committed
When row adjust relative width of gene clusters
1 parent 7c15367 commit 9d2273e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

R/geneviewer.R

+12
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,18 @@ GC_grid <- function(
590590

591591
if(direction == "row"){
592592
GC_chart$x$graphContainer$direction <- "row"
593+
# compute the % width for each cluster
594+
num_clusters <- length(update_clusters)
595+
if (num_clusters > 0) {
596+
# Round to 3 decimals
597+
cluster_width_pct <- round(100 / num_clusters, 3)
598+
for (cluster_name in update_clusters) {
599+
# Convert numeric to character and append '%'
600+
pct_str <- paste0(cluster_width_pct, "%")
601+
GC_chart$x$series[[cluster_name]]$container$style$width <- pct_str
602+
GC_chart$x$series[[cluster_name]]$container$width <- pct_str
603+
}
604+
}
593605
}
594606

595607
# Update margins

0 commit comments

Comments
 (0)