Skip to content

Commit

Permalink
Removes transparency in cpu chart. Intends to fix #297
Browse files Browse the repository at this point in the history
  • Loading branch information
stsdc committed Jan 22, 2023
1 parent ec3d8fb commit b1bed24
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Views/SystemView/SystemCPUView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 9 additions & 5 deletions src/Widgets/Chart/Chart.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b1bed24

Please sign in to comment.