Hi @all,
I would like to create a aan appealing stacked barchart.
Similar to this:
Preferably with the option for tooltips on the bars. What do you prefer when it comes to appealing bar charts? What would recommend?
Thank you!
Best
Mart
Hi @all,
I would like to create a aan appealing stacked barchart.
Similar to this:
Preferably with the option for tooltips on the bars. What do you prefer when it comes to appealing bar charts? What would recommend?
Thank you!
Best
Mart
Plotly is good choice for this. If you already use ggplot2, it's quite easy to convert to plotly by using plotly::ggplotly()
. Here is an example of creating a bar chart with ggplot and then turning it into an interactive chart. You can set custom text for the tooltip by using the text
argument inside aes()
.
library(tidyverse)
library(plotly)
p <- mpg %>%
count(class, drv) %>%
ggplot() +
geom_col(
aes(
x = class, y = n, fill = drv,
text = paste0(
"Class: ", class, "<br>",
"Drive: ", drv, "<br>",
"Cars: ", n
)
)
)
ggplotly(p, tooltip = "text")
I would like to display a textOuput together with a html Text in one line.
Example:
tags$h5("Cost: ", textOutput("marklerCost")),
At the moment:
Cost:
121223€
Would like:
Cost: 121212€
Can you tell me how to deal with it or refer to a similar solved issue.
Thanks
Mart
Your easiest move is to paste() cost into your return of your rendered.
The alternative is to learn html/css, w3schools is a good resource for that. Stuff like display of parent divs , such as flex etc.
I am already using paste in the return function.
At least in my case it does not solve the issue.
output$Cost <- { renderText(
paste(
calcMaxPrice(), " €")
)}
But you could paste the word cost. As a third thing that is being pasted....
This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.