Dear Manohar,
If I understand correctly, you want to display the value of an additional variable which is not directly used to create the plot.
You can use the “text” aesthetic in ggplot and the “tooltip” option in ggplotly.
In your case (note that I also added minimal HTML formatting code):
t5 <- data.frame(list(OrderNumber = c(1005,10010,10011,10012,10013,10028),
OrderDate=c( "2015-05-28 10:13:19", "2015-05-29 12:18:46","2015-06-01 05:18:06","2015-06-01 05:38:30","2015-06-01 05:44:13","2015-07-16 14:34:09"),
TotalCost=c(44.9800,12.8993,38.0000,38.0000,9.5000,16.5743)))
library(ggplot2)
library(plotly)
library(scales)
g <- ggplot(data = t5, aes(x = OrderDate, y = TotalCost,
text=paste("OrderNumber=", OrderNumber, "<br>",
"OrderDate=", OrderDate, "<br>",
"TotalCost=", TotalCost, "<br>",
sep="")))+
geom_line(stat = "identity",color="blue") +
geom_point() +
scale_fill_manual(name = "legend") +
ylab("Order Cost in $") +
xlab("OrderDate") +
ggtitle("OrderDetails")
ggplotly(g,tooltip="text")
Is this what you wanted?
Dear Juergen,
Thank you so much for your answer, I’m looking for same kind of report but in that graph(PFA) there is no lines even if I add “geom_lines ()”.Can you please help me to how to add lines on that.
Manu.