|
11 | 11 | from vtkmodules.vtkRenderingCore import vtkActor, vtkPolyDataMapper |
12 | 12 |
|
13 | 13 | from e3sm_compareview.components import view as tview |
| 14 | +from e3sm_compareview.utils import format_color_range_endpoints |
14 | 15 | from e3sm_quickview.presets import COLOR_BLIND_SAFE |
15 | 16 | from e3sm_quickview.utils.color import COLORBAR_CACHE, lut_to_img |
16 | 17 | from e3sm_quickview.utils.math import compute_color_ticks, tick_contrast_color |
@@ -73,6 +74,8 @@ class ViewConfiguration(dataclass.StateDataModel): |
73 | 74 | lut_img: str = dataclass.Sync(str) |
74 | 75 | color_ticks: list = dataclass.Sync(list, list) |
75 | 76 | effective_color_range: list[float] = dataclass.Sync(tuple[float, float], (0, 1)) |
| 77 | + color_range_min_label: str = dataclass.Sync(str, "0") |
| 78 | + color_range_max_label: str = dataclass.Sync(str, "1") |
76 | 79 |
|
77 | 80 |
|
78 | 81 | class VariableView(TrameComponent): |
@@ -434,6 +437,12 @@ def update_color_range(self, *_): |
434 | 437 |
|
435 | 438 | def _compute_ticks(self): |
436 | 439 | vmin, vmax = self.config.color_range |
| 440 | + ( |
| 441 | + self.config.color_range_min_label, |
| 442 | + self.config.color_range_max_label, |
| 443 | + ) = format_color_range_endpoints( |
| 444 | + self.config.color_range, self.config.use_log_scale |
| 445 | + ) |
437 | 446 | ticks = compute_color_ticks(vmin, vmax, scale=self.config.use_log_scale, n=5) |
438 | 447 | if not ticks: |
439 | 448 | self.config.color_ticks = [] |
|
0 commit comments