Possible hyperlink bug?


#1

When inserting a hyperlink into a plot I think there’s a bug if the URL doesn’t start with http:// or https://

Following the instructions on the plotly website: "Links, Text, and HTML in Graphs"
If the link in question is as following, things work fine:
<a href="http://google.com">TEXT</a>
However, the following does not work:
<a href="./local_file.html">TEXT</a>

The problem has also been described here: https://stackoverflow.com/questions/39751862/plotly-py-add-link-to-local-file

A minimum reproducible example, I am attempting to turn the tick labels on the Y axis into hyperlinks to either an external website or a local website.

library(ggplot2)
library(plotly)

df <- data.frame(a=rnorm(100), b=rnorm(100))
p <- ggplot(data=df, aes(x=a, y=b)) + geom_point()

p <- plotly_build(p)

#api the below doesn't work:
p$x$layout$yaxis$ticktext <- paste('<a href="./local.html">', p$x$layout$yaxis$ticktext, "</a>")
#however the below does work:
p$x$layout$yaxis$ticktext <- paste('<a href="http://google.coml">', p$x$layout$yaxis$ticktext, "</a>")

attr(p$x$layout$yaxis$ticktext, 'apiSrc') <- TRUE
p

Hyperlink Y Axis Tick Text
#2

Still haven’t found a solution to this, perhaps someone could take a look into reproducing the bug?