It is currently March 29th, 2024, 6:36 am

HWInfo : Min/max values for Lines & Bars

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: HWInfo : Min/max values for Lines & Bars

Post by balala »

jsmorley wrote: May 3rd, 2019, 4:17 pm I don't think this is a problem with MinValue. I think it is a problem with the relationship between two or more lines/measures in the same Line meter.
Unfortunately this is a little bit wrong. Here is another code, using one single measure:

Code: Select all

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

[MeasureCalc2]
Measure=Calc
Formula=20
MinValue=20
MaxValue=120

[MeterLine]
Meter=Line
MeasureName=MeasureCalc2
W=300
H=100
LineCount=1
LineColor1=255,255,255,255
LineColor2=255,0,0,255
AutoScale=0
SolidColor=47,47,47,255
AntiAlias=1

[MeterPercent]
Meter=String
MeasureName=MeasureCalc2
Percentual=1
Y=5R
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=%1%
As you can see the Formula option of the [MeasureCalc2] measure is set to Formula=20. The MinValue is set to the same value: MinValue=20. But not having a second measure although the line should have to be set to 0, it is not:
Line.png
Now if I set the Formula to Formula=2 (so right above 0), the line is almost down, but not completely down:
Line4.png
even if this value is below the MinValue of the measure.
On the other hand if I set the Formula to 120 (Formula=120) (same as MaxValue), the Line meter is OK:
Line3.png
I still believe there is something goes wrong with the MinValue option. Always the default MinValue=0 is used, no matter what do you set.
You do not have the required permissions to view the files attached to this post.
User avatar
krakoukas
Posts: 71
Joined: December 11th, 2018, 5:56 pm
Location: France

Re: HWInfo : Min/max values for Lines & Bars

Post by krakoukas »

Hi Friends,

Thanks to god, Balala got it !!! Sorry for my bad English and my code with bunch of variables ;D
I was getting mad and feeling alone with these buggy meterlines with Min/Max values !

This code is also buggy (same code, without bunch of variables) :

Code: Select all

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

	[MeasureCPU-Temperature]
	Measure=Calc
	Formula=53
	MinValue=50
	MaxValue=90

	[MeterLine]
	Meter=Line
	LineCount=1
	LineColor=255,0,0,255
	MeasureName=MeasureCPU-Temperature
	X=1r
	Y=1r
	W=300
	H=50
	AntiAlias=1
	AutoScale=0
	SolidColor=47,47,47,255
	
	[MeterString]
	Meter=String
	MeasureName=MeasureCPU-Temperature
	NumOfDecimals=0
	X=r
	Y=10r
	MeterStyle=Style-Contenu
	Text=%1°C
The problem is not relationship between 2 lines in the same graphic. It happens even with only one.
Two days ago, I also thought I got the solution by isolating the 2 meterlines (they look so different, cpu-temperature & cpu-usage). Wrong...

As Balala explained, I guess there is a problem with Meterlines when MinValue is not set to ZERO
The problem is MinValue. Change MaxValue and the line is correct. Change MinValue, the line is wrong
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: HWInfo : Min/max values for Lines & Bars

Post by Mor3bane »

I resolved the issue (with help from another Forumite, to work effectively thus:

Code: Select all

[MeasureCPUTemp45To85]
Measure=Calc
Formula=Abs(MeasureCPUTemp-45) 
In this example, is wished to gauge the min value to be no less than 45...
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
krakoukas
Posts: 71
Joined: December 11th, 2018, 5:56 pm
Location: France

Re: HWInfo : Min/max values for Lines & Bars

Post by krakoukas »

Hi Mor3bane,
Thanks for helping Friend !

It doesn't have the expected behavior
This is a -45px translation. It doesn't scale linemeter.
I'm so lost :s
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: HWInfo : Min/max values for Lines & Bars

Post by eclectic-tech »

As balala demonstrated the line meter does not correctly use the MinValue setting of a measure as the zero value. The measure does return a correct percentage value which can be seen in a string meter bound to the measure, but a line meter bound to that same measure uses 0 as the baseline no matter what the MinValue of the measure is set to be.

An additional measure that calculates a percentage value can be used to provide a zero based percentage value for use in line meters (as a work around) until this is addressed. You can use either "Formula" in [MeasureCalcPercent]; if you use the percentage section variable, you need to use "DynamicVariables=1". That is not needed if you use the second "Formula" option.

Code: Select all

; Demonstrates the issue with line meters not recognizing a measures MminValue as the "zero value". 
; Using an additional measure to return 0~100 for use in line meters is a workaround

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

[Variables]
LowValue=1000
HighValue=2000
Range=(#HighValue#-#LowValue#)

; This measure returns the actual values and the correct percentual value for string meters. But that percentual value is not being detected correctly in line meters
[MeasureCalc]
Measure=Calc
Formula=Random
LowBound=#LowValue#
HighBound=#HighValue#
AverageSize=3
DynamicVariables=1
MinValue=#LowValue#
MaxValue=#HighValue#

; Returns a percentage (0~100) for any value in a range of numbers
[MeasureCalcPercent]
Measure=Calc
Formula=[MeasureCalc:%]
;Formula=((MeasureCalc-#LowValue#)/#Range#*100)
MinValue=0
MaxValue=100
DynamicVariables=1

[MeterLine]
Meter=Line
MeasureName=MeasureCalc
W=300
H=100
LineCount=1
LineColor1=255,255,255,255
LineColor2=255,0,0,255
AutoScale=0
SolidColor=47,47,47,255
AntiAlias=1

[MeterCalc]
Meter=String
MeasureName=MeasureCalc
Percentual=1
Y=5R
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=%1%

[MeterLinePercent]
Meter=Line
MeasureName=MeasureCalcPercent
X=r
Y=5R
W=300
H=100
LineCount=1
LineColor1=255,255,255,255
LineColor2=255,0,0,255
AutoScale=0
SolidColor=47,47,47,255
AntiAlias=1

[MeterPercent]
Meter=String
MeasureName=MeasureCalcPercent
Percentual=1
Y=5R
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=%1%
Here is a demo that shows the difference in line meter displays when using a non-zero MinValue measure (top meter) and using a measure that calculates a percent (0~100) value, of the non-zero MinValue measure, for use in line meters (bottom meter).
line2.gif
EDIT: JSMorley is on to something going on with Scale, because even the high values are being displayed in the top line meter, just not based on a 0~100 scale like the bottom meter shows. I am sure one of the code-jockeys will find the answer. The Bar meter seems to use the values correctly, but not the line meter.

Has anyone tested a histogram meter to see if it has the same issues? :???:
EDIT2: The histogram meter does not work if the bound measure does not return a percentual (0~100) value. So even though a measure may have Min/Max values, it appears the line meter and histogram meters are not using the percentual values of "non-zero MinValue" measures. The use of an additional measure to return a percentage value of measures is the simplest solution for now.
You do not have the required permissions to view the files attached to this post.
User avatar
krakoukas
Posts: 71
Joined: December 11th, 2018, 5:56 pm
Location: France

Re: HWInfo : Min/max values for Lines & Bars

Post by krakoukas »

eclectic-tech wrote: May 4th, 2019, 2:15 am The use of an additional measure to return a percentage value of measures is the simplest solution for now.
Works perfectly ! Thanks a lot all for helping !
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: HWInfo : Min/max values for Lines & Bars

Post by jsmorley »

The issues with the Line meter seem to be a result of how it was originally designed, in the earliest days of Rainmeter.

It is our view that this was written back when there was no "MinValue" on measures, and the "range" was always from 0 to some MaxValue. So MinValue is never taken into account in this meter as designed. This does mean that a non-zero MinValue can really throw things off for you.

What it does is find the largest MaxValue for all the measures that are bound to the meter. It uses the "range" from 0 to that MaxValue to set the "scale" of the meter, in order to ensure the largest value will be included in the meter.

It then plots the points and draws the lines based on the "value" of the measure(s) in this context. The "percentage" of the measured values are not a explicit consideration.

In a sense, the "percentage" is implied if you have just one line, or two or more lines with zero MinValue and the same MaxValue, as the "scale" of the meter will have been set by the MaxValue, so whatever "value" is used will in effect position the point / line consistent with the percentage the value is of the MaxValue.


I have to say, I'm not a fan of this meter. Even at its best behavior, it is plotting points in an area that has no frame of reference. It doesn't mean anything, other than an indication of the direction, and to some extent the relative amount, of "change" in the value from one update to the next. Meh.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: HWInfo : Min/max values for Lines & Bars

Post by balala »

The Histogram meter is even stranger. If the MinValue of the measure is set to any other value then 0, the associated Histogram meter doesn't even work.
For example the example code on Histogram meter's help page:

Code: Select all

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

[Metadata]
Name=ExampleMeterHistogram
Author=The Rainmeter Team
Information=Example of the Histogram meter
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Version=1.0

[MeasureCPU]
Measure=CPU

[MeterCPUBackgroundImage]
Meter=Image
SolidColor=24,102,10
X=0
Y=0
W=220
H=70

[MeterCPUHistogram]
Meter=Histogram
MeasureName=MeasureCPU
X=5
Y=5
W=210
H=60
PrimaryColor=255,255,255,255
SolidColor=0,0,0,100
AntiAlias=1

[MeterCPUText]
Meter=String
MeasureName=MeasureCPU
X=110
Y=10R
FontSize=13
FontColor=255,255,255,255
StringAlign=Center
AntiAlias=1
Text=CPU Usage: %1%
works well. If I replace the [MeasureCPU] measure with a Calc measure and set the MinValue to 0, it is Ok:

Code: Select all

[MeasureCPU]
Measure=Calc
Formula=70
MinValue=0
MaxValue=120
But the meter doesn't even is shown if I use any other value then 0 for MinValue.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: HWInfo : Min/max values for Lines & Bars

Post by eclectic-tech »

The best solution is to always use a Calc measure that returns a percentage (0~100) as the measure that is bound to Line or Histogram meters whenever the desired measure has a non-zero MinValue.

In the example below [MeasureCalcPercent], the first Formula uses Section Variables; this is the recommended method.

Optionally, a second Formula calculation can be used simply by replacing the #LowValue# with the MinValue of the non-zero measure and replace #Range# with the measures MaxValue minus MinValue.

Code: Select all

[Variables]
LowValue=1000
HighValue=2000
Range=(#HighValue#-#LowValue#)

; This measure returns the actual values and the correct percentual value for string meters. 
; But that percentual value is not being detected correctly in Line/Histogram meters.
[MeasureCalc]
Measure=Calc
Formula=Random
LowBound=#LowValue#
HighBound=#HighValue#
AverageSize=3
DynamicVariables=1
MinValue=#LowValue#
MaxValue=#HighValue#

; Use this additional measure to calculation a percentage based on the non-zero MinValue measure
; Returns a percentage (0~100) for any value in a range of numbers
[MeasureCalcPercent]
Measure=Calc
Formula=[MeasureCalc:%]
;Formula=((MeasureCalc-#LowValue#)/#Range#*100)
MinValue=0
MaxValue=100
DynamicVariables=1

BTW, TGonZo did write a Lua script that returns the Max value used to scale which should make Histogram and Line meters more meaningful. You can find it here: https://forum.rainmeter.net/viewtopic.php?f=14&t=20915#p112978