From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 7C33C1FF0B3 for ; Thu, 26 Nov 2026 15:54:50 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 207E2216D3; Thu, 26 Nov 2026 15:54:50 +0100 (CET) From: Dominik Csapak To: pdm-devel@lists.proxmox.com Subject: [PATCH datacenter-manager 08/10] ui: dashboard: top entities: add line, area and bar graph types Date: Thu, 26 Nov 2026 15:49:21 +0100 Message-ID: <20261126145410.3011676-9-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261126145410.3011676-1-d.csapak@proxmox.com> References: <20261126145410.3011676-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.742 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) KAM_MAILER 2 Automated Mailer Tag Left in Email RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: RFWE4NAXP3IWDNOQJVPNRMWJALQRLUH4 X-Message-ID-Hash: RFWE4NAXP3IWDNOQJVPNRMWJALQRLUH4 X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: the heatmap shows how loaded an entity was over time, but it's hard to see the actual usage from it. Line, area and bar graphs show that directly by their height. Draw them as svg paths, which keeps the DOM small, scales without redrawing and can use the theme colors via css variables. All graphs of a panel share a vertical gradient, so every height has the same color as the usage it represents in the heatmap. Make the graph type an option of the leaderboard widget, so it can be chosen in the widget options panel. It defaults to the heatmap and is only saved as the 'graph-type' property of the widget if it differs from that, which keeps the layouts minimal and existing ones look the same as before. Signed-off-by: Dominik Csapak --- lib/pdm-api-types/src/views.rs | 45 ++++ ui/src/dashboard/top_entities.rs | 312 ++++++++++++++++++++---- ui/src/dashboard/view.rs | 11 +- ui/src/dashboard/view/row_view.rs | 1 + ui/src/dashboard/view/widget_options.rs | 29 ++- 5 files changed, 341 insertions(+), 57 deletions(-) diff --git a/lib/pdm-api-types/src/views.rs b/lib/pdm-api-types/src/views.rs index 5d288e31..f1d2d7f3 100644 --- a/lib/pdm-api-types/src/views.rs +++ b/lib/pdm-api-types/src/views.rs @@ -320,6 +320,8 @@ pub enum WidgetType { #[serde(rename_all = "kebab-case")] Leaderboard { leaderboard_type: LeaderboardType, + #[serde(default, skip_serializing_if = "LeaderboardGraphType::is_default")] + graph_type: LeaderboardGraphType, }, TaskSummary { grouping: TaskSummaryGrouping, @@ -354,6 +356,28 @@ pub enum LeaderboardType { NodeMemory, } +#[derive(Serialize, Deserialize, PartialEq, Clone, Copy, Default)] +#[serde(rename_all = "kebab-case")] +/// How the usage over time of an entity is drawn. Except for [`LeaderboardGraphType::Heat`], the +/// graphs are colored by height, so the colors match the ones of the heat graph for the same usage. +pub enum LeaderboardGraphType { + /// A bar colored by the usage at each point in time. + #[default] + Heat, + /// A line showing the usage. + Line, + /// The filled area below the usage line. + Area, + /// Vertical bars showing the usage. + Bar, +} + +impl LeaderboardGraphType { + fn is_default(&self) -> bool { + *self == Self::default() + } +} + #[derive(Serialize, Deserialize, PartialEq, Clone, Copy)] #[serde(rename_all = "kebab-case")] pub enum TaskSummaryGrouping { @@ -399,6 +423,27 @@ mod test { assert!(parse_and_check_display("remote:a").is_err()); } + #[test] + fn test_leaderboard_graph_type() -> Result<(), Error> { + let widget = |graph_type| WidgetType::Leaderboard { + leaderboard_type: LeaderboardType::GuestCpu, + graph_type, + }; + let minimal = r#"{"widget-type":"leaderboard","leaderboard-type":"guest-cpu"}"#; + + assert_eq!( + serde_json::to_string(&widget(LeaderboardGraphType::Heat))?, + minimal + ); + assert_eq!( + serde_json::to_string(&widget(LeaderboardGraphType::Bar))?, + r#"{"widget-type":"leaderboard","leaderboard-type":"guest-cpu","graph-type":"bar"}"# + ); + assert!(serde_json::from_str::(minimal)? == widget(LeaderboardGraphType::Heat)); + + Ok(()) + } + #[test] fn config_smoke_test() { let config = " diff --git a/ui/src/dashboard/top_entities.rs b/ui/src/dashboard/top_entities.rs index deebfd1d..a5e51538 100644 --- a/ui/src/dashboard/top_entities.rs +++ b/ui/src/dashboard/top_entities.rs @@ -1,3 +1,4 @@ +use std::fmt::Write; use std::rc::Rc; use web_sys::HtmlElement; @@ -7,7 +8,8 @@ use proxmox_yew_comp::utils::render_epoch; use pwt::dom::DomSizeObserver; use pwt::prelude::*; use pwt::state::SharedState; -use pwt::widget::Fa; +use pwt::widget::canvas::{Canvas, Path, SvgLength}; +use pwt::widget::{Fa, get_unique_element_id}; use pwt::{ css::{AlignItems, Display, FlexFit, JustifyContent}, dom::align::{AlignOptions, align_to}, @@ -20,7 +22,7 @@ use pwt::{ }; use pdm_api_types::resource::AsResourceView; -use pdm_api_types::views::LeaderboardType; +use pdm_api_types::views::{LeaderboardGraphType as GraphType, LeaderboardType}; use pdm_client::types::{Resource, TopEntity}; use crate::LoadResult; @@ -37,6 +39,7 @@ pub struct TopEntities { /// The threshold for the oklab color gradient relaying how much load there is. /// Will be clamped between 0.001 and 0.999 to ensure invariants to avoid division by zero. threshold: f64, + graph_type: GraphType, } impl TopEntities { @@ -45,8 +48,28 @@ impl TopEntities { entities, metrics_title, threshold: threshold.clamp(0.001, 0.999), + graph_type: GraphType::default(), } } + + /// Builder style method to set how the usage over time is drawn. + pub fn graph_type(mut self, graph_type: GraphType) -> Self { + self.graph_type = graph_type; + self + } +} + +/// The minimum width in pixels a bucket of data points covers in the graph. The RRD data can contain +/// more points (e.g. 1440 for a day) than the graph is wide in pixels, and every point makes the +/// style or path data bigger without any visible difference. +fn pixels_per_bucket(graph_type: GraphType) -> f64 { + match graph_type { + // the gradient and lines interpolate between the points, so this looks the same as a point + // per pixel + GraphType::Heat | GraphType::Line | GraphType::Area => 2.0, + // bars that are too thin cannot be told apart + GraphType::Bar => 6.0, + } } impl From for VNode { @@ -71,15 +94,19 @@ struct TooltipInfo { } struct TopEntitiesComp { - /// The graph backgrounds in the same order as the entities, only calculated when the - /// properties or the number of buckets change and not on every re-render, e.g. when moving the - /// tooltip. - graph_backgrounds: Vec, + /// The graph data in the same order as the entities, the CSS background for + /// [`GraphType::Heat`] and the SVG path data otherwise. Only calculated when the properties or + /// the number of buckets change and not on every re-render, e.g. when moving the tooltip. + graphs: Vec, /// The maximum number of buckets the data of a graph gets split into. max_buckets: usize, + /// The width of the graphs, see `measure_graph_width`. + width: f64, /// Whether the graph width needs to be measured again after the next render, since the /// entities and with them the width of the name column changed. measure_width: bool, + /// The ID of the SVG gradient used by all graphs except [`GraphType::Heat`]. + gradient_id: AttrValue, size_observer: Option, root_ref: NodeRef, tooltip_info: Option, @@ -92,18 +119,21 @@ impl Component for TopEntitiesComp { type Properties = TopEntities; fn create(ctx: &yew::Context) -> Self { - // the real width is only known after the first render, see `rendered` - let max_buckets = 0; - Self { - graph_backgrounds: graph_backgrounds(ctx.props(), max_buckets), - max_buckets, + let mut this = Self { + graphs: Vec::new(), + max_buckets: 0, + // the real width is only known after the first render, see `rendered` + width: 0.0, measure_width: false, + gradient_id: get_unique_element_id().into(), size_observer: None, root_ref: NodeRef::default(), tooltip_info: None, tooltip_ref: NodeRef::default(), tooltip_anchor: NodeRef::default(), - } + }; + this.update_graphs(ctx.props(), true); + this } fn update(&mut self, ctx: &yew::Context, msg: Self::Message) -> bool { @@ -145,12 +175,8 @@ impl Component for TopEntitiesComp { let Some(width) = self.measure_graph_width() else { return false; }; - let max_buckets = (width / PIXELS_PER_BUCKET).ceil() as usize; - if max_buckets == self.max_buckets { - return false; - } - self.max_buckets = max_buckets; - self.graph_backgrounds = graph_backgrounds(props, max_buckets); + self.width = width; + return self.update_graphs(props, false); } } @@ -158,7 +184,7 @@ impl Component for TopEntitiesComp { } fn changed(&mut self, ctx: &yew::Context, _old_props: &Self::Properties) -> bool { - self.graph_backgrounds = graph_backgrounds(ctx.props(), self.max_buckets); + self.update_graphs(ctx.props(), true); self.measure_width = true; true } @@ -172,8 +198,9 @@ impl Component for TopEntitiesComp { .style("grid-template-columns", "min-content auto") .style("gap", "var(--pwt-spacer-3)"); let mut tooltip = None; + let gradient_paint = AttrValue::from(format!("url(#{})", self.gradient_id)); let data = &props.entities; - for (entity, graph_background) in data.iter().zip(&self.graph_backgrounds).rev() { + for (entity, graph) in data.iter().zip(&self.graphs).rev() { let resource = &entity.resource; let remote = &entity.remote; @@ -227,23 +254,56 @@ impl Component for TopEntitiesComp { .style("white-space", "nowrap"), ); - list.add_child( - Container::new() - .width(CssLength::Fraction(1.0)) - .class("line-usage-graph") - .style("background-image", graph_background.clone()) - .style("flex", "5 0") - .onpointermove(ctx.link().callback({ - let resource = resource.clone(); - move |event| Msg::ShowTooltip(event, resource.clone()) - })) - .onpointerleave(ctx.link().callback(|_| Msg::HideTooltip)) - .style("position", "relative") - .with_optional_child(tooltip_anchor), - ); + let mut graph_container = Container::new() + .width(CssLength::Fraction(1.0)) + .class("line-usage-graph") + .style("background-color", BACKGROUND_COLOR) + .style("overflow", "hidden") + .style("flex", "5 0") + .onpointermove(ctx.link().callback({ + let resource = resource.clone(); + move |event| Msg::ShowTooltip(event, resource.clone()) + })) + .onpointerleave(ctx.link().callback(|_| Msg::HideTooltip)) + .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 => { + // the line is centered on the edges for no or full usage, so it needs some + // space outside of the graph to not get cut in half + graph_container.set_style("box-sizing", "border-box"); + graph_container.set_style("padding-block", "0.75px"); + graph_container.add_child( + graph_svg( + len, + Path::new() + .d(graph.clone()) + .fill("none") + .stroke(gradient_paint.clone()) + .stroke_width(1.5) + // the graph gets stretched, but the line should keep its width + .attribute("vector-effect", "non-scaling-stroke"), + ) + .style("overflow", "visible"), + ) + } + GraphType::Area | GraphType::Bar => graph_container.add_child(graph_svg( + len, + Path::new().d(graph.clone()).fill(gradient_paint.clone()), + )), + } + + list.add_child(graph_container); } Container::new() .class(FlexFit) + .with_optional_child( + (props.graph_type != GraphType::Heat) + .then(|| usage_gradient(self.gradient_id.clone(), props.threshold)), + ) .with_child(list) .with_optional_child(tooltip.map(|tooltip| { Container::new() @@ -301,6 +361,30 @@ impl TopEntitiesComp { .ok()??; Some(graph.get_bounding_client_rect().width()) } + + /// Recalculates the graphs if forced or the number of buckets changed, returns if they were + /// recalculated. + fn update_graphs(&mut self, props: &TopEntities, force: bool) -> bool { + let max_buckets = (self.width / pixels_per_bucket(props.graph_type)).ceil() as usize; + if !force && max_buckets == self.max_buckets { + return false; + } + self.max_buckets = max_buckets; + self.graphs = props + .entities + .iter() + .map(|entity| { + let data = &entity.rrd_data.data; + match props.graph_type { + GraphType::Heat => heat_background(data, props.threshold, max_buckets), + GraphType::Line => line_path(data, max_buckets), + GraphType::Area => area_path(data, max_buckets), + GraphType::Bar => bar_path(data, max_buckets), + } + }) + .collect(); + true + } } fn create_tooltip( @@ -348,12 +432,10 @@ const BACKGROUND_COLOR: &str = "var(--pwt-color-surface)"; const COLOR_SPACE: &str = "oklab"; -/// The minimum width in pixels a bucket of data points covers in the graph. The RRD data can contain -/// more points (e.g. 1440 for a day) than the graph is wide in pixels, and every point makes the -/// style data bigger without any visible difference. Since the gradient interpolates between the -/// color stops, this looks the same as a stop per pixel. -const PIXELS_PER_BUCKET: f64 = 2.0; +/// The relative width of the gap between two bars of a [`GraphType::Bar`] graph. +const BAR_GAP: f64 = 0.25; +/// The color representing the given usage. fn usage_color(value: f64, threshold: f64) -> String { let (ratio, high_color, low_color) = if value < threshold { (value / threshold, WARN_COLOR, GOOD_COLOR) @@ -416,8 +498,8 @@ fn buckets(data: &[Option], max_buckets: usize) -> impl Iterator], threshold: f64, max_buckets: usize) -> AttrValue { +/// Returns the CSS 'background-image' value for a [`GraphType::Heat`] graph. +fn heat_background(data: &[Option], threshold: f64, max_buckets: usize) -> AttrValue { let len = data.len() as f64; // color stops as (color, start, end), with the positions in percent @@ -469,13 +551,142 @@ fn graph_background(data: &[Option], threshold: f64, max_buckets: usize) -> .into() } -/// Returns the graph backgrounds for all entities. -fn graph_backgrounds(props: &TopEntities, max_buckets: usize) -> Vec { - props - .entities - .iter() - .map(|entity| graph_background(&entity.rrd_data.data, props.threshold, max_buckets)) - .collect() +// The SVG graphs use a coordinate system where the x coordinate is the index of the data point and +// the y coordinate goes from 1 for no usage at the bottom to 0 for full usage at the top, see +// `graph_svg`. + +/// The SVG y coordinate of the given usage. +fn usage_y(value: f64) -> f64 { + 1.0 - value.clamp(0.0, 1.0) +} + +/// Splits the bucketed data into segments without gaps, as (x, y) points in SVG coordinates. The +/// returned segments are never empty and contain at least two points. +fn line_segments(data: &[Option], max_buckets: usize) -> Vec> { + let mut segments = Vec::new(); + let mut segment = Vec::new(); + + // a single point would not be visible, so draw it across its whole interval instead + let finish = |segment: Vec<(Bucket, f64)>| match segment.as_slice() { + [(bucket, y)] => vec![(bucket.start as f64, *y), (bucket.end as f64, *y)], + _ => segment + .iter() + .map(|(bucket, y)| (bucket.center(), *y)) + .collect(), + }; + + for bucket in buckets(data, max_buckets) { + match bucket.value { + Some(value) => segment.push((bucket, usage_y(value))), + None if !segment.is_empty() => segments.push(finish(std::mem::take(&mut segment))), + None => {} + } + } + + if !segment.is_empty() { + segments.push(finish(segment)); + } + + segments +} + +/// Returns the SVG path data for a [`GraphType::Line`] graph. +fn line_path(data: &[Option], max_buckets: usize) -> AttrValue { + let mut path = String::new(); + + for segment in line_segments(data, max_buckets) { + let mut command = 'M'; + for (x, y) in segment { + let _ = write!(path, "{command}{x:.1},{y:.3}"); + command = 'L'; + } + } + + path.into() +} + +/// Returns the SVG path data for a [`GraphType::Area`] graph. +fn area_path(data: &[Option], max_buckets: usize) -> AttrValue { + let mut path = String::new(); + + for segment in line_segments(data, max_buckets) { + // start at the bottom, follow the line and go back to the bottom to close the area + let (start_x, _) = segment[0]; + let _ = write!(path, "M{start_x:.1},1"); + for (x, y) in segment { + let _ = write!(path, "L{x:.1},{y:.3}"); + } + path.push_str("V1Z"); + } + + path.into() +} + +/// Returns the SVG path data for a [`GraphType::Bar`] graph. +fn bar_path(data: &[Option], max_buckets: usize) -> AttrValue { + let mut path = String::new(); + + for bucket in buckets(data, max_buckets) { + let Some(value) = bucket.value else { + continue; + }; + + // centered on the bucket position, like the points of the other graph types + let width = (bucket.end - bucket.start) as f64 * (1.0 - BAR_GAP); + let x = bucket.center() - width / 2.0; + let _ = write!(path, "M{x:.2},1V{:.3}h{width:.2}V1Z", usage_y(value)); + } + + path.into() +} + +/// Creates an SVG for the path of a graph with `len` data points, stretched to the size of its +/// parent. +fn graph_svg(len: usize, path: Path) -> Canvas { + Canvas::new() + .width(SvgLength::Fraction(1.0)) + .height(SvgLength::Fraction(1.0)) + .attribute("viewBox", format!("0 0 {len} 1")) + .attribute("preserveAspectRatio", "none") + .style("display", "block") + // so that the pointer events for the tooltip always target the graph container + .style("pointer-events", "none") + .with_child(path) +} + +/// Creates an invisible SVG with the vertical gradient used by the SVG graphs, which colors every +/// height with the color of the usage it represents. The stops in between approximate the +/// interpolation in the color space used by the heat graphs. +fn usage_gradient(id: AttrValue, threshold: f64) -> Canvas { + const STEPS: u32 = 4; + let below = (0..STEPS).map(|step| threshold * step as f64 / STEPS as f64); + let above = (0..=STEPS).map(|step| threshold + (1.0 - threshold) * step as f64 / STEPS as f64); + let stops: Html = below + .chain(above) + .map(|value| { + html! { + + } + }) + .collect(); + + // not using 'display: none', since some browsers then do not render the gradient at all + Canvas::new() + .width(0) + .height(0) + .style("position", "absolute") + .with_child(html! { + + // user space coordinates, so that the colors map to the same values in every graph, + // and a dynamic tag, since the html macro would lowercase the name + <@{"linearGradient"} {id} gradientUnits="userSpaceOnUse" x1="0" y1="1" x2="0" y2="0"> + {stops} + + + }) } pub fn create_top_entities_panel( @@ -483,6 +694,7 @@ pub fn create_top_entities_panel( LoadResult, >, leaderboard_type: LeaderboardType, + graph_type: GraphType, ) -> Panel { let top_entities = top_entities.read(); let (entities, metrics_title, metrics_empty_message, threshold) = match leaderboard_type { @@ -515,7 +727,9 @@ pub fn create_top_entities_panel( .with_child(&metrics_empty_message) .into() } else { - TopEntities::new(entities, metrics_title, threshold).into() + TopEntities::new(entities, metrics_title, threshold) + .graph_type(graph_type) + .into() }; Some(html) diff --git a/ui/src/dashboard/view.rs b/ui/src/dashboard/view.rs index c46a85b0..61d52924 100644 --- a/ui/src/dashboard/view.rs +++ b/ui/src/dashboard/view.rs @@ -171,9 +171,10 @@ fn render_widget( .callback(move |_| Msg::ShowSubscriptionsDialog(true)), ), WidgetType::Sdn => create_sdn_panel(status), - WidgetType::Leaderboard { leaderboard_type } => { - create_top_entities_panel(top_entities, *leaderboard_type) - } + WidgetType::Leaderboard { + leaderboard_type, + graph_type, + } => create_top_entities_panel(top_entities, *leaderboard_type, *graph_type), WidgetType::TaskSummary { grouping } => { let remotes = match grouping { TaskSummaryGrouping::Category => None, @@ -221,7 +222,9 @@ fn default_widget_title( WidgetType::Remotes { .. } => ("server", tr!("Remotes")), WidgetType::Subscription => ("ticket", tr!("Remote Subscription Status")), WidgetType::Sdn => ("sdn", tr!("SDN Zones")), - WidgetType::Leaderboard { leaderboard_type } => match leaderboard_type { + WidgetType::Leaderboard { + leaderboard_type, .. + } => match leaderboard_type { LeaderboardType::GuestCpu => ("desktop", tr!("Guests With the Highest CPU Usage")), LeaderboardType::NodeCpu => ("building", tr!("Nodes With the Highest CPU Usage")), LeaderboardType::NodeMemory => ("building", tr!("Nodes With the Highest Memory Usage")), diff --git a/ui/src/dashboard/view/row_view.rs b/ui/src/dashboard/view/row_view.rs index e58d7c74..70ac9a0d 100644 --- a/ui/src/dashboard/view/row_view.rs +++ b/ui/src/dashboard/view/row_view.rs @@ -626,6 +626,7 @@ fn create_menu(ctx: &yew::Context, new_coords: Position) -> Menu { WidgetType::PbsDatastores, WidgetType::Leaderboard { leaderboard_type: LeaderboardType::GuestCpu, + graph_type: Default::default(), }, WidgetType::TaskSummary { grouping: TaskSummaryGrouping::Category, diff --git a/ui/src/dashboard/view/widget_options.rs b/ui/src/dashboard/view/widget_options.rs index 9418d67f..c8ca45b5 100644 --- a/ui/src/dashboard/view/widget_options.rs +++ b/ui/src/dashboard/view/widget_options.rs @@ -9,7 +9,8 @@ use pwt_macros::builder; use pdm_api_types::remotes::RemoteType; use pdm_api_types::resource::GuestType; use pdm_api_types::views::{ - LeaderboardType, NodeResourceType, RowWidget, TaskSummaryGrouping, WidgetType, + LeaderboardGraphType, LeaderboardType, NodeResourceType, RowWidget, TaskSummaryGrouping, + WidgetType, }; /// Returns the name of the kind of widget, independent of its options. @@ -139,11 +140,14 @@ impl Component for WidgetOptionsComp { ), ); } - WidgetType::Leaderboard { leaderboard_type } => { + &WidgetType::Leaderboard { + leaderboard_type, + graph_type, + } => { panel.add_field( tr!("Ranking"), option_selector( - *leaderboard_type, + leaderboard_type, vec![ ( LeaderboardType::GuestCpu, @@ -158,8 +162,25 @@ impl Component for WidgetOptionsComp { tr!("Nodes with Highest Memory Usage"), ), ], - set_type.reform(|leaderboard_type| WidgetType::Leaderboard { + set_type.reform(move |leaderboard_type| WidgetType::Leaderboard { + leaderboard_type, + graph_type, + }), + ), + ); + panel.add_field( + tr!("Graph Type"), + option_selector( + graph_type, + vec![ + (LeaderboardGraphType::Heat, tr!("Heatmap")), + (LeaderboardGraphType::Line, tr!("Line Graph")), + (LeaderboardGraphType::Area, tr!("Area Graph")), + (LeaderboardGraphType::Bar, tr!("Bar Graph")), + ], + set_type.reform(move |graph_type| WidgetType::Leaderboard { leaderboard_type, + graph_type, }), ), ); -- 2.47.3