From b1bed246b88937b08e22754a0d92fd0b23d896a8 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Sun, 22 Jan 2023 14:44:25 +0100 Subject: [PATCH] Removes transparency in cpu chart. Intends to fix #297 --- src/Views/SystemView/SystemCPUView.vala | 2 +- src/Widgets/Chart/Chart.vala | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Views/SystemView/SystemCPUView.vala b/src/Views/SystemView/SystemCPUView.vala index 0f76e5a5..f48ef60c 100644 --- a/src/Views/SystemView/SystemCPUView.vala +++ b/src/Views/SystemView/SystemCPUView.vala @@ -61,7 +61,7 @@ public class Monitor.SystemCPUView : Monitor.WidgetResource { set_popover_more_info (new SystemCPUInfoPopover (cpu)); - cpu_utilization_chart = new Chart (cpu.core_list.size, MonitorApp.settings.get_boolean ("smooth-lines-state")); + cpu_utilization_chart = new Chart (cpu.core_list.size, MonitorApp.settings.get_boolean ("smooth-lines-state"), 1.0); cpu_utilization_chart.config.y_axis.tick_interval = 100; cpu_utilization_chart.config.y_axis.fixed_max = 100.0 * cpu.core_list.size; set_main_chart (cpu_utilization_chart); diff --git a/src/Widgets/Chart/Chart.vala b/src/Widgets/Chart/Chart.vala index 02a76f06..ada29c11 100644 --- a/src/Widgets/Chart/Chart.vala +++ b/src/Widgets/Chart/Chart.vala @@ -36,31 +36,35 @@ public class Monitor.Chart : Gtk.Box { // }; // White background } - public Chart (uint _series_quantity, bool smooth = true) { + public Chart (uint _series_quantity, bool smooth = true, double renderer_area_alfa=0.5) { series_quantity = _series_quantity; if (smooth) { - with_smooth_line (); + with_smooth_line (renderer_area_alfa); } else { - with_straight_line (); + with_straight_line (renderer_area_alfa); } } - private Chart with_smooth_line () { + private Chart with_smooth_line (double renderer_area_alfa=0.5) { for (int i = 0; i < series_quantity; i++) { var renderer = new LiveChart.SmoothLineArea (new LiveChart.Values (1000)); + renderer.area_alpha = renderer_area_alfa; var serie = new LiveChart.Serie (("Serie %d").printf (i), renderer); serie.line.color = colors.get_color_by_index (i); + + live_chart.add_serie (serie); } add (live_chart); return this; } - private Chart with_straight_line () { + private Chart with_straight_line (double renderer_area_alfa=0.5) { for (int i = 0; i < series_quantity; i++) { var renderer = new LiveChart.LineArea (new LiveChart.Values (1000)); + renderer.area_alpha = renderer_area_alfa; var serie = new LiveChart.Serie (("Serie %d").printf (i), renderer); serie.line.color = colors.get_color_by_index (i);