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 can I pass html-text from page or user macro into a custom macro graphviz Edited

Hi,

plan is to render a organization chart for my using the App "Graphviz". The data comes from SQL-Query using the App "SQL for Confluence".

The Macro "graph-from-table" doesen't work for me, because I need special formated objects/labels to display as you can see below.

 

The following data was generated in a Confluence User Macro using Javascript and stored on page in this html tag:

<p id="GVFINALDATA"></p>

Here is the Data from the Confluence User Macro:

digraph {

graph [fontname = "arial"];

node [shape = record, fontname = "arial"];

edge [fontname = "arial"];

"xxx"[label="{Namexxx|{Typ: xxx|ID1: xxx|ID2: xxx}}"];

"yyy"[label="{Nameyyy|{Typ: yyy|ID1: yyy|ID2: yyy}}"];

... more lines of labels ...

"xxx" -> "yyy";

... more lines of relations ...

}

 

I tested Velocity and also Javascript to generate the data. The problem is always the last step, copying the data into the body of the graphviz macro.

It works, if I hand over pre defined data using velocity (server site) to the Macro.

 

#set ($data = 'digraph { graph [fontname = "arial"]; ... more lines ...}')

<ac:structured-macro ac:macro-id="fe3a6021-d09b-495b-8079-7b33c223cba1" ac:name="graphviz" ac:schema-version="1">

<ac:plain-text-body><![CDATA[$data]]></ac:plain-text-body>

</ac:structured-macro>

 

But it doesent't work using Javacript at client site - I know it's to late, the page already exists.

So, the question is, how can I call the Macro "graphviz" using javascript on client site and passing the data into the body? 

Or is it possible to use velocity in a new User Macro, which reads the data from the existing html paragraph like using "document.all.GVFINALDATA.innerHTML" in Javascript?

Many thanks for your help.

Reguards Jörg

 

 

2 answers

I've additional information but not the solution...

The following example works...

 

AJS.toInit(function() {

document.getElementById('GVOUTPUT').innerHTML = '$action.getHelper().renderConfluenceMacro("{cheese}")';

})

 

But not the one with the Call for the "graphviz"...

AJS.toInit(function() {

document.getElementById('GVOUTPUT').innerHTML = '$action.getHelper().renderConfluenceMacro("{digraph:"Test XXX Test"}")';

})

0 votes
Bill Bailey Community Leader Apr 08, 2020

Is Graphviz available as a Confluence plugin?

Yes, it is.

 

Graphviz Diagrams for Confluence

by Bob Swift Atlassian Apps (an Appfire company)

 

We use it on-premises, Server-Version.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
6.15.9
TAGS
Community showcase
Posted in Confluence

Lessons and Learnings: Six Months of Working Remote [Discussion]

Hey there, folks! For most of us, the past six months- yes, you read that right- have been a journey. More people than ever before have pivoted to working remotely, and navigating being on-scre...

4,120 views 4 6
Join discussion

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