It is currently October 26th, 2021, 7:13 pm

Simple COVID-19 Stats Skin

RSS, ATOM and other feeds, GMail, Stocks, any information retrieved from the internet
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4438
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Simple COVID-19 Stats Skin

Post by eclectic-tech »

ms310 wrote: March 29th, 2020, 11:52 pm I'm having some trouble - for some reason the numeric values are only the first three digits when removing the "," from the original values:
Do all the "Substitute" actions in each webparser child measures...

Code: Select all

[MeasureTotal]
Measure=WebParser
URL=[MeasureOverall]
StringIndex=2
Substitute="":"...",",":""
DynamicVariables=1
And remove the "Substitute=..." lines from each String Measure:

Code: Select all

[decOverall]
Measure=String
String=[MeasureTotal]
IfCondition=(#CURRENTSECTION#>#ChangeTotal#)
IfTrueAction=[!SetVariable DirectionTotal "[\x2191]"]
IfCondition2=(#CURRENTSECTION#<#ChangeTotal#)
IfTrueAction2=[!SetVariable DirectionTotal "[\x2193]"]
IfCondition3=(#CURRENTSECTION#=#ChangeTotal#)
IfTrueAction3=[!SetVariable DirectionTotal "[\x2194]"]
OnChangeAction=[!Delay "1000"][!SetVariable ChangeTotal "[decOverall]"][!UpdateMeter "mTotal"][!Redraw]
DynamicVariables=1
covid1.png
You do not have the required permissions to view the files attached to this post.
ms310
Posts: 224
Joined: April 1st, 2015, 7:16 am

Re: Simple COVID-19 Stats Skin

Post by ms310 »

eclectic-tech wrote: March 30th, 2020, 2:40 am Do all the "Substitute" actions in each webparser child measures...

Code: Select all

[MeasureTotal]
Measure=WebParser
URL=[MeasureOverall]
StringIndex=2
Substitute="":"...",",":""
DynamicVariables=1
And remove the "Substitute=..." lines from each String Measure:

Code: Select all

[decOverall]
Measure=String
String=[MeasureTotal]
IfCondition=(#CURRENTSECTION#>#ChangeTotal#)
IfTrueAction=[!SetVariable DirectionTotal "[\x2191]"]
IfCondition2=(#CURRENTSECTION#<#ChangeTotal#)
IfTrueAction2=[!SetVariable DirectionTotal "[\x2193]"]
IfCondition3=(#CURRENTSECTION#=#ChangeTotal#)
IfTrueAction3=[!SetVariable DirectionTotal "[\x2194]"]
OnChangeAction=[!Delay "1000"][!SetVariable ChangeTotal "[decOverall]"][!UpdateMeter "mTotal"][!Redraw]
DynamicVariables=1
covid1.png
Thanks eclectic-tech. This works numerically (thank you thank you!), but I wanted to keep the comma's for the display. 722,088 looks nicer than 722088. Is there a clever way to do this without trying to create a complex substitute to put the commas back in for display?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4438
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Simple COVID-19 Stats Skin

Post by eclectic-tech »

ms310 wrote: March 30th, 2020, 2:48 am Thanks eclectic-tech. This works numerically (thank you thank you!), but I wanted to keep the comma's for the display. 722,088 looks nicer than 722088. Is there a clever way to do this without trying to create a complex substitute to put the commas back in for display?
I posted to your other thread related to this skin with a way to retain the readings...

I will look at a way to make the display "pretty" again. ;-)
ms310
Posts: 224
Joined: April 1st, 2015, 7:16 am

Re: Simple COVID-19 Stats Skin

Post by ms310 »

eclectic-tech wrote: March 30th, 2020, 3:13 am I posted to your other thread related to this skin with a way to retain the readings...

I will look at a way to make the display "pretty" again. ;-)
Thanks - you are great. I appreciate your time. Its strange - the Substitute = ",":"" seems to truncate the value at the first "," instance to be replaced.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4438
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Simple COVID-19 Stats Skin

Post by eclectic-tech »

ms310 wrote: March 30th, 2020, 3:16 am Thanks - you are great. I appreciate your time. Its strange - the Substitute = ",":"" seems to truncate the value at the first "," instance to be replaced.
In order to get your string meters to display comma formatted numbers, create 3 string measures to reformat the values with commas and use those as the MeasureName= in your String meters:

Code: Select all

[MeasureTotalFormatted]
Measure=String
String=[MeasureTotal]
RegExpSubstitute=1
Substitute="\d{1,3}(?=(\d{3})+$)":"\0,"
DynamicVariables=1

[MeasureDeathsFormatted]
Measure=String
String=[MeasureDeaths]
RegExpSubstitute=1
Substitute="\d{1,3}(?=(\d{3})+$)":"\0,"
DynamicVariables=1

[MeasureRecoveredFormatted]
Measure=String
String=[MeasureRecovered]
RegExpSubstitute=1
Substitute="\d{1,3}(?=(\d{3})+$)":"\0,"
DynamicVariables=1

In you main skin
Edit [mTotal] and set 'MeasureName=MeasureTotalFormatted'
Edit [mDeaths] and set 'MeasureName=MeasureDeathsFormatted'
Edit [mRecovered] and set 'MeasureName=MeasureRecoveredFormatted'
ms310
Posts: 224
Joined: April 1st, 2015, 7:16 am

Re: Simple COVID-19 Stats Skin

Post by ms310 »

eclectic-tech wrote: March 30th, 2020, 3:32 am In order to get your string meters to display comma formatted numbers, create 3 string measures to reformat the values with commas and use those as the MeasureName= in your String meters:

Code: Select all

[MeasureTotalFormatted]
Measure=String
String=[MeasureTotal]
RegExpSubstitute=1
Substitute="\d{1,3}(?=(\d{3})+$)":"\0,"
DynamicVariables=1

[MeasureDeathsFormatted]
Measure=String
String=[MeasureDeaths]
RegExpSubstitute=1
Substitute="\d{1,3}(?=(\d{3})+$)":"\0,"
DynamicVariables=1

[MeasureRecoveredFormatted]
Measure=String
String=[MeasureRecovered]
RegExpSubstitute=1
Substitute="\d{1,3}(?=(\d{3})+$)":"\0,"
DynamicVariables=1

In you main skin
Edit [mTotal] and set 'MeasureName=MeasureTotalFormatted'
Edit [mDeaths] and set 'MeasureName=MeasureDeathsFormatted'
Edit [mRecovered] and set 'MeasureName=MeasureRecoveredFormatted'
Thank you - I had thought I could avoid this but it is inevitatble.

Do you think it is a Rainmeter bug that Substitute="":"...",",":"" on the WebParser Measure results in string 700,000 and num 700?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4438
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Simple COVID-19 Stats Skin

Post by eclectic-tech »

ms310 wrote: March 30th, 2020, 5:14 am Thank you - I had thought I could avoid this but it is inevitatble.

Do you think it is a Rainmeter bug that Substitute="":"...",",":"" on the WebParser Measure results in string 700,000 and num 700?
No, it is not a bug.

Substitution only affects the STRING value of the measure, so the NUMBER value evaluation is done on the the returned value that includes commas. The resulting number value is only able to find a valid number up to the first comma, so 720,390 returns 720 as the number value.

In order to evaluate the numbers accurately in IfCondition tests, you need to use substitution on the string to get a "comma-free" number value. Then, if you want to display the value with commas, use another substitution to insert them.
ms310
Posts: 224
Joined: April 1st, 2015, 7:16 am

Re: Simple COVID-19 Stats Skin

Post by ms310 »

eclectic-tech wrote: March 30th, 2020, 11:59 am No, it is not a bug.

Substitution only affects the STRING value of the measure, so the NUMBER value evaluation is done on the the returned value that includes commas. The resulting number value is only able to find a valid number up to the first comma, so 720,390 returns 720 as the number value.

In order to evaluate the numbers accurately in IfCondition tests, you need to use substitution on the string to get a "comma-free" number value. Then, if you want to display the value with commas, use another substitution to insert them.
Cheers - this makes sense.
ms310
Posts: 224
Joined: April 1st, 2015, 7:16 am

Re: Simple COVID-19 Stats Skin

Post by ms310 »

I've created a new version from a different feed. If there is interest I am happy to upload it. The thinking was to try to compress the data as much as possible. There are three BAR meters that are on top of each other - and I played with the scale of the top two bars in order to make the comparitively small values more visible. There is a tooltip that provides the details for each statistic.

The numbers are global. Mouseover will display the top four countries. Has long as the pattern from the website pattern holds the top 4 countries will be pulled up.
2020-03-31_16h43_47.png
You do not have the required permissions to view the files attached to this post.