It is currently April 19th, 2024, 6:57 pm

Trailing Zeros

General topics related to Rainmeter.
Resike
Posts: 33
Joined: May 1st, 2015, 1:25 am

Re: Trailing Zeros

Post by Resike »

jsmorley wrote:
I still don't follow. The Line meter is defined as some W and H (width and height). The values are plotted on that with the bottom being 0% and the top being 100%. It doesn't matter what the bottom or least "value" is, whatever it is, it is 0% of the range being measured. You simply can't logically have a negative "percentage", as well, I don't even understand that. Where does it plot it in the meter?
I would like to track the price change in percentages for multiple currencies and would like to be able to draw a graph like this:

http://finance.yahoo.com/echarts?s=EURUSD=x#{"range":"1y"}

I tought when the line gets a minus value then it's initial value gets repositioned up, and the next value of the line drops below that line.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trailing Zeros

Post by jsmorley »

Resike wrote: I would like to track the price change in percentages for multiple currencies and would like to be able to draw a graph like this:

http://finance.yahoo.com/echarts?s=EURUSD=x#{"range":"1y"}

I tought when the line gets a minus value then it's initial value gets repositioned up, and the next value of the line drops below that line.
No, a line meter simply plots where in a range, defined by "minimum value / maximum value" a "current value" falls as a percentage. Any "previous value" has no bearing on where a value is plotted. The meter in effect simply finds the point on the meter that represents the percentage of the total range the current value is, and then draws a "line" from the previous value to that. I'm not sure it is any more complicated than that.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trailing Zeros

Post by jsmorley »

You can "indicate" negative values on the meter with some labels, but that would really preclude using AutoScale on it (which I hate anyway) and only indicates a "negative" or "positive" direction of change by where on the meter the value is plotted. Other than the direction the "line" goes, up or down, that is the only indication possible of the direction of change.

Requires the latest Rainmeter 3.3 beta version:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[MeasureValue]
Measure=Loop
StartValue=-10
EndValue=10
Increment=1
LoopCount=0
MinValue=-10
MaxValue=10

[MeterLine]
Meter=Line
MeasureName=MeasureValue
W=210
H=70
LineCount=1
LineColor=140,252,124,255
SolidColor=37,47,57,255
AntiAlias=1

[MeterMiddle]
Meter=Image
W=210
H=1
X=0
Y=35
SolidColor=120,120,120,255

[MeterPlus]
Meter=String
X=217
Y=0
FontSize=9
FontColor=120,120,120,255
Antialias=1
Text=10

[MeterZero]
Meter=String
X=222
Y=29
FontSize=9
FontColor=120,120,120,255
Antialias=1
Text=0

[MeterMinus]
Meter=String
X=212
Y=59
FontSize=9
FontColor=120,120,120,255
Antialias=1
Text=-10
test.gif
I'm probably really just not understanding, but the only way you are going to change the "range" that defines the percentage, and thus change where on the meter a value falls in that percentage, is to dynamically change the MinVaue/MaxValue options on the measure returning the value. Be aware however, that changing the "range" will cause the entire meter to use that new range on the next update. The entire meter will be redrawn using the new values for 0% and 100%.

I think the fundamental problem might be that you are thinking of a Line meter as plotting "values" in some way. It just doesn't. It plots "percentages". There is one, and only one percentage "range" used by the entire meter on each update.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16145
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Trailing Zeros

Post by balala »

jsmorley wrote:I still don't follow. The Line meter is defined as some W and H (width and height). The values are plotted on that with the bottom being 0% and the top being 100%. It doesn't matter what the bottom or least "value" is, whatever it is, it is 0% of the range being measured. You simply can't logically have a negative "percentage", as well, I don't even understand that. Where does it plot it in the meter?
You're right if all values are positive. But there could be some problems if the MinValue of a measure is negative and the MaxValue is positive:

Code: Select all

[Timer]
Measure=Calc
Formula=( Timer + 1 )

[MeasureSin]
Measure=Calc
Formula=( 10 * Sin ( PI * Timer / 5 ))
MinValue=-10
MaxValue=10
I read your last post after I posted this message. I have to study it a bit.
Last edited by balala on May 4th, 2015, 2:55 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trailing Zeros

Post by jsmorley »

balala wrote: I read your last post after I posted this message. I have to study it a bit.
Unless there is some fundamental problem with "math" in Rainmeter that I'm not aware of, if you have a range of values from -100 to 100, then when that range is expressed as a percentage, -100 is 0% -50 is 25%, 0 is 50%, 50 is 75% and 100 is 100%. I can't see how it can see that any other way.

In any case, I think we are off down the wrong rabbit-hole here. He isn't talking about "negative values", but some behavior he wants on "negative direction of change", and I'm still trying to wrap my head around what he expects.
User avatar
balala
Rainmeter Sage
Posts: 16145
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Trailing Zeros

Post by balala »

jsmorley wrote:Unless there is some fundamental problem with "math" in Rainmeter that I'm not aware of, if you have a range of values from -100 to 100, then when that range is expressed as a percentage, -100 is 0% -50 is 25%, 0 is 50%, 50 is 75% and 100 is 100%. I can't see how it can see that any other way.
That's interesting to know. But I still don't understand where is the problem with this code:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Timer]
Measure=Calc
Formula=( Timer + 1 )

[MeasureSin]
Measure=Calc
Formula=( 10 * Sin ( PI * Timer / 5 ))
MinValue=-10
MaxValue=10

[MeterBackground]
Meter=Image
W=220
H=80
SolidColor=150,150,150,255

[MeterLine]
Meter=Line
MeasureName=MeasureSin
X=5
Y=5
W=210
H=70
LineCount=2
LineColor=140,252,124,255
SolidColor=0,0,0,255
AutoScale=1
AntiAlias=1
because this line goes below the horizontal axis, for every second half periode.
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trailing Zeros

Post by jsmorley »

balala wrote:because this line goes below the horizontal axis, for every second half periode.
I don't know. I'm not sure I can see the problem, since it obviously can't plot a value that is "outside the meter". Perhaps there is some issue with your measure returning a value of -0 at one point in the cycle, I'm not entirely sure what Rainmeter does with logically invalid numbers in this context.

Edit: Yeah, I can see the issue happen if I change MinValue to -20 and MaxValue to 20. Then it should never hit the bottom or top, but it does hit the bottom. I'm really not sure what that is. I'm still suspicious of "-0" giving it heartburn, but I'm not sure how to test that.
User avatar
balala
Rainmeter Sage
Posts: 16145
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Trailing Zeros

Post by balala »

jsmorley wrote: I don't know. I'm not sure I can see the problem, since it obviously can't plot a value that is "outside the meter". Perhaps there is some issue with your measure returning a value of -0 at one point in the cycle, I'm not entirely sure what Rainmeter does with logically invalid numbers in this context.

Edit: Yeah, I can see the issue happen if I change MinValue to -20 and MaxValue to 20. Then it should never hit the bottom or top, but it does hit the bottom. I'm really not sure what that is.
Maybe a Rainmeter upgrade could help? Because I'm using the 3.2.0 r2326 version, I didn't upgrade yet, but maybe I should.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trailing Zeros

Post by jsmorley »

balala wrote: Maybe a Rainmeter upgrade could help? Because I'm using the 3.2.0 r2326 version, I didn't upgrade yet, but maybe I should.
Shouldn't matter as far as Line meter goes. Nothing has changed. I can see the issue you are having while running 3.3 on my system anyway.
User avatar
balala
Rainmeter Sage
Posts: 16145
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Trailing Zeros

Post by balala »

jsmorley wrote:
Ok, thanks anyway.