Autor Thema: Scaling data in svg plot. ( unit conversion )  (Gelesen 952 mal)

Offline Wallyllama

  • New Member
  • *
  • Beiträge: 8
Scaling data in svg plot. ( unit conversion )
« am: 23 März 2021, 06:09:23 »
I have a bme280 tenp/pressure/humidity sensor reporting via MQTT. I graph them with gplot. Sofar, so good. The problem is pressure is reported in Pascals. I could modify the code that reads the me, but I'm hoping there is a way to app,y a scale to each reading as the gis made. made. For example multiplying Pascals by 0.00296 gives in hes of mercury, or dividingb by100 gives hPa,

Offline xenos1984

  • Developer
  • Full Member
  • ****
  • Beiträge: 412
Antw:Scaling data in svg plot. ( unit conversion )
« Antwort #1 am: 23 März 2021, 07:17:49 »
You can use the fourth parameter in a plot data entry to specify a function, which is applied to each data point. For example, if your plot line reads

#FileLog 4:pressure:0:

you can divide each pressure value by 100 like this:

#FileLog 4:pressure:0:($fld[3]*0.01)

Offline rudolfkoenig

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 24510
Antw:Scaling data in svg plot. ( unit conversion )
« Antwort #2 am: 23 März 2021, 08:51:38 »
The function field is also present in the SVG-Editor, it is the last text-input field in the row.
Note: $fld[ x ] is a perl array, the index starts with 0.
« Letzte Änderung: 24 März 2021, 19:48:22 von rudolfkoenig »

Offline Wallyllama

  • New Member
  • *
  • Beiträge: 8
Antw:Scaling data in svg plot. ( unit conversion )
« Antwort #3 am: 24 März 2021, 14:51:57 »
perfect! thank you, I knew it would be somewhat obvious once i knew the answer.  :)    oh and sorry about duplicating this. I don't see that I can delete the other one.   :(

 

decade-submarginal