diff --git a/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/model/PVItem.java b/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/model/PVItem.java index bf2ba9a595..14172808da 100644 --- a/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/model/PVItem.java +++ b/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/model/PVItem.java @@ -398,11 +398,24 @@ private void updateUnits(final VType value) setUnits(display.getUnit()); } + /** + * Updates the value axis label based on the {@link Preferences#value_axis_label_policy} property. + * If the property is set to pv-desc, then DESC field is used if defined and non-empty (works with pva only). + * @param value Value of PV update. + */ public void updateDescription(final VType value) { - final Display display = Display.displayOf(value); - if (display.getDescription() != null) - setDisplayName(display.getDescription()); + switch(Preferences.value_axis_label_policy){ + case "pv-name": + default: + return; + case "pv-desc": + final Display display = Display.displayOf(value); + if (display.getDescription() != null && !display.getDescription().isEmpty()){ + setDisplayName(display.getDescription()); + } + break; + } } /** Scan, i.e. add 'current' value to live samples */ diff --git a/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/preferences/Preferences.java b/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/preferences/Preferences.java index 18780336ba..b1f236b4be 100644 --- a/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/preferences/Preferences.java +++ b/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/preferences/Preferences.java @@ -101,6 +101,10 @@ public static class TimePreset /** Setting */ @Preference public static boolean config_dialog_supported; + @Preference + public static String value_axis_label_policy; + + static { final PreferencesReader prefs = AnnotatedPreferences.initialize(Activator.class, Preferences.class, "/databrowser_preferences.properties"); diff --git a/app/databrowser/src/main/resources/databrowser_preferences.properties b/app/databrowser/src/main/resources/databrowser_preferences.properties index 3c266af990..23162d4bb0 100644 --- a/app/databrowser/src/main/resources/databrowser_preferences.properties +++ b/app/databrowser/src/main/resources/databrowser_preferences.properties @@ -150,4 +150,9 @@ time_span_shortcuts=30 Minutes,-30 min|1 Hour,-1 hour|12 Hours,-12 hour|1 Day,-1 # Determines if the plot runtime config dialog is supported. Defaults to false as the Data Browser # offers the same functionality through its configuration tabs. -config_dialog_supported=false \ No newline at end of file +config_dialog_supported=false + +# Determines default value axis label policy. Supported options: +# pv-name: classic policy. Default if this property is not set or set to an unsupported value. +# pv-desc: use DESC field, if available from PV and non-empty. Works only with pva. +value_axis_label_policy=pv-name \ No newline at end of file