How to develop a JIRA plugin that displays charts?

I am new to JIRA World, my mission is to develop a JIRA plugin that displays graphs (pies, histograms, etc.). The user selects the search criteria and type of diagrams, and the user should be able to save these diagrams (Word / PDF).

I do not know if I should develop a report plugin and use JFreeChart to create diagrams or develop a plugin for diagramming (I have not seen any example of a diagramming plugin). I did some research on the report plugin, and I did not find an example showing how to use JFreechart !! also, I did not find a single example to show how to use jasperReport (or another tool) to generate a word report or PDF.

The user must access the plugin from a tab, such as an interface (administration, home, etc.).

Example KPI (key performance indicator) for display:

  • The average time taken to resolve the problem.
  • The number of problems that still open.

PS: I am using JIRA 4.3.3

+4
source share
6 answers

There is a JIRA plugin for exporting charts in Word, which covers part of what you wanted to do. https://marketplace.atlassian.com/plugins/com.clariostechnology.officecharts.officecharts

Also see "Intelligent Reporter", which provides more options for formatting charts and allows you to use Word files as templates and fill in charts and other data.

https://marketplace.atlassian.com/plugins/com.clariostechnology.intelligentreports

+2
source

Try reading the article Creating a pie chart in JIRA from the big book " JIRA 5.x Development Cookbook " by Jobin Kuruvilla.

The most important thing is to fill in your data set, which will be used to create the desired chart. Consider an example from this book that shows the java side of this plugin:

public Chart generateChart(JiraAuthenticationContext authenticationContext, int width, int height) { try { final Map<String, Object> params = new HashMap<String, Object>(); // Create Dataset DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("One", 10L); dataset.setValue("Two", 15L); final ChartHelper helper = new PieChartGenerator(dataset, authenticationContext.getI18nHelper()).generateChart(); helper.generate(width, height); params.put("chart", helper.getLocation()); params.put("chartDataset", dataset); params.put("imagemap", helper.getImageMap()); params.put("imagemapName", helper.getImageMapName()); params.put("width", width); params.put("height", height); return new Chart(helper.getLocation(), helper.getImageMap(), helper.getImageMapName(), params); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Error generating chart", e); } } 

and a speed template for this purpose:

 #if ($chart) #if ($imagemap) $imagemap #end <p class="report-chart"> <img src='$baseurl/charts?filename=$chart' border='0' #if ($imagemap) usemap="\#$imagemapName" #end/> </p> #end 

This is it in the most basic example. But also take a look at ChartFactory and ChartUtils to get a deeper idea about creating different types of charts.

+2
source

You do not need to write a plugin for this - these are JIRA's own capabilities. If you are trying to write a plugin, I would use JFreeChart. See JIRA Charting Plugin and JQL Filters for two listed KPIs.

+1
source

in speed:

  #set($cht = $chart) #if ($cht) #if ($cht.imageMap) $cht.imageMap #end <p class="report-chart"> <img src='$baseurl/charts?filename=$chart.location' border='0' #if ($cht.imageMap) usemap="\#$cht.imageMapName" #end/> </p> #end 

webwork:

 @SuppressWarnings("unused") public Chart getChart() { JiraAuthenticationContext authenticationContext = ComponentAccessor.getJiraAuthenticationContext(); final int CHART_WIDTH = 300; final int CHART_HEIGHT = 300; try { final Map<String, Object> params = new HashMap<String, Object>(); // Create Dataset DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("One", 10L); dataset.setValue("Two", 15L); final I18nBean i18nBean = new I18nBean(authenticationContext.getUser().getDirectoryUser()); final ChartHelper helper = new PieChartGenerator(dataset, i18nBean).generateChart(); helper.generate(CHART_WIDTH, CHART_HEIGHT); params.put("chart", helper.getLocation()); params.put("chartDataset", dataset); params.put("imagemap", helper.getImageMap()); params.put("imagemapName", helper.getImageMapName()); params.put("width", CHART_WIDTH); params.put("height", CHART_HEIGHT); Chart ch = new Chart(helper.getLocation(), helper.getImageMapHtml(), helper.getImageMapName(), params); return ch; } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Error generating chart", e); } } 

result:

enter image description here

+1
source

The best alternative to saving time from programming plug-ins, but at the same time gives you incredible opportunities and flexibility, generates graphs in Excel through the export of JIRA data using the Improved Excel Plugin .

How it works?

  • You create an XLSX template file with a special placeholder, tags for the actual data.
  • Define the so-called name ranges and generate (empty) diagrams from them, using all the functions of charting in Excel. (Since MS Excel is still the most versatile and most widely used data visualization tool, it is almost guaranteed that your use case will be supported and you will find a lot of Google help on the Internet.)
  • When exporting this template, the add-in will populate the named range with the data of your problems, and the chart will wake up!

The end result may look like this (in your own sheet):

enter image description here

0
source

See this tutorial on drawing various types of diagrams for visualizing JIRA data : http://www.midori.hu/products/jira-pdf-view-plugin/documentation/charts

The technique described here is based on capturing your custom KPI calculation logic in Groovy compressed scripts, rendering charts with the de facto standard JFreeChart, all of which are supported by our JIRA PDF View Plugin.

enter image description here

(Discl: the mentioned plugin contains our commercial software.)

-1
source

All Articles