It is currently March 28th, 2024, 12:52 pm

Using a Line graph with Measure=PhysicalMemory

Get help with creating, editing & fixing problems with skins
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am
Contact:

Using a Line graph with Measure=PhysicalMemory

Post by Mor3bane »

Hello,

I would like to have control on how a line graph is displayed, but I am lost.

I have a display area of 100px high, and would like the line graph to show within that space the relative value of 0% to 100% of phys ram used.

Example: Line is higher when more memory is being used, and lower when less is used.

Is that possible with Meter=Line?

Code: Select all

[MeasureRAM]
Measure=PhysicalMemory

[RAMUsageLine]
Meter=Line
MeasureName=MeasureRAM
X=0
Y=1
H=100
W=912
LineCount=1
LineWidth=3
LineColor=255,205,155,255
AntiAlias=1
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am
Contact:

Re: Using a Line graph with Measure=PhysicalMemory

Post by Mor3bane »

Ok, I may be looking for more of a way to magnify the variation rather than simply show it, since I know that my question was based on relative position rather than percentual position. Mostly because the variation on my rig is not that much and rests between 5 and 6 of a total of 12 gigs of physical memory that are being used at any average time.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am
Contact:

Re: Using a Line graph with Measure=PhysicalMemory

Post by Mor3bane »

Sorry, I do not think I am being clear, and have also come to a realisation. There is a really cool way for this to happen, and instead of asking how, I will just give the example, and leave it here for now whilst I tinker away.
Untitled.jpg
example image

Code: Select all

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

[Variables]
inusage=Val7
outusage=Val8
batt=MeasureBattery
incurrent=0
intotal=0
outcurrent=0
outtotal=0
BS=Not Working, you broke something!
BatteryBarColor=255,255,255,255
NetUC=255,255,255,255
NetDC=255,255,255,255
avg=64
b=256
c=1

[TextStyle]
FontFace=Segoe UI
;Courier New
;LCD
;Poiret One
;Segoe UI
FontSize=14
FontColor=255,255,255,255
AntiAlias=1

[TextStyle1]
FontFace=Segoe UI
;Courier New
;LCD
;Poiret One
;Segoe UI
FontSize=14
FontColor=255,255,255,255
AntiAlias=1
StringStyle=Bold

[AllStyle]
FontSize=14
FontWeight=100
FontColor=255,255,255,255
AntiAlias=1
DynamicVariables=1

[RightStyle]
StringAlign=Right

[]
;Measures

[MeasureNetIn]
Measure=NetIn
;DynamicVariables=1
;AverageSize=#avg#
updatedivider=10

[MeasureNetOut]
Measure=NetOut
;DynamicVariables=1
;AverageSize=#avg#
updatedivider=10

[MeasureNetInC]
Measure=NetIn
Cumulative=1

[MeasureNetOutC]
Measure=NetOut
Cumulative=1

;Calculations
[ValK]
updatedivider=-1
Measure=Calc
Formula=2048

[ValIn]
Measure=Calc
DynamicVariables=1
AverageSize=#avg#
Formula=MeasureNetIn/1.05

[MeasureIN]
Measure=Calc
Formula=ValK > [ValIn] ? 0 : ValIn
AverageSize=#avg#
DynamicVariables=1
IfAboveValue=10241
IfAboveAction=!SetVariable NetDC 100,255,100,255
IfBelowValue=10240
IfBelowAction=!SetVariable NetDC 255,255,255,255

[ValOut]
Measure=Calc
DynamicVariables=1
AverageSize=#avg#
Formula=MeasureNetOut/1.05

[MeasureNetInCumulative]
Measure=Calc
Formula=MeasureNetInC/6

[MeasureNetOutCumulative]
Measure=Calc
Formula=MeasureNetOutC/6

[MeasureOUT]
Measure=Calc
Formula=ValK > [ValOut] ? 0 : ValOut
DynamicVariables=1
AverageSize=#avg#
IfAboveValue=10241
IfAboveAction=!SetVariable NetUC 100,100,255,255
IfBelowValue=10240
IfBelowAction=!SetVariable NetUC 255,255,255,255

[MeasureIN2]
Measure=Calc
Formula=MeasureIN
DynamicVariables=1
AverageSize=#avg#

[MeasureOUT2]
Measure=Calc
Formula=MeasureOUT
DynamicVariables=1
AverageSize=#avg#

[Val5]
updatedivider=-1
Measure=Calc
Formula=0

[Val6]
updatedivider=-1
Measure=Calc
Formula=1

[Val7]
Measure=Calc
Formula=MeasureNetInCumulative

[Val8]
Measure=Calc
Formula=MeasureNetOutCumulative

[MeasureNetInSession]
Measure=Calc
DynamicVariables=1
Formula=#inusage#-#incurrent#

[MeasureNetOutSession]
Measure=Calc
DynamicVariables=1
Formula=#outusage#-#outcurrent#

[MeasureNetInTotal]
Measure=Calc
DynamicVariables=1
Formula=#inusage#-#intotal#

[MeasureNetOutTotal]
Measure=Calc
DynamicVariables=1
Formula=#outusage#-#outtotal#

;Meters
;
[MeterTextSpeed]
UpdateDivider=-1
Meter=String
X=1115
Y=-3
MeterStyle=TextStyle1
StringAlign=right
Text="Speed"

[MeterTextData]
UpdateDivider=-1
Meter=String
X=1285
Y=-3
MeterStyle=TextStyle1
StringAlign=left
Text="Data"

[MeterTextSession]
UpdateDivider=-1
Meter=String
X=1165
Y=-3
MeterStyle=TextStyle1
StringAlign=left
Text="Session"

[MeterTextUP]
Meter=String
X=922
Y=20
StringAlign=left
Text="UP"
FontColor=#NetUC#
DynamicVariables=1
FontSize=14
FontColor=255,255,255,255
AntiAlias=1
StringStyle=Bold

[MeterTextDN]
Meter=String
X=922
Y=40
StringAlign=left
Text="DN"
FontColor=#NetDC#
DynamicVariables=1
FontSize=14
FontColor=255,255,255,255
AntiAlias=1
StringStyle=Bold

[UpSpeed]
Meter=String
updatedivider=1
MeasureName=MeasureOUT2
X=1145
Y=17
StringAlign=right
MeterStyle=TextStyle
NumOfDecimals=2
AutoScale=1
Text="%1Bps"

[UpData]
Meter=String
updatedivider=10
MeasureName=MeasureNetOutTotal
X=1365
Y=17
MeterStyle=TextStyle
StringAlign=right
NumOfDecimals=2
AutoScale=1
Text=%1B

[UpSession]
updatedivider=1
Meter=String
MeasureName=MeasureNetOutSession
X=1255
Y=17
MeterStyle=TextStyle
StringAlign=right
NumOfDecimals=2
AutoScale=1
Text=%1B

[DnSpeed]
Meter=String
updatedivider=1
MeasureName=MeasureIN2
X=1145
Y=37
StringAlign=right
MeterStyle=TextStyle
NumOfDecimals=2
AutoScale=1
Text="%1Bps"

[DnData]
Meter=String
updatedivider=10
MeasureName=MeasureNetInTotal
X=1365
Y=37
MeterStyle=TextStyle
StringAlign=right
NumOfDecimals=2
AutoScale=1
Text=%1B

[DnSession]
updatedivider=1
Meter=String
MeasureName=MeasureNetInSession
X=1255
Y=37
MeterStyle=TextStyle
StringAlign=right
NumOfDecimals=2
AutoScale=1
Text=%1B

[MeterImageUP]
Meter=Image
W=105
H=20
X=921
Y=20
DynamicVariables=1
LeftMouseUpAction=!RainmeterSetVariable avg ((#avg#+10)>#b#?#b#:(#avg#+#avg#))
SolidColor=255,255,255,1

[MeterImageDN]
Meter=Image
W=105
H=20
X=921
Y=40
DynamicVariables=1
LeftMouseUpAction=!RainmeterSetVariable avg ((#avg#/2)<1?#c#:(#avg#/2))
SolidColor=255,255,255,1

;Lines
[Netline]
Meter=Line
MeasureName=MeasureIN2
MeasureName2=MeasureOUT2
X=0
Y=1
H=100
W=912
LineColor=75,255,75,255
LineColor2=75,75,255,255
LineCount=2
Autoscale=1
LineWidth=4
AntiAlias=1

[BottomLine]
UpdateDivider=-1
Meter=Line
MeasureName2=Val5
X=0
Y=100
H=1
W=1366
LineColor=255,255,255,255

[TopLine]
UpdateDivider=-1
Meter=Line
MeasureName=Val5
X=0
Y=0
H=1
W=1366
LineColor=255,255,255,255

[Line1]
UpdateDivider=-1
Meter=Line
MeasureName=Val5
X=911
Y=-79
H=100
W=466
LineColor=255,255,255,255

[Line2]
UpdateDivider=-1
Meter=Line
MeasureName=Val5
X=911
Y=-59
H=100
W=466
LineColor=255,255,255,255

[Line3]
UpdateDivider=-1
Meter=Line
MeasureName=Val5
X=911
Y=-39
H=100
W=466
LineWidth=2
LineColor=255,255,255,255

[Line4]
UpdateDivider=-1
Meter=Line
MeasureName=Val5
X=911
Y=-19
H=100
W=466
LineColor=255,255,255,255

[Bar1]
UpdateDivider=-1
Meter=bar
MeasureName=Val6
BarOrientation=Vertical
BarColor=255,255,255,255
H=100
W=1
X=1025
Y=1

[Bar2]
UpdateDivider=-1
Meter=bar
MeasureName=Val6
BarOrientation=Vertical
BarColor=255,255,255,255
H=100
W=1
X=1150
Y=1

[Bar3]
UpdateDivider=-1
Meter=bar
MeasureName=Val6
BarOrientation=Vertical
BarColor=255,255,255,255
H=100
W=1
X=1260
Y=1

[Bar4]
UpdateDivider=-1
Meter=bar
MeasureName=Val6
BarOrientation=Vertical
BarColor=255,255,255,255
H=100
W=1
X=911
Y=1

[Bar5]
UpdateDivider=-1
Meter=bar
MeasureName=Val6
BarOrientation=Vertical
BarColor=255,255,255,255
H=100
W=1
X=920
Y=1
If it can be done for Net in , shouldn't it be possible for temp or memory etc? in the line meter above you can see that the net values are negligible, so why not do the same thing for temperature and memory?

SHould I be trying this or is the difference not entirely obvious to me?

Until someone says different, I am going to try this... 8-)

(by the way I was running then closed a big game program, as visualised in the lower memory line graph - so temps etc were from a cooling-down cpu & gpu...
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5380
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: Using a Line graph with Measure=PhysicalMemory

Post by eclectic-tech »

You could look at using TransformationMatrix to magnify the line meter as described here by moshi...
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am
Contact:

Re: Using a Line graph with Measure=PhysicalMemory

Post by Mor3bane »

I have had a whack at trying to represent the cpu usage with the output wishfully hoped for to appear as the Net UP & DN measures in the top two skins represented in the image.

a) as 'net in' for example can appear as a jagged tightly compressed, or an angular less tightly compressed line meter - according to my capabilities with transformation matrix

or

b) it can look like the smooth sine wave looking line meter shown above in the image

That is the effect I am trying to achieve with cpu usage - a sine wave-looking smoothed out version.

I do not understand how transformation matrix will change a) to look like b)

I tried to implement the basic code I extracted from the main code from the skin I am modifying - and wound up with nothing short of zero accomplishment in getting a b) output line meter.

Any help would be appreciated.

EDIT:
This is the extracted code I found to appear useful, but I ain't thinkin' I have everything I need to have:-

Code: Select all

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

[Variables]
incurrent=0
intotal=0
NetDC=255,255,255,255
avg=64

;====================================Measures=======================

[MeasureCPU]
Measure=Plugin
Plugin=UsageMonitor
Alias=CPU
Index=0

[MeasureCPU1]
Measure=Calc
Formula=MeasureCPU
MaxValue=100
DynamicVariables=1
AverageSize=5

[MeasureCPU2]
Measure=Calc
Formula=MeasureCPU1
MaxValue=100
DynamicVariables=1
AverageSize=5

[MeasureCpuSpeed]
Measure=Plugin
Plugin=CoreTemp
CoreTempType=CpuSpeed
AverageSize=#avg#
DynamicVariables=1

[MeasureNetIn]
Measure=NetIn
updatedivider=10

;==================================Calculations=====================
[ValKb]
updatedivider=-1
Measure=Calc
Formula=100

[ValIn]
Measure=Calc
DynamicVariables=1
AverageSize=#avg#
Formula=MeasureNetIn/1.05

[MeasureIN]
Measure=Calc
Formula=ValKb > [ValIn] ? 0 : ValIn
AverageSize=#avg#
DynamicVariables=1

[MeasureIN2]
Measure=Calc
Formula=MeasureIN
DynamicVariables=1
AverageSize=#avg#

[Val5]
updatedivider=-1
Measure=Calc
Formula=0

[Val6]
updatedivider=-1
Measure=Calc
Formula=1

;================================================Lines==============

[GPUUsageLine]
Meter=Line
MeasureName=MeasureCPU2
averagesize=1
X=0
Y=1
H=100
W=912
LineCount=1
LineWidth=2
LineColor=55,55,255
AntiAlias=1

[Netline]
Meter=Line
MeasureName=MeasureIN2
X=0
Y=1
H=100
W=912
LineColor=75,255,75,255
LineCount=2
Autoscale=1
LineWidth=2
AntiAlias=1

;======================================Text Meters==================

[TextStyle]
FontFace=Segoe UI
FontSize=14
FontColor=255,255,255,255
AntiAlias=1

[AllStyle]
FontSize=14
FontWeight=100
FontColor=255,255,255,255
AntiAlias=1
DynamicVariables=1

[MeterGPU]
Meter=String
MeasureName=MeasureCPU
NumOfDecimals=2
FontColor=55,55,255
FontFace=Segoe UI
UpdateDivider=10
StringAlign=right
FontSize=20
X=1365
Y=0
AntiAlias=1
Text=%1

[MeterTextDN]
Meter=String
X=922
Y=40
StringAlign=left
Text="DN"
DynamicVariables=1
FontSize=14
FontColor=55,255,55
AntiAlias=1
StringStyle=Bold

[DnSpeed]
Meter=String
updatedivider=1
MeasureName=MeasureIN2
X=1145
Y=37
FontColor=55,255,55
StringAlign=right
MeterStyle=TextStyle
NumOfDecimals=2
AutoScale=1
Text="%1Bps"

[MeterImageClick]
Meter=Image
W=105
H=60
X=921
Y=20
DynamicVariables=1
LeftMouseUpAction=[!Refresh]
SolidColor=0,0,0,1

;=========================================Boxes=====================
[BottomLine]
UpdateDivider=-1
Meter=Line
MeasureName2=Val5
X=0
Y=100
H=1
W=1366
LineColor=255,255,255,255

[TopLine]
UpdateDivider=-1
Meter=Line
MeasureName=Val5
X=0
Y=0
H=1
W=1366
LineColor=255,255,255,255

[Line2]
UpdateDivider=-1
Meter=Line
MeasureName=Val5
X=911
Y=-59
H=100
W=466
LineColor=255,255,255,255

[Line3]
UpdateDivider=-1
Meter=Line
MeasureName=Val5
X=911
Y=-39
H=100
W=466
LineWidth=2
LineColor=255,255,255,255

[Line4]
UpdateDivider=-1
Meter=Line
MeasureName=Val5
X=911
Y=-19
H=100
W=466
LineColor=255,255,255,255

[Bar1]
UpdateDivider=-1
Meter=bar
MeasureName=Val6
BarOrientation=Vertical
BarColor=255,255,255,255
H=100
W=1
X=1025
Y=1

[Bar4]
UpdateDivider=-1
Meter=bar
MeasureName=Val6
BarOrientation=Vertical
BarColor=255,255,255,255
H=100
W=1
X=911
Y=1

User avatar
Yincognito
Rainmeter Sage
Posts: 7018
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Using a Line graph with Measure=PhysicalMemory

Post by Yincognito »

The sinusoidal style of the line has NOTHING to do with TransformationMatrix, Mor3bane. It has to do with the 3 consecutive Calc measures that "round" the line by averaging the last 64 values of the previous measure. So what you have now for, say, NetOut, is something like this:

Code: Select all

[MeasureOut]
Measure=NetOut

[MeasureAverageLast64Values1]
Measure=Calc
Formula=MeasureOut
AverageSize=64

[MeasureAverageLast64Values2]
Measure=Calc
Formula=MeasureAverageLast64Values1
AverageSize=64

[MeasureAverageLast64Values3]
Measure=Calc
Formula=MeasureAverageLast64Values2
AverageSize=64
What happens here is that the last 64 values of MeasureOut are averaged, then the last 64 values of that average is again averaged and finally the last 64 values of the previous average are...you guessed it, again averaged. In practice, this makes the line have that nice sinusoidal look. The 64 value that configures how many of the last values will be averaged doesn't mean anything, it could be 10, 20 or whatever. Thing is, the bigger the value, the more "round" will the line look. You can try and change the avg variable in your code to a smaller value and see for your self, the line will be less "rounded", less "sinusoidal looking".

Now, things will work just fine for PhysicalMemory too, but here's the catch: while NetOut has a lot of values that can be averaged (since the network traffic is almost continuous), a PhysicalMemory measure will "jump" straight from 0 to the actual value of the memory used or whatever stuff you want to measure with it, and stay at the latter value until the memory used increase or decrease (that will happen eventually, but it will be after a LONG time). What this means in practice is that the following Calc measures that average the last N values of the preceding measures will have MUCH LESS of different values to average in order to make the line sinusoidal looking. For a long time they will have only 0 and the first value of the memory used, since that value changes at a much slower rate than the value of a NetOut measure.

So what is the solution to this, you may ask? Well, there are 2 workarounds, but none of them is perfect and each of them has disadvantages:
- SOLUTION 1: decrease the value of the avg variable, from 64 to less than that. That will get the last N values to be averaged faster ... although it won't "round" the line as much as if the avg value was higher
- SOLUTION 2: wait for the memory used values to change. While this will make the line just as "round" as in the case of NetOut, it will, as I said, take a LONG time until you notice it ... and, of course, you will never get a sinusoidal look for initial values of the memory used (i.e. when the value "jumps" from 0 to the actual value of the memory used), only for subsequent values. The latter disadvantage is minor though, as that 0 to x "jump" will eventually go "off screen", if you wait a little bit:
Sinusoidal Graph Lines.jpg
This was after I used Chrome for a while and then closed it. Since it takes a lot of RAM when used for longer, the difference is noticeable when the its process (or better said, processes) is closed. You can try the same to "speed up" the process of creating the sinusoidal look for the physical memory.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am
Contact:

Re: Using a Line graph with Measure=PhysicalMemory

Post by Mor3bane »

EDIT: Oooh! I get it! Developing aesthetics now - humbly.


Thanks yincognito

That is an amazing explanation!

The sinusoidal curve in the UP and DN skin is not the query I am trying to suss out.

Rather it was to implement that process at least similarly in a memory skin and even a gpu temperature sinusoidal skin!

Knowing that math-ish type of code will certainly help me get my two skins looking sweet.

So I will get to asking for more assistance:
My rig is huge and the demand on the cpu and gpu match that proportion.

So, I want to do the sinusoidal gpu temp. What would those 3 equations look like if i restrict the range from 45 to 85 celsius allowing for a more sensitive line, e.g. showin a 1 degree variance as averaged between the 100 px high skin base?

I hope from there I will have a better idea of what needed code I will need to do it myself for the other sys monitors.


Cheers,
Mor
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am
Contact:

Re: Using a Line graph with Measure=PhysicalMemory

Post by Mor3bane »

Hi Guys,

So the sinusoidal curve is working. However, I would like to try to add more "height" to the cpu usage sinusoidal curve - essentially making the curves spread out higher on the Y plane.

Is this where TransformationMatrix comes in? Simply adding the parameter in the line meter breaks the skin with 0;0;0;0;0;0 let alone a value in the d position for scale on the Y plane which does not seem to work.

Any help on this aesthetic would be appreciated.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5380
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: Using a Line graph with Measure=PhysicalMemory

Post by eclectic-tech »

Mor3bane wrote: February 7th, 2019, 4:05 pm Hi Guys,

So the sinusoidal curve is working. However, I would like to try to add more "height" to the cpu usage sinusoidal curve - essentially making the curves spread out higher on the Y plane.

Is this where TransformationMatrix comes in? Simply adding the parameter in the line meter breaks the skin with 0;0;0;0;0;0 let alone a value in the d position for scale on the Y plane which does not seem to work.

Any help on this aesthetic would be appreciated.
Well, I missed the point of what you wanted :oops: , however, Vastex Yincognito got it, and explained that averaging is how to accomplish it.

I will add that the default (no change) TransformationMatrix formula is : 1;0;0;1;0;0

However, this is not going to be useful in setting the range for Y that you want.
You can transform the meter, but not change values used in the graph.

For that, the MinValue & MaxValue settings in your measure will effect percentage value of the line graph.
User avatar
Yincognito
Rainmeter Sage
Posts: 7018
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Using a Line graph with Measure=PhysicalMemory

Post by Yincognito »

eclectic-tech wrote: February 7th, 2019, 4:52 pmWell, I missed the point of what you wanted :oops: , however, Vastex got it, and explained that averaging is how to accomplish it.
Who's VasTex?! :???:
eclectic-tech wrote: February 7th, 2019, 4:52 pmFor that, the MinValue & MaxValue settings in your measure will effect percentage value of the line graph.
Indeed - I was just trying something along the lines. Also subtracting 45 from the measured temperature (along with setting the appropriate limits on the last Calc measure) would help if 45 is going to be the lowest limit. At least that's what I think - I may be missing something, but my test implementation doesn't yet work as I envision, despite the logic being correct.
Post Reply