It is currently April 27th, 2024, 5:18 pm

FLOATING TEXT PROBLEM

Get help with creating, editing & fixing problems with skins
kabott
Posts: 39
Joined: March 28th, 2012, 10:18 pm
Location: Argentina

FLOATING TEXT PROBLEM

Post by kabott »

Hi, i was trying to make the text float above the Bar meter (about 6 pixels or so) , i did have some success to get the text to follow the bar, but there is something wrong, since the distance between text & bar seems to change, that was not intended, how can i fix this?
Thank you in advance guys :welcome:
FLOATING-TEXT-PROBLEM.png

Code: Select all

[Rainmeter]
Update=2000


;============================//////////////////////// FED START
[VARIABLES]
UpdateRate=8000

[Feed_Long_A]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=http://fxtrade.oanda.com/analysis/open-position-ratios
RegExp= "(?siU)<span class="position-ratio-label">EUR/USD</span>(.*) </span>"
Update= #UpdateRate#
StringIndex=1
DecodeCharacterReference=1
Substitute= '"':""
FinishAction= !Execute   [!RainmeterRedraw "#currentconfig#"] 

[Feed_Long_B]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[Feed_Long_A]
RegExp="(?siU)long-position">(?-U)[\s]+(?U)(.*)\s"
Update= #UpdateRate#
StringIndex=1
Substitute= "long-position":"", ">":"" , "%":"" , '"':"", " ":"","#CRLF#":""
DecodeCharacterReference=1
FinishAction= !Execute   [!RainmeterRedraw "#currentconfig#"] 

[Feed_Short_Calc]
Measure=Calc
Formula= (100 - [Feed_Long_B])
DynamicVariables=1
MaxValue=100
MinValue=0

;=============================//////////////////////// FEED END

[BACKGROUND]
Meter=Image
SolidColor=0,0,0,100
X=0
Y=0
W=185
H=120

[Title]
Meter=STRING
Text="EUR/USD ratios"
X=45
Y=5
FontColor= 255,255,255,160
FontSize= 8
FontFace=Novecentoz
Antialias=1
StringAlign= LEFT
;================= Ratio Calculations


[Infinite]
Measure=Calc
Formula= 100
DynamicVariables=1
MaxValue=100
MinValue=0


; ============= Diameter calculations

[LongDiameterCalculation]
Measure=Calc
Formula=[Feed_Long_B]
DynamicVariables=1
MaxValue=100
MinValue=0

[ShortDiameterCalculation]
Measure=Calc
Formula=[Feed_Short_Calc]
DynamicVariables=1
MaxValue=100
MinValue=0

;============================= Roundline Meters START

[BlackCircle]
Meter=ROUNDLINE
MeasureName=Infinite
X=30
Y= 40
W=50
H= 50
StartAngle=4.712
LineStart=0
LineLength=42
RotationAngle=-6.283
LineColor=0,0,0,60
Solid=1
AntiAlias=1
NumOfDecimals=2
DynamicVariables=1

[Meter_Long_A]
Meter=ROUNDLINE
MeasureName=LongDiameterCalculation
X=r
Y=r
W=50
H= 50
StartAngle=4.712
LineStart=0
LineLength=(([LongDiameterCalculation] / 2) + 5)
RotationAngle=-6.283
LineColor=39,87,110,255
Solid=1
AntiAlias=1
NumOfDecimals=2
DynamicVariables=1

[Meter_Long_B]
Meter=ROUNDLINE
MeasureName=LongDiameterCalculation
X=r
Y= r
W=50
H= 50
StartAngle=4.712
LineStart=([LongDiameterCalculation] / 2)
LineLength=(([LongDiameterCalculation] / 2) + 5)
RotationAngle=-6.283
LineColor=0,130,190,210
Solid=1
AntiAlias=1
NumOfDecimals=2
DynamicVariables=1

[Meter_ShortA]
Meter=ROUNDLINE
MeasureName=ShortDiameterCalculation
X=r
Y=r
W=50
H= 50
LineStart=0
LineLength=(([ShortDiameterCalculation] / 2) +5)
StartAngle=4.712
RotationAngle=6.283
LineColor=80,0,0,250
Solid=1
AntiAlias=1
NumOfDecimals=2
DynamicVariables=1


[Meter_ShortB]
Meter=ROUNDLINE
MeasureName=ShortDiameterCalculation
X=r
Y=r
W=50
H= 50
LineStart=([ShortDiameterCalculation] / 2) 
LineLength=(([ShortDiameterCalculation] / 2) +5)
StartAngle=4.712
RotationAngle=6.283
LineColor=110,0,0,250
Solid=1
AntiAlias=1
NumOfDecimals=2
DynamicVariables=1

;================================================== Over Ratios
[Ratios_Gradient]
Meter=Image
ImageName=C:\Users\Win7\Documents\Rainmeter\Skins\I - INTERFACE\Resources\Pattern_2.png
ImageAlpha=180
X=-25r
Y=-25r
W=100
H=100


;============================================== BARS

[Bar_ratios_long]
MeasureName=LongDiameterCalculation
Meter=BAR
X=110r
Y=30
W=20
H=60
BarOrientation=Vertical
BarColor=39,87,110,255

[Bar_ratios_short]
MeasureName=ShortDiameterCalculation
Meter=BAR
X=25r
Y=30
W=20
H=60
BarOrientation=Vertical
BarColor=80,0,0,250

;============================== texts

[CalcLong]
Measure=Calc
Formula= LongDiameterCalculation
MaxValue=99
MinValue=0
InvertMeasure=1
DynamicVariables=1

[CalcShort]
Measure=Calc
Formula= ShortDiameterCalculation
MaxValue=99
MinValue=0
InvertMeasure=1
DynamicVariables=1


[Ratios_text_Long]
MeasureName=LongDiameterCalculation
Meter=STRING
x=114
y=([CalcLong] )
FontColor= 255,255,255,160
FontSize=6
FontFace=hooge 05_53
Prefix= "%"
NumOfDecimals=0
DynamicVariables=1

[MeterFeed2]
MeasureName=ShortDiameterCalculation
Meter=STRING
x=140
y=([CalcShort] )
FontColor= 255,255,255,160
FontSize=6
FontFace=hooge 05_53
Prefix= "%"
NumOfDecimals=0
DynamicVariables=1
You do not have the required permissions to view the files attached to this post.
Last edited by smurfier on July 8th, 2012, 7:49 pm, edited 1 time in total.
Reason: Changed snippet to code.
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: FLOATING TEXT PROBLEM

Post by MerlinTheRed »

You need to take into account the actual maximum height of the bars you want to place that string over. As far as I can see all you currently do is taking the percentage value, invert it and use it as the position for your text. What you need to do is:

take the upper edge of the bars (if they were 100% full) as the base value of your text position

add the inverted percentage value multiplied with the maximum height of the bars

add the distance you want the text to be from the top of the bars

set StringAlign to LeftBottom

So the formula for calculating the text's position would look something like this:

Code: Select all

[Ratios_text_Long]
MeasureName=LongDiameterCalculation
Meter=STRING
x=114
y=(#UpperEdge#+[CalcLong]/100*#MaxBarHeight#-#DistanceFromBar# )
StringAlign=LeftBottom
FontColor= 255,255,255,160
FontSize=6
FontFace=hooge 05_53
Prefix= "%"
NumOfDecimals=0
DynamicVariables=1
Or using the values you have in your code:

Code: Select all

y=(30+[CalcLong]/100*60-6)
I didn't test it so it might not be exactly right but I think you get the idea of what to do.

As a sidenote you shouldn't be using absolute paths for referencing to images.
ImageName=C:\Users\Win7\Documents\Rainmeter\Skins\I - INTERFACE\Resources\Pattern_2.png
Should become
ImageName=#@#Pattern_2.png

This will only work if you rename your Resources folder to "@Resources" (you absolutely should do that). See here for more details: http://rainmeter.net/cms/Skins-Resources_beta
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
kabott
Posts: 39
Joined: March 28th, 2012, 10:18 pm
Location: Argentina

Re: FLOATING TEXT PROBLEM

Post by kabott »

Thank you Merlin! now it works as it should!

and thanks for the @Resources tip! :)
kabott
Posts: 39
Joined: March 28th, 2012, 10:18 pm
Location: Argentina

Re: FLOATING TEXT PROBLEM

Post by kabott »

Well, here i am again..i cant seem to get this one to work, same concept but with a Net-In/ Out measure

i tried all i could think of...no luck, i dont get why it doesnt work, its the same formula and worked well before :?

Code: Select all


[Rainmeter]
Update=800



[BACKGROUND]
Meter=Image
SolidColor=0,0,0,100
X=0
Y=0
W=185
H=120


[Style1]
StringAlign=Center
StringStyle=NORMAL
FontFace=hooge 05_53
FontSize=6
FontColor= 255,255,255,160

[MeasureNetOut]
Measure=NetOut

[BarNetOut]
MeasureName=MeasureNetOut
Meter=BAR
X=10
Y=30
W=20
H=60
BarOrientation=Vertical
BarColor=39,87,110,255

;============== Calc Floating text
[CalcNetOut]
Measure=Calc
Formula=MeasureNetOut
MaxValue=100
MinValue=0
InvertMeasure=1
DynamicVariables=1

[MeterNetOut]
MeasureName=MeasureNetOut
Meter=STRING
X=8r
y= ( 30 + [CalcNetOut] /100 + 60 - 20 )
MeterStyle=Style1
Percentual=1
Text="%%1"
DynamicVariables=1

;================ Title
[TitleNetOut]
Meter=STRING
X=2r
y=90
MeterStyle=Style1
Text="out"

User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: FLOATING TEXT PROBLEM

Post by MerlinTheRed »

This is most likely because the network speed is not calculated in percent (Rainmeter doesn't know your maximum upload/download speed). This means the values of the measure won't be between 0 and 100 but the actual Byte/second that is currently being transferred. To get this working you therefore must divide by your maximum upload speed instead of 100:

y= ( 30 + [CalcNetOut] /#MaxNetOut# + 60 - 20 )

Beware because it's not very clear what units a NetOut/In measure uses. The documentation states the values are in Bits/sec but my experiments show that it's rather Bytes/sec.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
kabott
Posts: 39
Joined: March 28th, 2012, 10:18 pm
Location: Argentina

Re: FLOATING TEXT PROBLEM

Post by kabott »

Yes Merlin, i figured, so im dividing Net-In by 50000 and Net-out by 16000 trying not let them reach 100% because wen they do the floating text will go over around 20 pixels plus, dont know why, but i can guess.., this is my Net-In code

Code: Select all



[MeasureNetTotal]
Measure=NetTotal

[CalcNetTotalBar]
Measure=Calc
Formula= MeasureNetTotal
MaxValue=500000
MinValue=0
DynamicVariables=1


[BarNetTotal]
MeasureName=CalcNetTotalBar
Meter=BAR
X=20r
Y=30
W=20
H=60
BarOrientation=Vertical
BarColor=39,87,110,255

;============== Calc Floating text NET IN

[CalcNetTotal]
Measure=Calc
Formula= MeasureNetTotal
MaxValue=500000
MinValue=0
DynamicVariables=1
InvertMeasure=1

[MeterNetTotalFloat]
MeasureName=CalcNetTotalBar
Meter=STRING
X=8r
y=( 30 + [CalcNetTotal]  /500000 * 60 - 10 )
DynamicVariables=1
StringAlign=Center
StringStyle=NORMAL
FontFace=hooge 05_53
FontSize=6
FontColor= 255,255,255,160
Percentual=1
Text="%%1"

User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: FLOATING TEXT PROBLEM

Post by MerlinTheRed »

Does that mean it works now?
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
kabott
Posts: 39
Joined: March 28th, 2012, 10:18 pm
Location: Argentina

Re: FLOATING TEXT PROBLEM

Post by kabott »

Yep, works till it reaches %100, then the floating text goes bout 40 pixels beyond the bar limit, kinda like a bug, and back to normal (16 pixels above) once the numbers get below %100 , this doesn't happens often, anyways i can keep increasing the MaxValue so it doesnt happens at all, but i would like to get it as accurate as posible

Thank you again Merlin :)
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: FLOATING TEXT PROBLEM

Post by MerlinTheRed »

Well if the value goes above 100% it's not really the max value ;)
If you don't want to use a terribly high max value you can prevent the text from going too far up by doing this:

y=( 30 + ([CalcNetTotal] /500000 > 1 ? 1 : [CalcNetTotal] /500000) * 60 - 10 )

If this doesn't work (I don't know what formula capabilities you can use here) try moving the calculation of the position into a Calc measure (make sure to put the calc above the string meter).
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!