It is currently April 23rd, 2024, 7:16 am

Scale of bar and line

Get help with creating, editing & fixing problems with skins
rxtd
Posts: 100
Joined: April 30th, 2017, 11:51 am

Scale of bar and line

Post by rxtd »

Hello!
I'm trying to write widget of net speed with line for the history of speed and bar for better indicating of current speed.
I'm really confused with scale.
When autoscale=0 the rest of the time I see only horizontal line on the bottom of widget and bar with zero length.
When autoscale is 1 it's (obviously) much better for line but bar doesn't have such option since it displays one value at a time. Also I want bar to indicate current value with the same height as line like on this picture:
2017-05-03_02-45-48.png
But you can guess that almost all the time I see something like this:
2017-05-02_07-26-39.png
And if I turn on autoscale on line it looks so:
2017-05-02_08-11-37.png
I think I should somehow manage scaling by myself for correcting both line and bar value but how can I do it?
I'va been thinking about creating several measures to fix max values at, for example, 4 segments of the graph and adjust max value of measure. But for me it sounds quite rough, and I'm not sure I will manage to do it, and, finally, I'm not sure that bar will be the exactly same height as line at the moment.
Any suggestions?
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16162
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Scale of bar and line

Post by balala »

First please post the code you have so far. It would be much simpler for us to help.
rxtd
Posts: 100
Joined: April 30th, 2017, 11:51 am

Re: Scale of bar and line

Post by rxtd »

I don't think it's about code. If I knew the method I would adapt it for any skin.
Well. Let's say I want to make this code work as I need.

Code: Select all

[MeasureCurrent]
Measure=NetIn

[BackgroundShape]
Meter=Shape
Shape=Rectangle 0,0,230,70| Fill Color 00000090 | StrokeWidth 0
UpdateDivider=-1

[MeterCurrentBarBar]
Meter=Bar
MeasureName=MeasureCurrent
X=10
Y=15
W=6
H=50
BarColor=F8E54E
BarOrientation=Vertical
SolidColor=00000090

[GraphBackgroundShape]
Meter=Shape
Shape=Rectangle 20,15,200,50 | Fill Color 00000090 | StrokeWidth 0
UpdateDivider=-1

[MeterGraph]
Meter=Line
MeasureName=MeasureCurrent
X=20
Y=15
W=200
H=50
LineColor=F8E54E
GraphStart=Left
AntiAlias=1
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Scale of bar and line

Post by eclectic-tech »

About 2 yrs ago, TGonzo wrote a lua script to get a measure's autoscale MaxValue... see this post.

Using his LUA script (saveas 'FindMaxHistValue1-2.lua' in the @Resources folder of your skin) the following mod of your code will adjust the MaxValue of the measure used in the bar meter, to match the autoscale MaxValue of the line meter. The bar will indicate the same height as the current line.

Code: Select all

[Variables]
HistogramWidth=200

[MeasureCurrent]
Measure=NetIn

[measureNetInMaxHist]
Measure=Script
ScriptFile=#@#/FindMaxHistValue1-2.lua
CurValue=[MeasureCurrent]
HistWidth=#HistogramWidth#
 
[MeasureBar]
Measure=Calc
Formula=MeasureCurrent
MinValue=0
MaxValue=[measureNetInMaxHist]
DynamicVariables=1

[BackgroundShape]
Meter=Shape
Shape=Rectangle 0,0,230,70| Fill Color 00000090 | StrokeWidth 0
UpdateDivider=-1

[MeterCurrentBarBar]
Meter=Bar
MeasureName=MeasureBar
X=10
Y=15
W=6
H=50
BarColor=F8E54E
BarOrientation=Vertical
SolidColor=00000090

[GraphBackgroundShape]
Meter=Shape
Shape=Rectangle 20,15,200,50 | Fill Color 00000090 | StrokeWidth 0
UpdateDivider=-1

[MeterGraph]
Meter=Line
MeasureName=MeasureCurrent
X=20
Y=15
W=200
H=50
LineColor=F8E54E
GraphStart=Left
AntiAlias=1
AutoScale=1
This is the only solution I have seen to find the max value used with autoscale... Hope this helps.
rxtd
Posts: 100
Joined: April 30th, 2017, 11:51 am

Re: Scale of bar and line

Post by rxtd »

I think it's exactly what I needed :)
Thank you!
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Scale of bar and line

Post by eclectic-tech »

Glad to help! :welcome: