Modify

Opened 15 years ago

Last modified 9 years ago

#6395 new enhancement

Option to display tag cloud in descending order

Reported by: Adriana Owned by:
Priority: normal Component: TagsPlugin
Severity: normal Keywords: list sorted
Cc: Trac Release: 0.11

Description

How can I modify tractags.macros to display tag cloud in descending order, starting with the most used tags? I don't understantand what is the current sort order.

Attachments (1)

TagCloud.png (86.9 KB) - added by Ryan J Ollos 15 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 15 years ago by Ryan J Ollos

Summary: display tag cloud in descending orderOption to display tag cloud in descending order

It is strange, because on my Trac (running TagsPlugin 0.6) they are mostly displayed alphabetically, with the exception of the entries at the end,

Last edited 11 years ago by Ryan J Ollos (previous) (diff)

Changed 15 years ago by Ryan J Ollos

Attachment: TagCloud.png added

comment:2 Changed 15 years ago by Adriana

I don't mean alphabetical order. I would like to see the most used tags at the beginning of the cloud (tags ordered by their occurrence).

comment:3 in reply to:  description Changed 15 years ago by Ryan J Ollos

You had asked:

Replying to lizadri:

I don't understantand what is the current sort order.

I was just trying to determine what is the current sort order. Given that, maybe we can add an option to the macro ... however, the current sort order doesn't make much sense to me.

comment:4 Changed 15 years ago by Adriana

I need tags ordered by their occurrence because I'm working to create a plugin that suggests tags. :-) The first step of implementation should be suggest the most used tags (eg. top ten).

comment:5 Changed 12 years ago by Steffen Hoffmann

Keywords: list sorted added

I see your point.

There is an internal object, that could be used for sorting on number of occurrences. However, please understand, that right now performance (#4503) is a much higher priority than new features, so this is still getting postponed.

comment:6 Changed 11 years ago by Steffen Hoffmann

Implementation of this feature request will be easier now with new Counter objects, still it should be considered for next release's development.

comment:7 in reply to:  4 Changed 11 years ago by Steffen Hoffmann

Owner: changed from Alec Thomas to Steffen Hoffmann
Status: newassigned

Replying to lizadri:

I need tags ordered by their occurrence because I'm working to create a plugin that suggests tags. :-) The first step of implementation should be suggest the most used tags (eg. top ten).

Since [13427] we have tractags.api.TagSystem.get_all_tags(), so it is part of current stable tractags-0.7 as well.

This method returns a Counter object. Use its .most_common(n) method to extract the <n> top-most tags as a list of tuples with their number of occurrence in descending order. This will likely give you all you need for your plugin application.

I'm undecided how to proceed here. The request regarding API usage for other Trac plugins is clearly resolved IMHO.

Do we need more options regarding the sorting order? For the macro and web-UI. Maybe, but if any, I suggest extending cloud_caseless_sort into something more general, like a cloud_sort list option, and make desc another list entry next to caseless. Thoughts?

comment:8 Changed 9 years ago by Ryan J Ollos

Owner: Steffen Hoffmann deleted
Status: assignednew

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.