It is currently April 19th, 2024, 1:53 pm

Chart - data collection, labels

Get help with creating, editing & fixing problems with skins
User avatar
Pflosch
Posts: 39
Joined: May 24th, 2020, 7:04 am
Location: Switzerland

Chart - data collection, labels

Post by Pflosch »

I am trying to make a chart for relative humidity. 1 data point every 3h, showing 5 days.
it doesn't need to update dynamically, only when I click a button the meter has to show the data for "the last 5 days"
I am facing 3 problems, the first I can "halfway" solve, but am not too happy about my "solution".

Keeping the existing data, also when computer is off or skin is refreshed:
- I managed to write keyValues in an .inc file every 3h, and write zeroes if data points are missing.
Therefore I now have an .inc file, always containing the dataset which has to be displayed.
I don't think this is elegant, but at least it has the correct data.

QUESTION:
a) Is there any simpler way to do this?

How to display it:
- I cannot find any way to display it :confused:
- Histogram and Line seem to only read from measures. (Maybe read the variables with a loop measure and feed that to the histogram?)
- I do not see a way to "label" the x-axis dynamically (i.e. with the date/time the values correspond to).

QUESTIONS:
b) Is there a way to feed a list of variables to display to "line" or to "histogram" on meter refresh?
c) Is there a way to dynamically label x axis on a chart?

I hope that's understandable... sorry for my "English"
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Chart - data collection, labels

Post by balala »

Since you still didn't get a reply, I'm asking you to post the code you have so far. Probably would be much easier to help, if we'd know your code.
User avatar
Pflosch
Posts: 39
Joined: May 24th, 2020, 7:04 am
Location: Switzerland

Re: Chart - data collection, labels

Post by Pflosch »

Thanks balala,

Regarding the the data acquisition, I have code which mostly works, so no fix needed there, I can handle this.
Some measures write, push around and delete my humidity values (from a "webparser") in an .inc file.
This file is constantly storing the the last 40 values, the last sample timestamp, as well as the sample interval in seconds.
The question a) was just whether there is any simpler way to realize a non-volatile "FIFO" storage in Rainmeter?

Questions b) and c) are basically, how do I get these values on a chart??? I didn't start with that yet, so I can't post any code:/
I want to click a button, which shows the meter("Line" or "Histogram" I guess), and loads the variables from a.m. file (only once, no need to update the meter), but have no clue how to do it.

So far the "best" I could come up with:
- Have a "Loop" measure to read the individual values from the .inc file, then tie this measure to a "Line" meter, which would in this case display 40 points and then stop., just keep the picture static.
- Label x-axis (time/date) dynamically with "String" meters (using the current time and a multiple of the sample interval to work out the corresponding time)

So... I do not need a fix on some code, but a hint on a concept.
Just wanted to hear from sb experienced, whether there is a more elegant less barbaric way to do these two tasks, before I dig into it.
I think maybe no problem.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Chart - data collection, labels

Post by balala »

Pflosch wrote: June 23rd, 2022, 12:42 pm The question a) was just whether there is any simpler way to realize a non-volatile "FIFO" storage in Rainmeter?
Have no idea if I don't see how exactly have you implemented your solution. If there is any simpler or even just another way, can't be answered if I don't know what you have so far...
Pflosch wrote: June 23rd, 2022, 12:42 pm Questions b)
Here you have an example:

Code: Select all

[Variables]
Var0=13
Var1=11
Var2=12
Var3=14
Var4=7
Var5=15
Var6=11
Var7=14
Var8=6
Var9=18
Var10=4

[StringStyle]
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
AntiAlias=1
Group=Values

[MeasureStep]
Measure=Calc
Formula=( MeasureStep + 1 )
UpdateDivider=-1
Group=Val

[MeasureNum]
Measure=Loop
StartValue=0
EndValue=10
Increment=1
LoopCount=0
UpdateDivider=-1
Group=Val

[MeasureVal]
Measure=Calc
Formula=[#Var[&MeasureNum]]
MinValue=0
MaxValue=20
DynamicVariables=1
Group=Val

[MeterValLine]
Meter=Line
MeasureName=MeasureVal
X=5
Y=5
W=210
H=70
LineCount=2
LineColor=140,252,124,255
SolidColor=0,0,0,255
AntiAlias=1
UpdateDivider=-1
LeftMouseUpAction=[!UpdateMeasureGroup "Val"][!UpdateMeterGroup "Values"][!Redraw]
Group=Values

[MeterValue]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureStep
MeasureName2=MeasureNum
MeasureName3=MeasureVal
X=5
Y=5
StringAlign=LEFT
Text=Step: %1#CRLF#Num: %2#CRLF#Val: %3
Note that in your case there are 40 variables instead of the here used 11 and those variables are stored into an included .inc file (if I'm not mistaken). This doesn't really matter as far as you want to only see a way to implement what you need.
The VarX variables have been generated to have values between 0 and 20, these have to be set through the MinValue and MaxValue options of the [MeasureVal] measure, to get the Line meter properly working.
Pflosch wrote: June 23rd, 2022, 12:42 pm and c)
An extended example:

Code: Select all

[Rainmeter]
Update=1000
SkinWidth=250

[Variables]
Var0=13
Var1=11
Var2=12
Var3=14
Var4=7
Var5=15
Var6=11
Var7=14
Var8=6
Var9=18
Var10=4

[StringStyle]
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
AntiAlias=1
Group=Values

[MeasureStep]
Measure=Calc
Formula=( MeasureStep + 1 )
UpdateDivider=-1
Group=Val

[MeasureNum]
Measure=Loop
StartValue=0
EndValue=10
Increment=1
LoopCount=0
UpdateDivider=-1
Group=Val

[MeasureVal]
Measure=Calc
Formula=[#Var[&MeasureNum]]
MinValue=0
MaxValue=20
DynamicVariables=1
Group=Val

[MeterValLine]
Meter=Line
MeasureName=MeasureVal
X=5
Y=5
W=210
H=70
LineCount=2
LineColor=140,252,124,255
SolidColor=0,0,0,255
AntiAlias=1
UpdateDivider=-1
LeftMouseUpAction=[!UpdateMeasureGroup "Val"][!UpdateMeterGroup "Values"][!Redraw]
Group=Values

[MeterStart]
Meter=STRING
MeterStyle=StringStyle
X=([MeterValLine:XW]-[MeasureStep])
Y=5R
StringAlign=CENTER
Text=Start
DynamicVariables=1

[MeterValue]
Meter=STRING
MeterStyle=StringStyle
MeasureName=MeasureStep
MeasureName2=MeasureNum
MeasureName3=MeasureVal
X=5
Y=5
StringAlign=LEFT
Text=Step: %1#CRLF#Num: %2#CRLF#Val: %3
I don't know if this at least looks like what you want. Does it?
User avatar
Pflosch
Posts: 39
Joined: May 24th, 2020, 7:04 am
Location: Switzerland

Re: Chart - data collection, labels

Post by Pflosch »

Hi balala,

Wow, I didn't expect you to do half the job for me O.O
Yes, that answers my questions, and even helps me a lot for the implementation.

You basically confirmed, for question b) and c) what I thought and chose a similar approach.
I like the way u use the Measure Group, will try to do it similar.

Thanx you very many. YMMD. :bow:
I think maybe no problem.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Chart - data collection, labels

Post by balala »

Pflosch wrote: June 24th, 2022, 11:04 am Yes, that answers my questions, and even helps me a lot for the implementation.

You basically confirmed, for question b) and c) what I thought and chose a similar approach.
Well, in your case, the solution could be much more complicated than this I think. But without your code, I can't help more, because there might be thousands of thing which would alter the result. If you can't figure out a solution, post please a code for further help.