Two Dimensional Filter : how to add additional fields in drop down

Rose Rose May 17, 2012

I am using the Two Dimensional Filter Statistics portlet but it doesn't have all the fields I want to use for the XAxis and YAxis. The field that I want is the Security Level field which I use in all my filters but its not available in the pull down. I have full admin permissions, is there a way for me to add this field to the drop down of one of the axis?

2 answers

0 votes
CEDRIC ZABEL
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.
May 19, 2012

I had to do something like this recently. In the process, I ended up learning far more than I ever wanted to know about the Two Dimensional Filter Statistics gadget, but in the end, it didn’t turn out to be that hard. The hard part was getting to the point where things started to make sense.

A caveat: I did this work with the gadget, not portlet. As I understand it, portlets were used before Jira 4.0, and gadgets are used in Jira 4.0 and after. What version of Jira are you using? I only came into Jira with Jira 4.4. If you’re using a version before Jira 4.0, what I say may not apply.

The Two Dimensional Filter Statistics gadget will use a field if and only if that field’s searcher is of a certain type. Take a look at your Security Level field. What sort of custom field is it? If it’s a select list or a multi-select list, or a version, group, or user picker, and you have configured the field to use the appropriate searcher, then the Two Dimensional Filter Statistics gadget should pick up the field automatically.

Since you say you have filters that use this field, it sounds like you do have a searcher defined. Therefore, I’ll assume it’s some other type of custom field. If it is one of the fields that’s supported by the Two Dimensional Filter Statistics gadget out of the box, then you have some other problem, and without further information all I can suggest is restarting and/or reindexing Jira since that works sometimes.

OK, so you have some other custom field with some other searcher. How can you get the Two Dimensional Filter Statistics gadget to use it? Remember I said that the searcher had to be of a certain type. To be technical about it, the searcher has to be “stattable.” That is, the Java class that implements the searcher has to also implement the CustomFieldStattable interface. The CustomFieldStattable interface requires that the Java class that implements the searcher be associated with another Java class that implements the StatisticsMapper interface.

The only “stattable” custom field types included with Jira are the select list, multi-select list, and the version, group, and user pickers, but if you define your own custom field types through a plugin, you can also define your own searchers and make sure those searchers are “stattable.”

In my case, I had a derived custom field that I wanted to use in the Two Dimensional Filter Statistics gadget. I originally had it just using the “Exact Text” searcher, but once I figured out what to do, I created a new searcher than just extended the “Exact Text” searcher and was “stattable.” There actually isn’t that much code involved in making a searcher “stattable.” It’s mainly a matter of defining the JQL queries the gadget has to use.

In your case, it’s going to depend on what type of field your “Security Level” is. It may be that the “Security Level” could be made into a simple select list very easily, or it could be that you’ll have to extend the code in the plugin that implements it, or perhaps it’s something in between. Let us know how things are for you.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 19, 2012

I think the "security level" Roseha is referring to is the "security level" field in Jira that controls issue level security.

That's a built-in system field that does not have a searcher, hence my suggestions about creating a derived field or editing the gadget to recognise it as though it were a custom select list.

CEDRIC ZABEL
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.
May 20, 2012

Oh, I see. I haven’t used that before, but it’s the field in http://confluence.atlassian.com/display/JIRA/Setting+Security+on+an+Issue , right? That makes sense. In that case, you’re right — you would have to create a computed field derived from the security level or edit the gadget.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 20, 2012

Yup, that's the one.

I'm not sure Roseha is referring to that field of course, it may well be a custom field - I'm sure we'll be corrected if I've guessed wrong :-)

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 18, 2012

Code.

You either need to write fields that provide the data hooks that the gadget can read (i.e. they effectively need to be select lists), or you need to rewrite the gadget in a way that accepts that your field is a valid input. I think it's based on the searcher the fields implement - in your case, security doesn't have a searcher, so it won't appear.

I must admit, I've done both, albeit a while ago.

I once modified the code for the portlet (not gadget!) so that it saw multi-check-boxes as input. Looked odd because you could have a single issue reported more than once. (e.g. with options A, B and C, and a single issue with A and B selected, it appears twice in the portlet because it's counting A, B and C)

The other fix was a derived custom field - looked like a list type field with a searcher, and drew its data from other fields.

Suggest an answer

Log in or Sign up to answer