Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

other: use custom time chart grid implementation #937

Merged
merged 9 commits into from
Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- [#690](https://github.com/ClementTsang/bottom/pull/690): Add some colour to `-h`/`--help` as part of updating to clap 3.0.
- [#807](https://github.com/ClementTsang/bottom/pull/807): Add more human friendly temperature sensor names for Linux.
- [#845](https://github.com/ClementTsang/bottom/pull/845), [#922](https://github.com/ClementTsang/bottom/pull/922): Add macOS M1, FreeBSD 12, and FreeBSD 13 binary build tasks.
- [#916](https://github.com/ClementTsang/bottom/pull/916), [#937](https://github.com/ClementTsang/bottom/pull/937): Improve CPU usage by optimizing draw logic of charts and tables.

## Features

Expand All @@ -34,7 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#870](https://github.com/ClementTsang/bottom/pull/870): Make disk widget sortable.
- [#881](https://github.com/ClementTsang/bottom/pull/881): Add pasting to the search bar.
- [#892](https://github.com/ClementTsang/bottom/pull/892): Add custom retention periods for data.
- [#899](https://github.com/ClementTsang/bottom/pull/899): Add non-normalized CPU usage to processes.
- [#899](https://github.com/ClementTsang/bottom/pull/899), [#910](https://github.com/ClementTsang/bottom/pull/910), [#912](https://github.com/ClementTsang/bottom/pull/912): Add non-normalized CPU usage to processes.
- [#919](https://github.com/ClementTsang/bottom/pull/919): Add an option to expand the default widget on startup.

## [0.6.8] - 2022-02-01
Expand Down
24 changes: 20 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,21 @@ clap_mangen = "0.1.6"
[package.metadata.deb]
section = "utility"
assets = [
["target/release/btm", "usr/bin/", "755"],
["LICENSE", "usr/share/doc/btm/", "644"],
["manpage/btm.1.gz", "usr/share/man/man1/btm.1.gz", "644"],
[
"target/release/btm",
"usr/bin/",
"755",
],
[
"LICENSE",
"usr/share/doc/btm/",
"644",
],
[
"manpage/btm.1.gz",
"usr/share/man/man1/btm.1.gz",
"644",
],
[
"completion/btm.bash",
"usr/share/bash-completion/completions/btm",
Expand All @@ -141,7 +153,11 @@ assets = [
"usr/share/fish/vendor_completions.d/btm.fish",
"644",
],
["completion/_btm", "usr/share/zsh/vendor-completions/", "644"],
[
"completion/_btm",
"usr/share/zsh/vendor-completions/",
"644",
],
]
extended-description = """

Expand Down
12 changes: 11 additions & 1 deletion src/components/tui_widget/time_chart.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
mod canvas;

use std::{borrow::Cow, cmp::max};

use canvas::*;
use tui::{
buffer::Buffer,
layout::{Constraint, Rect},
style::{Color, Style},
symbols::{self, Marker},
text::{Span, Spans},
widgets::{
canvas::{Canvas, Line, Points},
canvas::{Line, Points},
Block, Borders, GraphType, Widget,
},
};
Expand Down Expand Up @@ -428,6 +431,13 @@ impl<'a> Widget for TimeChart<'a> {
.y_bounds(self.y_axis.bounds)
.marker(self.marker)
.paint(|ctx| {
// Idea is to:
// - Go over all datasets, determine *where* a point will be drawn.
// - We take the topmost (last) point first.
// - After we determine all points, then we paint them all.
// This helps relieve the issue where normally, braille grids are painted via |=, when we want
// an exclusive replacement.

for dataset in &self.datasets {
let color = dataset.style.fg.unwrap_or(Color::Reset);

Expand Down
Loading