It is currently April 26th, 2024, 6:11 am

Calculating a sunrise/sunset pie chart on a 24 hour clock

Get help with creating, editing & fixing problems with skins
Paw4444
Posts: 3
Joined: July 31st, 2015, 10:30 am

Calculating a sunrise/sunset pie chart on a 24 hour clock

Post by Paw4444 »

Hello fellow customizers :welcome:
I always try to do customizations alone and hardly ever post for help. I have been struggling to make this work for 2 days now. :???:

Please see attached image.

01. The first is a 12 hour clock with arrows for sunrise and sunset. It also displays the sunrise/sunset times as text.
02. The second is a 24 hour clock.
03. What I would like to do is a 24 hour clock template with a pie chart representation below it. It would show sunrise/sunset as black arrows and also create a pie chart representation between these arrows, respectively one for the day and one for the night.

How would I go about taking these sunrise/sunset times from the WebParser and convert them to angle values that can be used to create the pie charts?
Once I get the angle value for (say) Sunset, I know how to start a bar from there, although I don't know how to make it end where the Sunrise arrow (angle value) is.

Links to download 1st and 2nd clock:
Go to 3rd post here: http://rainmeter.net/forum/viewtopic.php?f=5&t=5159
http://www.adamdorman.com/rainmeter/1/6/

:bow:
You do not have the required permissions to view the files attached to this post.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: Calculating a sunrise/sunset pie chart on a 24 hour cloc

Post by moshi »

this also has twilight, but i guess you'll get the idea:
http://customize.org/rainmeter/skins/65672317
Paw4444
Posts: 3
Joined: July 31st, 2015, 10:30 am

Re: Calculating a sunrise/sunset pie chart on a 24 hour cloc

Post by Paw4444 »

Thank you! This is outstanding, I am looking into it as soon as I am off work. :bow:
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Calculating a sunrise/sunset pie chart on a 24 hour cloc

Post by Mordasius »

Here is an adaptation of Moshi's whip-cracking Daylight skin which adds an indication for times of the moon-rise and moon-set.
TimeDate.png
You do not have the required permissions to view the files attached to this post.
Last edited by Mordasius on July 31st, 2015, 12:47 pm, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Calculating a sunrise/sunset pie chart on a 24 hour cloc

Post by balala »

I also have a solution, please take a look: first of all, you should copy the [Variables], [MeasureYahooWeather], [MeasureSunRiseHour], [MeasureSunRiseMinute], [MeasureSunRiseAMPM], [MeasureSunSetHour], [MeasureSunSetMinute], [MeasureSunSetAMPM], [MeasureSunRise24Hour], [MeasureSunRise24HourText], [MeasureSunSet24Hour], [MeasureSunSet24HourText] sections from the SunRiseSet.ini. Then add a few measures, the background and three roundline meters, to show what you want. The whole code will look like:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
Location=
Unit=

[MeasureYahooWeather]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=1200
URL=http://weather.yahooapis.com/forecastrss?w=#Location#&u=#Unit#
RegExp="(?siU)<yweather:astronomy sunrise="(.*):(.*) ([A-Z]{2})".*sunset="(.*):(.*) ([A-Z]{2})".*"

[MeasureSunRiseHour]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=[MeasureYahooWeather]
StringIndex=1

[MeasureSunRiseMinute]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=[MeasureYahooWeather]
StringIndex=2

[MeasureSunRiseAMPM]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=[MeasureYahooWeather]
StringIndex=3
Substitute="am":"1","pm":"2"

[MeasureSunSetHour]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=[MeasureYahooWeather]
StringIndex=4

[MeasureSunSetMinute]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=[MeasureYahooWeather]
StringIndex=5

[MeasureSunSetAMPM]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=[MeasureYahooWeather]
StringIndex=6
Substitute="am":"1","pm":"2"

[MeasureSunRise24Hour]
Measure=Calc
Formula=(([MeasureSunRiseHour] * 60) + [MeasureSunRiseMinute])
DynamicVariables=1
MaxValue=720
MinValue=0

[MeasureSunRise24HourText]
Measure=Calc
Formula=(([MeasureSunRiseAMPM] > 1 ? ([MeasureSunRiseHour] + 12) : ([MeasureSunRiseHour])))
DynamicVariables=1
Substitute=".00000":""

[MeasureSunSet24Hour]
Measure=Calc
Formula=(([MeasureSunSetHour] * 60) + [MeasureSunSetMinute])
DynamicVariables=1
MaxValue=720
MinValue=0

[MeasureSunSet24HourText]
Measure=Calc
Formula=(([MeasureSunSetAMPM] > 1 ? ([MeasureSunSetHour] + 12) : ([MeasureSunSetHour])))
DynamicVariables=1
Substitute=".00000":""

[MeasureSunRisePercent]
Measure=Calc
Formula=( 3600 * MeasureSunRise24HourText + 60 * MeasureSunRiseMinute )
MinValue=0
MaxValue=86400

[MeasureSunSetPercent]
Measure=Calc
Formula=( 3600 * MeasureSunSet24HourText + 60 * MeasureSunSetMinute )
MinValue=0
MaxValue=86400

[MeasureDayLength]
Measure=Calc
Formula=( MeasureSunSetPercent - MeasureSunRisePercent )
MinValue=0
MaxValue=86400

[MeterBack]
Meter=IMAGE
X=0
Y=0
ImageName=#@#back200.png

[MeterDayPieChart]
Meter=Roundline
MeasureName=MeasureDayLength
X=0
Y=0
W=200
H=200
StartAngle=(6.283*([MeasureSunRisePercent]/86400-0.25))
RotationAngle=6.283
LineLength=75
LineColor=255,255,255,120
Solid=1
AntiAlias=1
DynamicVariables=1

[MeterSunRiseLine]
Meter=ROUNDLINE
MeasureName=MeasureSunRisePercent
X=0
Y=0
W=200
H=200
LineLength=75
LineColor=0,0,0
LineWidth=2
AntiAlias=1
StartAngle=4.7124
RotationAngle=6.2832

[MeterSunSetLine]
Meter=ROUNDLINE
MeasureName=MeasureSunSetPercent
X=0r
Y=0r
W=200
H=200
LineLength=75
LineColor=0,0,0
LineWidth=2
AntiAlias=1
StartAngle=4.7124
RotationAngle=6.2832
Before use, don't forget to add the Location and Unit variables.
You do not have the required permissions to view the files attached to this post.
Paw4444
Posts: 3
Joined: July 31st, 2015, 10:30 am

Re: Calculating a sunrise/sunset pie chart on a 24 hour cloc

Post by Paw4444 »

Thank you all for the responses.

Mordasius, do you maybe know where I could download this skin?
http://customize.org/rainmeter/skins/65671008 this looks amazing. Very neat! I might give it a try altering it for a smaller and simpler version.

balala your code worked perfectly. Thanks a ton!

Moshi, your clock skin looks truly amazing! Now that I have looked at it for a while I start to prefer this layout as the night is below.. which in fact looks more pleasant.
Still, is there an easy solution of making your clock use the other 24 hour layout where noon is on the bottom? EDIT: I figured it out, very nicely done :)

Thanks guys, this is of enormous help. I had a look at the code of both solutions and I feel my coding skills are sufficient to carry on from here.. hopefully :)
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Calculating a sunrise/sunset pie chart on a 24 hour cloc

Post by Mordasius »

Paw4444 wrote:Mordasius, do you maybe know where I could download this skin?
http://customize.org/rainmeter/skins/65671008
You can click on the [Download file] link just below the screenshot on customize.org or the [Download] link to the right of the screenshot on Deviant Art