Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to embed interactive plots? Edited

I'm trying to figure out a way to embed an interactive plot (created with plotly/python) on a Confluence page.  

We use the Confluence cloud service, so need to host the plot on the Confluence server. 

What I'm currently trying is this: I save the plot as an html file.  Then I upload the plot.html file to Confluence as an attachment.   Then I create an iframe macro in the Confluence page, and paste the URL of the attachment into the iframe.

But when I publish the page and view it, the browser downloads the html code for the plot, instead of displaying it.   After some investigation, what seems to be happening is that when the Atlassian server responds to an http request for the attachment, it sets the "content-disposition" field to "attachment", which tells the browser to download the file, and not try to render it.

If the html file for the plot is hosted elsewhere (i.e. on servers that don't set content-disposition to 'attachment'), embedding the plot works just fine.  e.g. https://plot.ly/~elizabethts/9.embed

Can anyone suggest a workaround to this?  Is there a way, for example, to tell Confluence NOT to set the content-disposition?   

5 answers

I know the question is a bit old, but has anyone figured out a solution? 

Hey @dom_layfield , did you ever get an answer to this question?

I am trying to also embed a Plotly chart into my internal wiki and I've tried the following:

  • Generate an HTML and embed it as an HTML (didn't work)
  • Generate a embed link to the Plot.ly chart using Chart Studio, but this is by default public and I cannot share the chart publicly.

Curious if you figured out a solution.

@Carl Shan 

Nope.  No luck with this.  Which is pretty disappointing, since our organization is using HTML plot for almost everything.  (Once you've got used to interactive plots, it is hard to go back to static!)

The only viable solution right now is to host charts on a web server outside of Atlassian.  But as far as I can see, there's no method for Confluence to authenticate, so the plots would need to be public.   For us (and for your team, it sounds like) that's not an option.

What I find incredibly frustrating about this is that from a security perspective at least, it seems far more dangerous for Confluence to allow external HTML to execute than to allow HTML from page attachments.   I really can't understand why Atlassian would allow the former, but disable the latter.

I also tried using the Atlassian REST API to see if I could change the 'content-disposition' flag via that mechanism.  But no luck there: it's not visible through the API.

For us, this is a HUGE problem.   Since all our plots are HTML, Confluence is almost useless without some ability to render them.   We are considering migrating to a different platform that will support this.

-- Dom

1 vote

I managed to embed a Plotly chart in a page.

First, export the HTML code of your figure: `fig.write_html(buffer, include_plotlyjs=False)`

Then, in Confluence, add an "HTML" macro and copy the generated code.

Remove all the `<head>...</head>` block and add the `plotly.js` script: `<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>`.

 

So to sum-up, you should have an HTML macro containing:

  • a `script` element to get the `plotly.js` library
  • a `div` element with class `plotly-graph-div` (used by plotly for rendering
  • an inline `script` element representing your chart

Save your page, and "Voilà" !

Hope it can help.

A solution maybe could be HTML files hosted on an AWS S3 bucket and then implemented into the confluence page via iframe?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence Cloud

Introducing Confluence Cloud for Microsoft Teams (Available for Preview!)

Hi Atlassian Community, Remote work has shifted how teams collaborate, and we’ve heard from many of you that Microsoft Teams has become mission critical to many of your workflows, from how you chat...

2,414 views 16 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you