all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager 09/10] ui: dashboard: top entities: show indicator line for tooltip point
Date: Thu, 26 Nov 2026 15:49:22 +0100	[thread overview]
Message-ID: <20261126145410.3011676-10-d.csapak@proxmox.com> (raw)
In-Reply-To: <20261126145410.3011676-1-d.csapak@proxmox.com>

with many data points per graph, it's hard to tell which point the
tooltip refers to. So show a vertical line at the position of that
point, using the same relative position as the graphs.

The line snaps to the data point instead of following the pointer
exactly, so it always matches the shown values. Reuse the tooltip
anchor for this and align the tooltip to its top, which keeps the
tooltip at the same position as before.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 ui/src/dashboard/top_entities.rs | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/ui/src/dashboard/top_entities.rs b/ui/src/dashboard/top_entities.rs
index a5e51538..3cbff87f 100644
--- a/ui/src/dashboard/top_entities.rs
+++ b/ui/src/dashboard/top_entities.rs
@@ -87,7 +87,8 @@ pub enum Msg {
 }
 
 struct TooltipInfo {
-    pos: i32,
+    /// The index of the shown data point.
+    index: usize,
     id: String,
     value: Option<f64>,
     time: i64,
@@ -158,7 +159,7 @@ impl Component for TopEntitiesComp {
                             as usize;
 
                         self.tooltip_info = Some(TooltipInfo {
-                            pos: offset,
+                            index: idx,
                             id: resource.global_id().to_string(),
                             value: rrd.data.get(idx).copied().unwrap_or_default(),
                             time: (rrd.start + rrd.resolution * idx as u64) as i64,
@@ -205,15 +206,25 @@ impl Component for TopEntitiesComp {
             let remote = &entity.remote;
 
             let node = resource.as_resource_view().node().map(|n| n.to_string());
+            let len = entity.rrd_data.data.len();
 
             let tooltip_anchor = if let Some(info) = self.tooltip_info.as_ref() {
                 if info.id == resource.global_id() {
                     tooltip = Some(create_tooltip(remote, resource, info, &props.metrics_title));
+                    // a vertical line at the shown data point, which is at the same relative
+                    // position as in the graphs, so it is clear which point the tooltip refers to
                     Some(
                         Container::new()
                             .style("position", "absolute")
                             .style("pointer-events", "none")
-                            .style("left", format!("{}px", info.pos))
+                            .style("top", "0")
+                            .style("bottom", "0")
+                            .style("width", "1px")
+                            .style("background-color", INDICATOR_COLOR)
+                            .style(
+                                "left",
+                                format!("{}%", (info.index as f64 + 0.5) * 100.0 / len as f64),
+                            )
                             .into_html_with_ref(self.tooltip_anchor.clone()),
                     )
                 } else {
@@ -268,7 +279,6 @@ impl Component for TopEntitiesComp {
                 .style("position", "relative")
                 .with_optional_child(tooltip_anchor);
 
-            let len = entity.rrd_data.data.len();
             match props.graph_type {
                 GraphType::Heat => graph_container.set_style("background-image", graph.clone()),
                 GraphType::Line => {
@@ -338,7 +348,7 @@ impl Component for TopEntitiesComp {
                     tooltip_node,
                     Some(
                         AlignOptions::new(
-                            pwt::dom::align::Point::BottomStart,
+                            pwt::dom::align::Point::TopStart,
                             pwt::dom::align::Point::TopStart,
                             pwt::dom::align::GrowDirection::None,
                         )
@@ -429,6 +439,8 @@ const GOOD_COLOR: &str = "var(--pwt-color-success)";
 const WARN_COLOR: &str = "var(--pwt-color-warning)";
 const ERR_COLOR: &str = "var(--pwt-color-error)";
 const BACKGROUND_COLOR: &str = "var(--pwt-color-surface)";
+// must stay visible on top of all usage colors
+const INDICATOR_COLOR: &str = "var(--pwt-color-on-surface)";
 
 const COLOR_SPACE: &str = "oklab";
 
-- 
2.47.3





  parent reply	other threads:[~2026-11-26 14:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 14:49 [PATCH datacenter-manager 00/10] dashborad: add widget settings and leaderboard graph types Dominik Csapak
2026-11-26 14:49 ` [PATCH datacenter-manager 01/10] ui: dashboard: use plural for the container panel Dominik Csapak
2026-11-26 14:49 ` [PATCH datacenter-manager 02/10] ui: views: keep the icon for custom widget titles Dominik Csapak
2026-11-26 14:49 ` [PATCH datacenter-manager 03/10] ui: views: add options panel for editing widgets Dominik Csapak
2026-11-26 14:49 ` [PATCH datacenter-manager 04/10] ui: views: add only one menu entry per widget type Dominik Csapak
2026-11-26 14:49 ` [PATCH datacenter-manager 05/10] ui: dashboard: top entities: only build graph gradients on change Dominik Csapak
2026-11-26 14:49 ` [PATCH datacenter-manager 06/10] ui: dashboard: top entities: center data points in their interval Dominik Csapak
2026-11-26 14:49 ` [PATCH datacenter-manager 07/10] ui: dashboard: top entities: limit color stops by graph width Dominik Csapak
2026-11-26 14:49 ` [PATCH datacenter-manager 08/10] ui: dashboard: top entities: add line, area and bar graph types Dominik Csapak
2026-11-26 14:49 ` Dominik Csapak [this message]
2026-11-26 14:49 ` [PATCH datacenter-manager 10/10] docs: custom views: mention the graph types of the leaderboard widget Dominik Csapak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261126145410.3011676-10-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal