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

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 vote


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.

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.

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.

Oh, I see. I haven’t used that before, but it’s the field in , 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.

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 :-)

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
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

164 views 1 17
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