Chart macro - can it use JiraIssues macro results as source data somehow?

Jim Yanko October 5, 2011

I'd like to use the chart macro to display some statistics regarding issues in Jira, but I can't figure out how I can get chart to access the resulting tickets of a Jira query.

I have been successful in getting chart to read data from an external page that contains a table as follows.

{chart:id=one|type=gantt|dataOrientation=vertical|columns=,1,2,3,4|displayData=after|width=800|dateFormat=yyyy-MM-dd|rangeAxisRotateTickLabel=true}
{include:Practice Sample CSV Data}
{chart}

However, the only way I am aware of to pull Jira issues is to use the jiraissues macro, which does not appear to provide any output formatting options.

{jiraissues:
   project=DS 
   AND component=QA_Tools
   AND status=Open
   }

The above jiraissues code sample will display the results in a dynamic window, though I don't see any way I can format the output into something the chart macro would understand.

Is there a way to get the output of a Jira query to be used as the source data for a chart?

5 answers

0 votes
Andrey Khaneev _StiltSoft_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 17, 2017

You can use Chart from Table macro from Table Filter and Charts add-on to build charts based on Jira Issue macro.

Michał Zięba November 26, 2018

No you cannpt - three a bugs since 2016 and Atlassian doesn`t care about this

Andrey Khaneev _StiltSoft_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 26, 2018

Chart macro doesn't work, but Chart from Table macro does. 

0 votes
Doug Swartz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 27, 2013

This is an old thread, but, as I wanted to do the same thing now in 2013, I'll post my answer in hopes it will help someone else. the only way I've found, short of writing a Jira Gadget to display what you want and importing it into Confluence, uses Bob Swift's XSLT macro. What I did:

Embed the XSLT macro inside a Chart macro. In the XSLT macro, point the source to the URL for the XML view of your Jira Filter or JQL query. I use an XSL file saved as an attachment in Confluence. Have the XSL output wiki format data. Here is a sample XSL file to create a table to display a summary of the statusses of the issues output from a filter:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />
<xsl:strip-space elements="*"/>

<xsl:template match="channel" >
    <!-- Write the headings  -->
    <xsl:text>||status||count||</xsl:text>
    <xsl:text>
</xsl:text>
    <xsl:apply-templates select="item">
        <xsl:sort select="status"/>
    </xsl:apply-templates>
</xsl:template>

<xsl:template match="item" >
    <xsl:if test="not(preceding-sibling::item/status = current()/status)">
        <xsl:text>|</xsl:text>
        <xsl:value-of select="status" />
        <xsl:text>|</xsl:text>
        <xsl:value-of select="count(/*//item[status = current()/status])" />
        <xsl:text>|
</xsl:text>
    </xsl:if>
</xsl:template>
</xsl:stylesheet>

Here's the output from the XSLT for a sample filter:

||status||count||
|Failed|1|
|In Progress|1|
|Not Started|4|
|Passed|1|

Unfortunately, the XSLT macro doesn't use Conflunce-Jira authenticated application links, so this only works with Jira views/queries that are accessible anonymously.

The XSLT macro is part of the HTML Plugin for Confluence

0 votes
Jim Yanko March 1, 2012

Still not resolved, but here's what I've tried so far...

Using the following syntax

{chart:id=one|type=line|dataDisplay=true|yLabel=Stuff|xLabel=Things|dataOrientation=horizontal|columns=1,2}
   {jiraissues: 
   project=PROJECT
   AND fixversion="things-RB-1.0.0" 
   | renderMode=static 
   | columns=status;component;summary 
   }
{chart}

The {jiraisues} macro results in a table with 2 header rows.

| JIRA Issues (45 issues)                     | 
| Status   | Component | Summary              | 
| Fixed    | app1      | fix thing 1          | 
| Fixed    | app1      | fix thing 2          |
| Verified | app2      | fix the whosiwhatsit |
| Resolved | app2      | fix the doohickey    |

The chart drawn based on this table shows

* "Stuff" as the vertical label

* "Things" as the horizontal label

* no data points

* a legend which shows a diff color for each of the following

* Status

* Fixed

* Verified

* Resolved

I would expect to see "Fixed", "Verified" and "Resolved" - but "Status" is actually a column heading in the table drawn out by the {jiraissues} macro.

It seems as if this might be a step closer to workable if there is some way to disable the top row of the table output by {jiraissues}

0 votes
Jim Yanko March 1, 2012

I still have not figured out a way to accomplish this.

0 votes
Deleted user October 5, 2011

try using "renderMode=static" in the jiraissues macro. It is to turn the Jira Issues table to render in a non-dynamic mode. I could get the components listed, in a bar chart using this inside a chart macro. It didn't display the data but i think i was not using the right query for this kind of chart.

Since I could see my components listed on the chart, I'm hopeful it can work.

Jim Yanko October 6, 2011

This doesn't quite seem to work for me.

I tried the following wiki code...

{chart:id=one|type=bar|dataDisplay=true|columns=1,2}

{jiraissues:
   project=PROJNAME 
   AND component=APPNAME
   AND fixversion="APPNAME-RB-2.0.0"
   | renderMode=static
   | columns=status;component;summary
   }
{chart}

...and what I end up seeing when it is rendered is something that looks a little like this...

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv


0.000 -------------------------

 
      -------------------------
       JIRA Issues (12 issues)
      [] status [] verified [] fixed

 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The "graph" part seems to be grabbing the header of the first column of data and then the values from the following rows in that column.

The rendered Jira issues (shown after the graph) looks something like this...

-----------------------------------
JIRA Issues (12 issues)
-----------------------------------
Status   | Component | Summary
-----------------------------------
Verified | APPNAME   | summary text 1
Fixed    | APPNAME   | summary text 2
Open     | APPNAME   | summary text 3

If there's a way to capture the Jira filter results into a normal table or .csv output, it looks like that would work much better...albeit, I haven't yet found a away to get info from the jiraissue macro in such a format yet - it seems kind of restrictive

Gregory Sudderth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 25, 2012

You would think that Atlassian THEMSELVES would use this like mad! Dang it! I wish we had this. G.

Suggest an answer

Log in or Sign up to answer