-
Hi, I use freeplance for more years in order to follow project : software test few years ago, developpment project now, and some professionnal work project of course). I tag each node with an icon. Can I calculate statistic (number on icon type / number of total node * 100 for example) in order to report on my chief the state progress of my project ? (Yes, I know, yes I know, the idea is crazy to calculate images... but very useful) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
You can use scripts to get it. Just one example:
Replace "ICON PATH" with the path of icon you want to calcuate. |
Beta Was this translation helpful? Give feedback.
-
@abc16361 a good idea. Let me take it a step further 😀 @slhuilli1 I believe it's a great idea to use icons for marking nodes for whatever purpose. And the need to count such icons isn't crazy at all 😄 The below script creates a metrics table in the details of the root node. def root = node.mindMap.root
def iconToCount = [:]
def totalCount = 0
root.findAll().each { node ->
totalCount++
node.delegate.icons.each { icon ->
def descr = icon.translatedDescription
if (!iconToCount[descr])
iconToCount[descr] = 0
iconToCount[descr]++
}
}
// prepare the report - a table of rows
def iconMetricsTable = []
iconToCount.each { entry ->
iconMetricsTable << [entry.key, entry.value, entry.value / totalCount * 100]
}
// ORDER BY % DESC, Count DESC, Icon
iconMetricsTable.sort { a,b -> b[2] <=> a[2] ?: b[1] <=> a[1] ?: a[0].toLowerCase() <=> b[0].toLowerCase() }
// make a report in the form of a markdown table
def sb = new StringBuilder()
sb << '| Icon | Count | % |\n'
sb << '|---|---:|---:|\n'
iconMetricsTable.each { row ->
sb << '| ' << row[0] << ' | ' << row[1] << ' | ' << String.format('%.1f', row[2]) << '% |\n'
}
// write to details
root.detailsContentType = 'markdown'
root.details = sb.toString() |
Beta Was this translation helpful? Give feedback.
-
I have tested, it's exactly that I wanted. |
Beta Was this translation helpful? Give feedback.
@abc16361 a good idea. Let me take it a step further 😀
@slhuilli1 I believe it's a great idea to use icons for marking nodes for whatever purpose. And the need to count such icons isn't crazy at all 😄
The below script creates a metrics table in the details of the root node.
You could save it and run it on the root node
Tools->Edit script...
, or you could save it to a file, e.g.iconStatistics.groovy
, and execute the scriptTools->Scripts->Icon Statistics
Please see also Scripting and feel free to ask for more guidance, if needed.