How can I show statistics on labels used in Confluence?

We are looking at storing system information in Confluence, and the idea is to use labels as a way to "classify" the systems in various ways. Now, we would also like to be able to have some kind of dashboard where we could show statistics on the various labels. Pie/bar charts etc.

Is that something that can be done...? The 'Chart' macro is simply manual, and 'Popular Labels' can only show a tag cloud or list, no graphs. Haven't been able to find anything in the googleverse or Marketplace so far, so any tips, tricks and suggestions are welcome...

1 answer

1 vote
Stephen Deutsch Community Champion Nov 14, 2016

If you want to create a graph based on the number of content that has a certain label, then the best way to go would be to use the included chart macro and use this user macro to generate the label count:

## @param Label:title=Label|type=string|required=true|desc=Please enter a label to count
#set ( $containerManagerClass=$content.class.forName('com.atlassian.spring.container.ContainerManager') )
#set ( $getInstanceMethod=$containerManagerClass.getDeclaredMethod('getInstance',null) )
#set ( $containerManager=$getInstanceMethod.invoke(null,null) )
#set ( $containerContext=$containerManager.containerContext )
#set ( $labelManager = $containerContext.getComponent('labelManager') )
#set ( $requestedLabel = $labelManager.getLabel($paramLabel) )
#if ( $requestedLabel )

Then just put this macro in the table cell of the chart macro where you would normally put a number.

Thanks! I'll take this for a spin and see what I can get done.

Is it possible to limit the number of labels to one space?

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

370 views 20 10
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you