Hard Light Productions Forums

Off-Topic Discussion => General Discussion => Topic started by: Sandwich on December 19, 2011, 01:01:47 pm

Title: Sandwich's Rainmeter Skin (previously: "Math equation question")
Post by: Sandwich on December 19, 2011, 01:01:47 pm
I'm working on a Rainmeter skin with some meters for my drive usage levels (how full they are). Each drive has it's own meter, scaled proportionately. I have 3 drives: 250gb, 750gb, and 1500gb. Proportionately, I sized their meters at a 5:1 ratio, so the 250gb drive's meter was 50 pixels long, the 750gb was 150px, and the 1500gb was 300px - pretty reasonable sizing. Layered over each drive is a numeric value representing how many gb's of free space remain on each drive.

Recently, I got an SSD, and so now I need to toss a 40gb drive (partition, actually - irrelevant) into the mix. At the aforementioned ratio, it would be sized at 8px - large enough to glean approximately how much free space remains graphically, but not large enough to place the numeric value over the meter.

So what I'd like to do is to change the sizing of the meters from a direct 5:1 ratio to something more complex. I'm not sure which mathematical term I'm looking for - logarithmic, exponential, whatever - but basically I want every ten-fold increase in drive size to result in a doubling of the meter's width. If fed convenient values, it would result in something like this, the final values of which I can multiply to get the scale correct:

10 = 1
100 = 2
1,000 = 4
10,000 = 8

Can anyone point me in the right direction, preferably using the functions available here (http://rainmeter.net/cms/Measures-Calc_beta)?
Title: Re: Math equation question
Post by: Locutus of Borg on December 19, 2011, 02:11:15 pm
I believe you want

2^(log(x) - 1)

where the log has a base of ten

Title: Re: Math equation question
Post by: MP-Ryan on December 19, 2011, 02:19:14 pm
I believe you want

2^(log(x) - 1)

where the log has a base of ten

Which translates to (for example):

10 = 1 px
100 = 2 px
1000 = 4 px
10000 = 8 px

So it's probably a bad idea to use 10 GB as your base value going in, since your range will be quite restrictive on the graph.

EDIT:  Locutus, your math is correct.
log 10 = 1, log 100 = 2, log 1000 = 3, etc.
2^0 = 1, 2^1 = 2, 2^2 = 4, 2^3 = 8, etc.

Unless I missed something.
Title: Re: Math equation question
Post by: Locutus of Borg on December 19, 2011, 02:38:42 pm
I believe you want

2^(log(x) - 1)

where the log has a base of ten

Which translates to (for example):

10 = 1 px
100 = 2 px
1000 = 4 px
10000 = 8 px

So it's probably a bad idea to use 10 GB as your base value going in, since your range will be quite restrictive on the graph.

EDIT:  Locutus, your math is correct.
log 10 = 1, log 100 = 2, log 1000 = 3, etc.
2^0 = 1, 2^1 = 2, 2^2 = 4, 2^3 = 8, etc.

Unless I missed something.

10 = 1

2^(log(x) - 1) = 2^(1-1) = 2^0 = 1

100 = 2

2^(log(x) - 1) = 2^(2-1) = 2


1,000 = 4

2^(log(x) - 1) = 2^(3 - 1) = 4


10,000 = 8

2^(log(x) - 1) = 2^(4 - 1) = 8
Title: Re: Math equation question
Post by: Bobboau on December 19, 2011, 03:18:26 pm
yeah, so like they said you want a logarithmic scale.
Title: Re: Math equation question
Post by: Spicious on December 20, 2011, 02:15:42 am
It's not actually logarithmic as it's exponentiated again. It's clearer if you simplify it to x ^ (log 2) / 2 where the log is base 10.
Title: Re: Math equation question
Post by: Sandwich on December 26, 2011, 04:28:38 pm
I believe you want

2^(log(x) - 1)

where the log has a base of ten

I'll try to convert that into Rainmeter-speak, thanks. :)

So it's probably a bad idea to use 10 GB as your base value going in, since your range will be quite restrictive on the graph.

Indeed... the scale will start with 80Gb at 40 pixels, which should max out with 1.5Tb at something like 500px or so (80 = 40px, 800 = 400px, 800x2 ~ 1.5Tb, so something above 400px)?
Title: Re: Math equation question
Post by: Sandwich on March 04, 2012, 07:54:59 am
Finally finished the entire meter; link is below if anyone is interested in it. It has histograms for CPU usage, used/free RAM, upload/download speeds, and drive read/write activity, as well as logarithmically-scaled bars for drive used/free capacities. It's sized to fit within the titlebar space of typical Windows apps (24 pixels high). The intention is that it be a set of always-visible meters rather than something that just sits on the desktop.

(http://i.imgur.com/RbKH8.png)

Download here: http://staff.hard-light.net/sandwich/rainmeter/sandwich-rainmeter.zip

Suggestions and requests welcome. :)