[tw] Re: [TW5] poor man's tag cloud

2016-04-22 Thread Sylvain Naudin
Hello Uwe,

Sorry to publish on this old post, did you have found a solution to have a 
cloud tag with bigger pills ? Just try Stephan code but don't work for me.


Cheers
Sylvain

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/b27b72f6-fca1-46ac-9024-9e8c3e072b8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: [TW5] poor man's tag cloud

2014-04-03 Thread UBi
Hallo Stephan,

I'm a bit late, but: thanks! It works! At least with counts up to 9 :-)

The missing parts for a real tag cloud implementation are AFAICS:
1) get min and max count over all tags (minCnt, maxCnt)
2) fit each count (cnt) into a corresponding font size range (minFontsize, 
maxFontsize):
fontSize = minFontsize + (cnt – minCount) * (maxFontsize – minFontsize) / 
(maxCount - minCount)

So much for the theory. Implementation is left as an exercise for the 
reader :-)

Uwe

Am Dienstag, 1. April 2014 16:20:45 UTC+2 schrieb Stephan Hradek:

 I just created a count filter which WOULD help with this, but your idea 
 is not well thought through. Imagine I have a 3 counts: 1, 10 and 100. The 
 resulting sizes would be: 1.1em, 1.10em and 1.100em. Would you be 
 able to tell the difference? ;)

 For completeness sake, this is the source of my count filter:

 /*\
 title: $:/core/modules/filters/count.js
 type: application/javascript
 module-type: filteroperator

 Filter operator that gives the counts the current list's members

 \*/
 (function(){

 /*jslint node: true, browser: true */
 /*global $tw: false */
 use strict;

 /*
 Export our filter function
 */
 exports.count = function(source,operator,options) {
 // count the source if it's not an array
 var count = 0;
 if(!$tw.utils.isArray(source)) {
 $tw.utils.each(source,function(element,title) {
 ++count;
 });
 return [  + count ];
 }
 // return array's length
 return [  + source.length ];
 };

 })();



 used like this (using your request)

 \define mySize()
 font-size:$(cnt)$em
 \end

 $list filter=[tags[]!is[system]sort[title]]
   $set name=title value={{!!title}}
 $list filter=[is[current]tagging[]count[]]
   $set name=cnt value={{!!title}}
 span style=mySize
   $tiddler tiddler=title
 $transclude tiddler=$:/core/ui/TagTemplate/
   /$tiddler
 /span
   /$set
 /$list
   /$set
 /$list



 I'm not sure yet, whether to make it a plugin. Comments welcome.




-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: [TW5] poor man's tag cloud

2014-04-01 Thread Stephan Hradek
I don't think it's possible yet.

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: [TW5] poor man's tag cloud

2014-04-01 Thread Stephan Hradek
I just created a count filter which WOULD help with this, but your idea 
is not well thought through. Imagine I have a 3 counts: 1, 10 and 100. The 
resulting sizes would be: 1.1em, 1.10em and 1.100em. Would you be 
able to tell the difference? ;)

For completeness sake, this is the source of my count filter:

/*\
title: $:/core/modules/filters/count.js
type: application/javascript
module-type: filteroperator

Filter operator that gives the counts the current list's members

\*/
(function(){

/*jslint node: true, browser: true */
/*global $tw: false */
use strict;

/*
Export our filter function
*/
exports.count = function(source,operator,options) {
// count the source if it's not an array
var count = 0;
if(!$tw.utils.isArray(source)) {
$tw.utils.each(source,function(element,title) {
++count;
});
return [  + count ];
}
// return array's length
return [  + source.length ];
};

})();



used like this (using your request)

\define mySize()
font-size:$(cnt)$em
\end

$list filter=[tags[]!is[system]sort[title]]
  $set name=title value={{!!title}}
$list filter=[is[current]tagging[]count[]]
  $set name=cnt value={{!!title}}
span style=mySize
  $tiddler tiddler=title
$transclude tiddler=$:/core/ui/TagTemplate/
  /$tiddler
/span
  /$set
/$list
  /$set
/$list



I'm not sure yet, whether to make it a plugin. Comments welcome.


-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.