Hi, I'm new here so sorry if the question seems dumb.
I am trying to use Rainmeter to plot data from an excel file as a line meter. I can access individual data points through the .xml file and the webparser plugin. However, I am unsure how to produce a measure with numerous data points so that a line meter can be plotted with it.
Is there any relatively simple (I'd rather not use LUA, C++ or C# to code a measure) way to do this?
It is currently April 26th, 2024, 5:13 am
Plotting a line meter with a custom data set
-
- Posts: 6
- Joined: December 12th, 2018, 3:46 pm
-
- Rainmeter Sage
- Posts: 16172
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Plotting a line meter with a custom data set
There are no "dumb" questions. Don't worry we're here to help, whenever we can.
A measure can have one single data. It can change, but it's one single.
The code you have so far would be great, along with an example .xml file.
-
- Posts: 6
- Joined: December 12th, 2018, 3:46 pm
Re: Plotting a line meter with a custom data set
The following is a simplification of the setup.
The xml file is of the form (saved as Test.xml):
I then read the data with the a skin which basically consists of the following (Test.xml is the .xml file):
My question really relates to how I can get the data in a form so that a line meter can be produced, plotting the y axis as the values obtained from the .xml file and the x axis as any arbitrary scale (e.g. MeasureValue1 at x=1, MeasureValue2 at x=2 etc.).
I have literally no clue where to start with this so sorry if I can't provide much insight (the code snippets are no help at all - there aren't even any meters).
The xml file is of the form (saved as Test.xml):
Code: Select all
<item>
<value>1</value>
</item>
<item>
<value>2</value>
</item>
<item>
<value>3</value>
</item>
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[MeasureReadXML]
Measure=Plugin
Plugin=WebParser
URL=file://#CURRENTPATH#Test.xml
RegExp=(?siU)<value>(.*)</value>.*<value>(.*)</value>.*<value>(.*)</value>.*
[MeasureValue1]
Measure=Plugin
Plugin=WebParser
URL=[MeasureReadXML]
StringIndex=1
[MeasureValue2]
Measure=Plugin
Plugin=WebParser
URL=[MeasureReadXML]
StringIndex=2
[MeasureValue3]
Measure=Plugin
Plugin=WebParser
URL=[MeasureReadXML]
StringIndex=3
I have literally no clue where to start with this so sorry if I can't provide much insight (the code snippets are no help at all - there aren't even any meters).
-
- Rainmeter Sage
- Posts: 16172
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Plotting a line meter with a custom data set
You need a Count variable, which will be cycled when you want to show up the values returned by the WebParser measures, into a Line meter. You also need a Calc measure, which will return the value of the appropriate WebParser measure, when the Count variable is cycled ([MeasureValue]). And finally you need an ActionTimer plugin measure ([MeasureSlide]), to cycle the variable, when the WebParser measures get their values.eddie2302 wrote: ↑December 12th, 2018, 4:43 pm My question really relates to how I can get the data in a form so that a line meter can be produced, plotting the y axis as the values obtained from the .xml file and the x axis as any arbitrary scale (e.g. MeasureValue1 at x=1, MeasureValue2 at x=2 etc.).
I have literally no clue where to start with this so sorry if I can't provide much insight (the code snippets are no help at all - there aren't even any meters).
Here is an example code. Please test it and let me know if there is anything to be added:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
Count=0
U=[!UpdateMeasure "MeasureSlide"][!UpdateMeasure "MeasureValue"][!UpdateMeter "MeterNetworkLine"][!UpdateMeter "Uptime"][!Redraw]
ExtendHor=50
[MeasureSlide]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat Step,250,3
Step=[!SetVariable Count "(Clamp((#Count#+1),0,3))"]#U#
DynamicVariables=1
[MeasureReadXML]
Measure=Plugin
Plugin=WebParser
URL=file://#CURRENTPATH#Test.xml
RegExp=(?siU)<value>(.*)</value>.*<value>(.*)</value>.*<value>(.*)</value>.*
FinishAction=[!CommandMeasure "MeasureSlide" "Execute 1"]
[MeasureValue]
Measure=Calc
Formula=[MeasureValue#Count#]
DynamicVariables=1
UpdateDivider=-1
[MeasureValue0]
Measure=Calc
Formula=0
[MeasureValue1]
Measure=Plugin
Plugin=WebParser
URL=[MeasureReadXML]
StringIndex=1
[MeasureValue2]
Measure=Plugin
Plugin=WebParser
URL=[MeasureReadXML]
StringIndex=2
[MeasureValue3]
Measure=Plugin
Plugin=WebParser
URL=[MeasureReadXML]
StringIndex=3
[MeterNetworkLine]
Meter=Line
MeasureName=MeasureValue
X=0
Y=0
W=210
H=70
LineCount=2
LineColor=140,252,124,255
LineColor2=254,211,122,255
SolidColor=0,0,0,255
AutoScale=1
AntiAlias=1
UpdateDivider=-1
TransformStroke=Fixed
TransformationMatrix=#ExtendHor#;0;0;1;(([MeterNetworkLine:X]+[MeterNetworkLine:W])-#ExtendHor#*([MeterNetworkLine:X]+[MeterNetworkLine:W]));([MeterNetworkLine:Y]-[MeterNetworkLine:Y])
-
- Posts: 6
- Joined: December 12th, 2018, 3:46 pm
Re: Plotting a line meter with a custom data set
Wow balala, you are a magician. I had literally started plotting lines using shape meters giving co-ordinates based on the values involved. Your way is 1,000,000 times better. Thank-you so much
One last question - is there any way to show negative values on the line meter? I've tried adding a MinValue and a MaxValue to MeasureValue but only the MaxValue seems to be having an effect.
One last question - is there any way to show negative values on the line meter? I've tried adding a MinValue and a MaxValue to MeasureValue but only the MaxValue seems to be having an effect.
-
- Rainmeter Sage
- Posts: 16172
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Plotting a line meter with a custom data set
eddie2302 wrote: ↑December 12th, 2018, 7:34 pm Wow balala, you are a magician. I had literally started plotting lines using shape meters giving co-ordinates based on the values involved. Your way is 1,000,000 times better. Thank-you so much
One last question - is there any way to show negative values on the line meter? I've tried adding a MinValue and a MaxValue to MeasureValue but only the MaxValue seems to be having an effect.
I think the only way would be to add the same value to all values which have to be shown, in a way to convert them to positive values. Then, represent them. Although these values are not the same as the original ones, the shape of the line would follow the shape of the meter constructed with the original values.eddie2302 wrote: ↑December 12th, 2018, 7:34 pm Wow balala, you are a magician. I had literally started plotting lines using shape meters giving co-ordinates based on the values involved. Your way is 1,000,000 times better. Thank-you so much
One last question - is there any way to show negative values on the line meter? I've tried adding a MinValue and a MaxValue to MeasureValue but only the MaxValue seems to be having an effect.
-
- Posts: 6
- Joined: December 12th, 2018, 3:46 pm
Re: Plotting a line meter with a custom data set
Lol I was literally just writing to say don't worry about this, I'll do the addition in the excel file to make them all positive. Thank-you so much for all your help.
-
- Rainmeter Sage
- Posts: 16172
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Plotting a line meter with a custom data set
Thanks for the kind appreciations. But I doubt I would be magician.
I think the only way would be to add the same value to all values get by the WebParser measures, in a way to get positive all values. Although this way the represented values wouldn't be the same, the shape of the line would follow the shape of the line drawn by the original (negative) values.
-
- Rainmeter Sage
- Posts: 16172
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Plotting a line meter with a custom data set
Yep, this is a solution. As you can see above, I practically recommended the same way, with the only difference that I'd add that value into the skin itself.