Highcharts export does not work on shinyapps.io

498 views
Skip to first unread message

Roy Francis

unread,
Jan 6, 2016, 7:46:06 AM1/6/16
to ShinyApps Users
I am using the Highcharts interactive graphs using rCharts in a shiny app. I noticed that the export (download) plot functionality does not function on shinyapps.io. When clicking, it produces a blank page and that's it. Then I need to refresh the page and the app restarts. But the same app on a server running shiny-server works fine. The plot is downloaded as a png image. It also works fine locally when the app is opened in a browser. Has anyone come across a similar issue?

Below is a screenshot of the export functionality within the highcharts plot.

Thanks.

Tareef Kawaf

unread,
Jan 6, 2016, 8:04:40 AM1/6/16
to Roy Francis, ShinyApps Users
I would guess that the URL being generated isn't being let through shinyapps.io properly. Would it be possible for you to hare a simple example that illustrates the problem with us so we can take a look at it please?

--
You received this message because you are subscribed to the Google Groups "ShinyApps Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shinyapps-use...@googlegroups.com.
To post to this group, send email to shinyap...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shinyapps-users/0217fd1a-3067-4dea-b17d-7f08ba66a138%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roy Francis

unread,
Jan 6, 2016, 9:10:37 AM1/6/16
to ShinyApps Users, royma...@gmail.com
Here is a reproducible example:

 

## ui.R
library
(rCharts)
shinyUI
(
  fluidPage
(
  headerPanel
("rCharts: Export issue"),
  helpText
("Export options work locally and on shiny-server but fails to work on shinyapps.io."),
  tags$br
(),
    showOutput
("myChart", "highcharts"),
    tags$br
(),
   
#includeMarkdown("info.md")
    verbatimTextOutput
("display")
))

## server.r
library(rCharts)
shinyServer(function(input, output) {
  output$myChart <- renderChart({
    data(iris)
    is <- iris[c(1:10,51:60,101:110),]
    is$Species <- factor(as.character(is$Species))
    p1 <- rCharts::hPlot(x="Species", y="Sepal.Length", data = is, color = "Species", type = 'bar')
    p1$addParams(dom = 'myChart')
    p1$exporting(enabled=T,
                buttons=list(
                  contextButton = list(
                    align = 'left',
                    verticalAlign = 'top'
                  )
                ))
    p1$chart(zoomType='x',
            height=500,
            width=800)
    return(p1)
  })
  
  output$display <- renderText({
    paste0(capture.output(sessionInfo()),"\n")
  })
})
 

And here is this code on my shinyapps page. This link is temporary.

Tareef Kawaf

unread,
Jan 6, 2016, 9:30:44 AM1/6/16
to Roy Francis, ShinyApps Users
I am not an expert, but it looks like the issue is that highcharts is requesting the download over http whereas the rest of the page is served over https.  I wonder if that is an option in highcharts which would allow you to specify that you only want the downloads to occur over https.  

I found the issue by looking at the javascript console before clicking on "Download PNG".  You can see that the browser is rejecting the request outright so it is never making it to shinyapps.io.

-Tareef

--
You received this message because you are subscribed to the Google Groups "ShinyApps Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shinyapps-use...@googlegroups.com.
To post to this group, send email to shinyap...@googlegroups.com.

Robin Sheridan

unread,
Jan 14, 2016, 5:13:08 PM1/14/16
to ShinyApps Users, royma...@gmail.com
Hi guys, 

Having the same issue. It looks as if the export feature works fine on a mac (running chrome). But I get the same issue when trying to export on my windows work machine (also running chrome). No error messages, and I can't find anything in the logs from shinyapps either (although this is not surprising, as its a browser issue probably). 

Any ideas? 

R

Andy Kipp

unread,
Jan 25, 2016, 10:24:27 AM1/25/16
to Robin Sheridan, ShinyApps Users, Roy Francis
Is there anything in the Javascript console?

Roy Francis

unread,
Jan 25, 2016, 3:36:38 PM1/25/16
to ShinyApps Users, robbi...@gmail.com, royma...@gmail.com
Mixed Content: The page at 'https://website/' was loaded over a secure connection, but contains a form which targets an insecure endpoint 'http://export.highcharts.com/'. This endpoint should be made available over a secure connection.

Unfortunately, Highcharts does not support exporting over https.

Roy 

Andy Kipp

unread,
Jan 25, 2016, 3:41:42 PM1/25/16
to Roy Francis, ShinyApps Users, Robin Sheridan
:-(

It it possible to use the workaround that was suggested?

--
You received this message because you are subscribed to the Google Groups "ShinyApps Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shinyapps-use...@googlegroups.com.
To post to this group, send email to shinyap...@googlegroups.com.

Roy Francis

unread,
Jan 25, 2016, 5:25:59 PM1/25/16
to ShinyApps Users, royma...@gmail.com, robbi...@gmail.com
The two suggested options are: to create a custom server (which I think is too complicated) and to use client-side export.
I tried setting fallbackToExportServer=FALSE
but I don't think it changed much.

I also noticed that it works sometimes and crashes other times. It's not entirely consistent.

Roy

Mark Riseley

unread,
Feb 8, 2016, 10:48:25 AM2/8/16
to ShinyApps Users, royma...@gmail.com, robbi...@gmail.com
I got this to work in my apps by declaring the normal exporting url as https eg:

p1$exporting(enabled = TRUE, url = 'https://export.highcharts.com', ...
)
Reply all
Reply to author
Forward
0 new messages