It is currently March 29th, 2024, 7:14 am

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:To be honest, I'd be tempted to stop fighting any "lag" with WebParser having to go out and get the information while the skin moves on, and just save and use a "persistent" previous value as a starting point. Then you can just let the skin operate without any intervention, and it will work about as well as can be expected.

Code: Select all

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

[ParsePrice]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=http://finance.yahoo.com/echarts?s=eurusd=x
RegExp="(?siU).*<span class="time_rtq_ticker.*">.*>(.*)</span>"
StringIndex=1
UpdateRate=100
FinishAction=[!SetOption CurrentPrice Formula "[ParsePrice]"][!WriteKeyValue CurrentPrice Formula "[ParsePrice]"]

[CurrentPrice]
Measure=Calc
Formula=1.1200

[MeterStringPrice]
Meter=String
MeasureName=CurrentPrice
W=50
H=14
FontSize=11
FontColor=255,255,255,255
SolidColor=27,37,47,255
Padding=5,5,5,5
NumOfDecimals=4
AntiAlias=1

[MeterLineGraphPrice]
Meter=Line
X=0
Y=0R
W=60
H=20
MeasureName=CurrentPrice
AutoScale=1
LineColor=250,186,0,255
SolidColor=57,67,77,255
1.png
But it's only working now because you removed the UpdateDivider from the Graph, so it's gets updated every second, however i only want to update the Graph when the parser reads a new value from the site.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trailing Zeros

Post by jsmorley »

Resike wrote: But it's only working now because you removed the UpdateDivider from the Graph, so it's gets updated every second, however i only want to update the Graph when the parser reads a new value from the site.

Code: Select all

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

[ParsePrice]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=http://finance.yahoo.com/echarts?s=eurusd=x
RegExp="(?siU).*<span class="time_rtq_ticker.*">.*>(.*)</span>"
StringIndex=1
UpdateRate=100
FinishAction=[!SetOption CurrentPrice Formula "[ParsePrice]"][!WriteKeyValue CurrentPrice Formula "[ParsePrice]"][!UpdateMeasure CurrentPrice][!UpdateMeter *][!Redraw]

[CurrentPrice]
Measure=Calc
Formula=1.1200

[MeterStringPrice]
Meter=String
MeasureName=CurrentPrice
W=50
H=14
FontSize=11
FontColor=255,255,255,255
SolidColor=27,37,47,255
Padding=5,5,5,5
NumOfDecimals=4
AntiAlias=1
UpdateDivider=-1

[MeterLineGraphPrice]
Meter=Line
X=0
Y=0R
W=60
H=20
MeasureName=CurrentPrice
AutoScale=1
LineColor=250,186,0,255
SolidColor=57,67,77,255
UpdateDivider=-1
Make no mistake, I really hate the entire concept of a Line meter for this, it's mostly going to be a "zero" flatline for hours after you load/refresh it, but to each his own.
Resike
Posts: 33
Joined: May 1st, 2015, 1:25 am

Re: Trailing Zeros

Post by Resike »

jsmorley wrote:

Code: Select all

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

[ParsePrice]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=http://finance.yahoo.com/echarts?s=eurusd=x
RegExp="(?siU).*<span class="time_rtq_ticker.*">.*>(.*)</span>"
StringIndex=1
UpdateRate=100
FinishAction=[!SetOption CurrentPrice Formula "[ParsePrice]"][!WriteKeyValue CurrentPrice Formula "[ParsePrice]"][!UpdateMeasure CurrentPrice][!UpdateMeter *][!Redraw]

[CurrentPrice]
Measure=Calc
Formula=1.1200

[MeterStringPrice]
Meter=String
MeasureName=CurrentPrice
W=50
H=14
FontSize=11
FontColor=255,255,255,255
SolidColor=27,37,47,255
Padding=5,5,5,5
NumOfDecimals=4
AntiAlias=1
UpdateDivider=-1

[MeterLineGraphPrice]
Meter=Line
X=0
Y=0R
W=60
H=20
MeasureName=CurrentPrice
AutoScale=1
LineColor=250,186,0,255
SolidColor=57,67,77,255
UpdateDivider=-1
Make no mistake, I really hate the entire concept of a Line meter for this, it's mostly going to be a "zero" flatline for hours after you load/refresh it, but to each his own.
I think this will be it, thanks for the help.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trailing Zeros

Post by jsmorley »

Sure thing.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trailing Zeros

Post by jsmorley »

I'd be tempted to do something like this:

Code: Select all

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

[MeasureCounter]
Measure=Calc
Formula=MeasureCounter + 1
IfCondition=MeasureCounter >= 100
IfTrueAction=[!SetOptionGroup MyMeters UpdateDivider "-1"][!PauseMeasure MeasureCounter]
 
[ParsePrice]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=http://finance.yahoo.com/echarts?s=eurusd=x
RegExp="(?siU).*<span class="time_rtq_ticker.*">.*>(.*)</span>"
StringIndex=1
UpdateRate=6000
FinishAction=[!SetOption CurrentPrice Formula "[ParsePrice]"][!WriteKeyValue CurrentPrice Formula "[ParsePrice]"][!UpdateMeasure CurrentPrice][!UpdateMeterGroup MyMeters][!Redraw]

[CurrentPrice]
Measure=Calc
Formula=1.1200

[MeterStringPrice]
Meter=String
Group=MyMeters
MeasureName=CurrentPrice
W=50
H=14
FontSize=11
FontColor=255,255,255,255
SolidColor=27,37,47,255
Padding=5,5,5,5
NumOfDecimals=4
AntiAlias=1

[MeterLineGraphPrice]
Meter=Line
Group=MyMeters
X=0
Y=0R
W=60
H=20
MeasureName=CurrentPrice
AutoScale=1
LineColor=250,186,0,255
SolidColor=57,67,77,255
That way the meter will race to fill up with a valid value pretty quickly, then once it has done so, (I estimated about 100 updates at an update every 100 milliseconds works well enough) it "stops" the meters from updating until they are told to do so by the WebParser measure.

The UpdateRate=6000 on the WebParser measure makes sure it still only updates every 10 minutes, in spite of the lower skin Update.

Just visually more pleasing to me, since the meter won't spend hours mostly "zero".
Resike
Posts: 33
Joined: May 1st, 2015, 1:25 am

Re: Trailing Zeros

Post by Resike »

I was thing thinking about creating a custom refresh icon, which will force the parse to run (maybe with a timeout function to prevent spam) and update and redraw the prices, but only feed the Graph with the new parse value, in this case the Graph wont loose it's vaules on refresh.
Resike
Posts: 33
Joined: May 1st, 2015, 1:25 am

Re: Trailing Zeros

Post by Resike »

Is is possible the line meter to show minus values?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trailing Zeros

Post by jsmorley »

Resike wrote:Is is possible the line meter to show minus values?
Not sure I follow. A Line meter doesn't show "values" at all, but a "percentage" that a value is of the total range the value can be.

So a measure that can be anything from -10 to 10 for instance would be displayed in a Line meter with -10 as 0%, 0 as 50%, and 10 as 100%. The fact that a number is negative doesn't have any meaning to a Line meter, only what percentage any number is of the "total".

So the answer is "yes" it can "use" negative values, but "no" it can't "show" negative values. I hope I'm understanding your question, I may well not...
Resike
Posts: 33
Joined: May 1st, 2015, 1:25 am

Re: Trailing Zeros

Post by Resike »

jsmorley wrote: Not sure I follow. A Line meter doesn't show "values" at all, but a "percentage" that a value is of the total range the value can be.

So a measure that can be anything from -10 to 10 for instance would be displayed in a Line meter with -10 as 0%, 0 as 50%, and 10 as 100%. The fact that a number is negative doesn't have any meaning to a Line meter, only what percentage any number is of the "total".

So the answer is "yes" it can "use" negative values, but "no" it can't "show" negative values. I hope I'm understanding your question, I may well not...
I guess this also applies to Histograms. Personally i would like the line to drop below it's initial value when it gets a minus value. Maybe i should flip the line on minus values?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trailing Zeros

Post by jsmorley »

Resike wrote: I guess this also applies to Histograms. Personally i would like the line to drop below it's initial value when it gets a minus value.
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?