Skip to content

Add log scaling property to Meter widget#3764

Open
rjwills28 wants to merge 5 commits intoControlSystemStudio:masterfrom
rjwills28:meter_widget_log_scale
Open

Add log scaling property to Meter widget#3764
rjwills28 wants to merge 5 commits intoControlSystemStudio:masterfrom
rjwills28:meter_widget_log_scale

Conversation

@rjwills28
Copy link
Copy Markdown
Contributor

I noticed that the old Meter widget in CS-Studio had the option of using a log scale but that this is missing in the Phoebus Meter widget.

This PR adds the code needed to support log scaling in the meter widget following what is implemented for the RTTank widget. The only real bit of logic needed is in MeterScale.java, otherwise it is pretty much boilerplate.

Checklist

  • Testing:

    • The feature has automated tests
    • Tests were run
    • If not, explain how you tested your changes
  • Documentation:

    • The feature is documented
    • The documentation is up to date
    • Release notes:
      • Added an entry if the change is breaking or significant
      • Added an entry when adding a new feature

@rjwills28
Copy link
Copy Markdown
Contributor Author

Thanks @shroffk for the review. Would it be possible to merge this in or does it need a second review?

@georgweiss
Copy link
Copy Markdown
Collaborator

@rjwills28, I'm having issues with this. Attached screen recording shows a case where a random number 0 - 10000 is displayed on a meter with scale 0 - 10000. But maybe I'm missing something?

Also, it would be nice if we can reuse the same label for the property as (for instance) the Linear Meter widget, i.e. Logarithmic scale instead of Log. scale.

Screen.Recording.2026-04-10.at.09.32.39.mov

@rjwills28
Copy link
Copy Markdown
Contributor Author

Hi @georgweiss - thank you for testing. How are you setting the limits? Is this from a PV or manually? Essentially I think what is happening is that the lower limit is set to 0. There is then a calculation that does value/low_range, i.e. divides by 0 and it blows up the axis ranges. This is a problem I have also seen on other widgets when using the log scaling, e.g. tank widget. If you set the low limit manually to be something very small, e.g. 0.001 does it then work?

I wasn't sure how to fix this issue of 0 as the lower limit. Essentially we shouldn't use it in the calculations and should just use some very small number close of 0 instead. But I wasn't sure whether we actually wanted to hardcode that in and what the very small number should be. Any thoughts on that? As I said, this could also be fixed for other widgets.

@georgweiss
Copy link
Copy Markdown
Collaborator

@rjwills28, thanks for your feed-back.
Yes, a lower limit of 0.1 resolved my issue.
However, setting zero as the lower limit for a logarithmic scale is actually handled such that the lower limit is set to 4.9E-324. See LogTicks.adjustRange().

@sonarqubecloud
Copy link
Copy Markdown

@rjwills28
Copy link
Copy Markdown
Contributor Author

Ah I see - @georgweiss thanks for pointing that out. So that is the expected behaviour?

And thanks for the suggesting of changing the log scale property label to match other similar widgets. I had been using the one from PlotWidgetProperties. I have updated this to match what is used by the LinearMeter which now displays 'Logarithmic Scale' as the label

p.s. sorry for all the commits to fix the quality check - these were things I had missed but should now be compliant.

@georgweiss
Copy link
Copy Markdown
Collaborator

So that is the expected behaviour?

I'm just saying that LogTicks should handle the case where lower limit <=0 and set that to something small. You might want to compare to the Linear Meter widget.

@kasemir
Copy link
Copy Markdown
Collaborator

kasemir commented Apr 10, 2026

So that is the expected behaviour?

See app/rtplot/src/main/java/org/csstudio/javafx/rtplot/internal/util/Log10.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants