IDEA: allow icon colum to have text overlay & ideas on size-bar scaling

Features wanted...
autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

IDEA: allow icon colum to have text overlay & ideas on size-bar scaling

Post by autocart »

see title
this way, e.g. a draw.bar could have some text (probably at the right side) to indicate what the bar is showing. e.g. with relative file sizes it may not be intuitively clear (or easy to remember) which colors refer to which units (KB, MB, GB, ...).
Last edited by autocart on 29 Mar 2017 22:12, edited 2 times in total.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: IDEA: allow icon colum to have text overlay

Post by SkyFrontier »

...or icons which apparently have a clear meaning but in the long run will be forgotten, or for the accidental case of removing the source remote .ico files.
+1
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: IDEA: allow icon colum to have text overlay

Post by autocart »

ofc, one could always make a 2nd text custom column with the same logic but only a text as return value and put it right next to the icon column.

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: IDEA: allow icon colum to have text overlay

Post by admin »

Maybe in phase 2...

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: IDEA: allow icon colum to have text overlay

Post by TheQwerty »

Perhaps a means to provide a meaningful tooltip could make its way into phase 1?

Maybe in the form of one of these:

Code: Select all

>"Tooltip" draw.stuff
>draw.stuff ... "Tooltip"

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: IDEA: allow icon colum to have text overlay

Post by admin »

Yes, I already saw that coming. But it needs a little thinking (performance, memory, worth the price... this kind of stuff). Rather phase 2.

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: IDEA: allow icon colum to have text overlay

Post by autocart »

thinking of my 2nd comment here and the new easiness of adding the bars directly into the size column, I personally think it is good enough for now.
Ofc, I don't want to say that it would not add further to XY but "maybe in phase 2" seems good now. Thx for thinking about it.

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: IDEA: allow icon colum to have text overlay

Post by autocart »

Hi Don,
It would not be me, if I would not - despite my previous comment right above - have realized another thing after all, which could use improvement (related to the size bar - especially the hard coded one):
right now the steps being differentiated from each other (in color) are:
<1 KB
<1 MB
<1 GB
>=1 GB (obviously hardcoded to show a relative bar for <1 TB and a full bar for all >= 1 TB ?)

The point is, in general these are factors of 1024 (from one step to the next) but the relative sizes projected onto a scale of 100 (percent). In a LOT of cases (especially small files) In quite a few cases (let's say e.g. all files between 1 and 20 MB) one will not be able to "see" the differences of their size when comparing the bars because the scale is not perfect.
I am not sure if there is a good solution or if others also think this should/could be improved. Maybe see if/what other users feed back to you on this topic?

Regards, S.
Last edited by autocart on 28 Mar 2017 01:19, edited 2 times in total.

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: IDEA: allow icon colum to have text overlay

Post by admin »

It's not easy to graphically map a scale from 0 to 1 TB onto a couple of pixels in an easy to read and attractive way. I'm quite satisfied with my two solutions to this problem. But if you have a better idea...

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: IDEA: allow icon colum to have text overlay

Post by autocart »

I truthfully think you did a quite good job with all of this so far.
And you are right. It is easier to see the challenge (for me) than to see the perfect solution (which I hoped for from you :biggrin: ).

One idea (probably nonsense or at least not good enough, but maybe it inspires someone else to something useful) that just came to my mind when I read your words "two solutions":
There are bars and circles (so far). Why not combine these two somehow in order to fine tune the scale? E.g. put marks on the bar as on a ruler (lets say at every step of 10 or 20 %). Next to such a bar (on its right side?) put a circle which will indicate how much of that step of 10 or 20 % is filled.

Then, e.g., the bars of a file A with 10 KB and a file B with 40 KB will almost look the same (very yellow) but the circle of file B next to the bars will be about 4 times the size of file A (with a full size circle indicating a step of ~100 or ~200 KB in this case).
Last edited by autocart on 27 Mar 2017 22:32, edited 1 time in total.

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: IDEA: allow icon colum to have text overlay

Post by autocart »

Still, maybe it is not needed at all.
It was only a thought. I like the bars, but so far have no real use for them besides that they give me a good feeling.
So, the users who really use the file size bars in their day to day work probably need to speak up.

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: IDEA: allow icon colum to have text overlay

Post by autocart »

Ok, one more idea for an alternative representation of the file size in the size bar:
-> kind of based on the arc tangent function/graph
(https://en.wikipedia.org/wiki/Inverse_t ... _functions)

The smaller file sizes are emphasized more within each section of file sizes. In this expamle, ~5 % file size of one factor-1000-section uses up ~1/2 of the bar, 10% is at ~75% of the bar. Admittedly, files that are of about ~50% size of the current factor-1000-section are at 97% of the bar. Bigger files share the last 3% of the bar (until the next file size section). It's not perfect (yet?), probably the small file sizes are emphasized too much the way it is now. Maybe the arcsec function/graph would be suited better (instead of the arc tangent) since it seems to start steeper (according to the graph on wikipedia). not sure. anyway, this is more a proof of concept. maybe it gives someone some ideas to come up with something better...

here is the CC snippet, in case someone wants to try it (did not test a lot, so who knows if it works under all conditions):
regards, S.

Code: Select all

Snip: CustomColumn 1
  XYplorer 17.80.0008, 28.03.2017 21:59:10
Action
  ConfigureColumn
Caption
  size_as_arct
Type
  3
Definition
  $size = "<cc_size>";
   switch (true) {
         case $size == 0:            return ''; // draw nothing
         case $size < 1024:          return '>draw.bar ' . ((_atn(25 * $size / 1024) * 100) / 1.5309833) \ 1 . ', 66CC66, BBEEBB';        //smaller 1 KB
         case $size < 1048576:       return '>draw.bar ' . ((_atn(25 * $size / 1048576) * 100) / 1.5309833) \ 1 . ', FFBB00, FFEE88';     //smaller 1 MB
         case $size < 1073741824:    return '>draw.bar ' . ((_atn(25 * $size / 1073741824) * 100) / 1.5309833) \ 1 . ', DD4444, FFAAAA';  //smaller 1 GB
         case $size < 1099511627776: return '>draw.bar ' . ((_atn(25 * $size / 1099511627776) * 100) / 1.5309833) \ 1 . ', DD44AA, FFAADD';  //smaller 1 TB
         default:                    return '>draw.bar ' . 100 . ', B40404, B40404'; //equal or bigger 1 TB
   }
   
   function _atn($x) {
     if ($x >= 1) {
       return 2 * _atn($x / (1 + (1 + $x ^ 2) ^ 0.5));
     }
     else {
       $atn = 0;
       $i = 50;
       while ($i >= 0) {
         $atn = $atn + ((-1 ^ $i) * (($x ^ (2 * $i + 1)) / (2 * $i + 1)));
         $i--;
       }
       return $atn;
     }
   }
Format
  7
Trigger
  0
Item Type
  0
Item Filter
  
EDIT:
BTW, I probably should mention, that the CC snippet is rather slow since I had to write the arc tangent function myself with the on board options.
and the arc tangent function is not 100% accurate to the last digit but regarding both points: as I said, its rather a kind of brainstorming proof of concept.

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: IDEA: allow icon colum to have text overlay

Post by admin »

autocart wrote:Ok, one more idea for an alternative representation of the file size in the size bar:
-> kind of based on the arc tangent function/graph
(https://en.wikipedia.org/wiki/Inverse_t ... _functions)

The smaller file sizes are emphasized more within each section of file sizes. In this expamle, ~5 % file size of one factor-1000-section uses up ~1/2 of the bar, 10% is at ~75% of the bar. Admittedly, files that are of about ~50% size of the current factor-1000-section are at 97% of the bar. Bigger files share the last 3% of the bar (until the next file size section). It's not perfect (yet?), probably the small file sizes are emphasized too much the way it is now. Maybe the arcsec function/graph would be suited better (instead of the arc tangent) since it seems to start steeper (according to the graph on wikipedia). not sure. anyway, this is more a proof of concept. maybe it gives someone some ideas to come up with something better...

here is the CC snippet, in case someone wants to try it (did not test a lot, so who knows if it works under all conditions):
regards, S.

Code: Select all

Snip: CustomColumn 1
  XYplorer 17.80.0008, 28.03.2017 21:59:10
Action
  ConfigureColumn
Caption
  size_as_arct
Type
  3
Definition
  $size = "<cc_size>";
   switch (true) {
         case $size == 0:            return ''; // draw nothing
         case $size < 1024:          return '>draw.bar ' . ((_atn(25 * $size / 1024) * 100) / 1.5309833) \ 1 . ', 66CC66, BBEEBB';        //smaller 1 KB
         case $size < 1048576:       return '>draw.bar ' . ((_atn(25 * $size / 1048576) * 100) / 1.5309833) \ 1 . ', FFBB00, FFEE88';     //smaller 1 MB
         case $size < 1073741824:    return '>draw.bar ' . ((_atn(25 * $size / 1073741824) * 100) / 1.5309833) \ 1 . ', DD4444, FFAAAA';  //smaller 1 GB
         case $size < 1099511627776: return '>draw.bar ' . ((_atn(25 * $size / 1099511627776) * 100) / 1.5309833) \ 1 . ', DD44AA, FFAADD';  //smaller 1 TB
         default:                    return '>draw.bar ' . 100 . ', B40404, B40404'; //equal or bigger 1 TB
   }
   
   function _atn($x) {
     if ($x >= 1) {
       return 2 * _atn($x / (1 + (1 + $x ^ 2) ^ 0.5));
     }
     else {
       $atn = 0;
       $i = 50;
       while ($i >= 0) {
         $atn = $atn + ((-1 ^ $i) * (($x ^ (2 * $i + 1)) / (2 * $i + 1)));
         $i--;
       }
       return $atn;
     }
   }
Format
  7
Trigger
  0
Item Type
  0
Item Filter
  
EDIT:
BTW, I probably should mention, that the CC snippet is rather slow since I had to write the arc tangent function myself with the on board options.
and the arc tangent function is not 100% accurate to the last digit but regarding both points: as I said, its rather a kind of brainstorming proof of concept.
Terribly slow indeed. :biggrin: Cool effort but I'm not really convinced by the result. IMO visual representation does not work that way, not for me at least. I think it has to be linear.

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: IDEA: allow icon colum to have text overlay

Post by autocart »

admin wrote:but I'm not really convinced by the result. IMO visual representation does not work that way, not for me at least. I think it has to be linear.
I totally understand, Don, and partly agree. Thx for the feedback.
Still, since it was so much fun (I am starting to understand your fun phases now, Don), I also finished the version based on the "arcus secant" function/graph.
Well, it still is slow, but now the results are almost as I imagine it. At least much better than with arcus tangent. As long as one can interpert them. :mrgreen:
The bar really would need some ruler-markers.
Anyhow, for anyone interested (for whatever reason), here is the snippet updated not only to arcsec but also to include files and folders:
Regards, S.

Code: Select all

Snip: CustomColumn 1
  XYplorer 17.80.0009, 29.03.2017 21:54:09
Action
  ConfigureColumn
Caption
  size_as_arcsecant
Type
  3
Definition
  global $PI = 3.1415926535897932384626433832795; // 0288 41971 69399 37510 58209 74944 59230 78164 06286 20899 86280 34825 34211 70679 …
   
   $size = "<cc_size>";
   if ($size == -1) {return "";}
   switch (true) {
         case $size == 0:            return ''; // draw nothing
         case $size < 1024:          return '>draw.bar ' . ((_asecant(1 + 10 * $size / 1024) * 100) / 1.4797615487575) \ 1 . ', 66CC66, BBEEBB';        //smaller 1 KB
         case $size < 1048576:       return '>draw.bar ' . ((_asecant(1 + 10 * $size / 1048576) * 100) / 1.4797615487575) \ 1 . ', FFBB00, FFEE88';     //smaller 1 MB
         case $size < 1073741824:    return '>draw.bar ' . ((_asecant(1 + 10 * $size / 1073741824) * 100) / 1.4797615487575) \ 1 . ', DD4444, FFAAAA';  //smaller 1 GB
         case $size < 1099511627776: return '>draw.bar ' . ((_asecant(1 + 10 * $size / 1099511627776) * 100) / 1.4797615487575) \ 1 . ', DD44AA, FFAADD';  //smaller 1 TB
         default:                    return '>draw.bar ' . 100 . ', B40404, B40404'; //equal or bigger 1 TB
   }
   
   function _asecant($x) {
     if ($x == 1) {return 0;}
     if ($x < 1) {return "";}
     global $PI;
     $asec = $PI / 2;
     $i = 21;
     while ($i >= 0) {
       $asec = $asec - (_dblFact(2 * $i - 1) * $x ^ (-1 * (2 * $i + 1))) / (_dblFact(2 * $i) * (2 * $i + 1));
       $i--;
     }
     return $asec;
   } 
   
   function _dblFact($n) {
     if ($n == 0 OR $n == -1) {return 1;}
     if ($n * 1 == 0 OR $n < 0) {return 0;}
     $result = 1;
     while ($n > 1) {
       $result = $result * $n;
       $n = $n - 2;
     }
     return $result;
   }
Format
  7
Trigger
  0
Item Type
  2
Item Filter
  
EDIT: Besides being slow like the other one, this script has a "big" inaccuracy at very low input numbers (very small relative file sizes) which leads to an offset at the left side of the bar of about 10% of the bar's size. The inaccuracy is due to the method used to calculate arcsec in combination with the scripting limitations of XY (overflow if trying to make it more accurate). If I find a differnt algorithm, I might (or might not) update this in the future. Probably not, since it is only meant as an example of the idea, but we'll see. Thx for reading. Bye, bye.
Last edited by autocart on 29 Mar 2017 23:27, edited 1 time in total.

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: IDEA: allow icon colum to have text overlay

Post by autocart »

BTW, another approach would be to scale the bars linear but relative to the size of the biggest file in the list. maybe...

Post Reply