Debian Codegraph @

src/canvas/components/time_series/vendored.rs

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 //! A [`ratatui::widgets::Chart`] but slightly more specialized to show
2 //! right-aligned time_series data.
3 //!
4 //! Generally should be updated to be in sync with [`chart.rs`](https://github.com/ratatui-org/ratatui/blob/main/src/widgets/chart.rs);
5 //! the specializations are factored out to `time_series/points.rs`.
6
7 mod canvasrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/;
8 mod gridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/;
9 mod pointsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/points/;
10
11 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{
12 cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::{maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/max()., minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/min().},
13 strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#,
14 timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/::Instantrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/Instant#,
15 };
16
17 use canvasrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/::*;
18 use ratatuirust-analyzer cargo ratatui 0.30.2 crate/::{
19 bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/::Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#,
20 layoutrust-analyzer cargo ratatui-core 0.1.2 layout/::{Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#, Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#, Flexrust-analyzer cargo ratatui-core 0.1.2 layout/flex/Flex#, Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#, Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#},
21 stylerust-analyzer cargo ratatui-core 0.1.2 style/::{Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#, Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, Styledrust-analyzer cargo ratatui-core 0.1.2 style/stylize/Styled#},
22 symbolsrust-analyzer cargo ratatui-core 0.1.2 symbols/::{selfrust-analyzer cargo ratatui-core 0.1.2 symbols/, Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#},
23 textrust-analyzer cargo ratatui-core 0.1.2 text/::{Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#, Spanrust-analyzer cargo ratatui-core 0.1.2 text/span/Span#},
24 widgetsrust-analyzer cargo ratatui 0.30.2 widgets/::{Blockrust-analyzer cargo ratatui-widgets 0.3.2 block/Block#, BlockExtrust-analyzer cargo ratatui-widgets 0.3.2 block/BlockExt#, Bordersrust-analyzer cargo ratatui-widgets 0.3.2 borders/Borders#, GraphTyperust-analyzer cargo ratatui-widgets 0.3.2 chart/GraphType#, Widgetrust-analyzer cargo ratatui-core 0.1.2 widgets/widget/Widget#},
25 };
26 use timelessrust-analyzer cargo timeless 0.1.0 crate/::datarust-analyzer cargo timeless 0.1.0 data/::ChunkedDatarust-analyzer cargo timeless 0.1.0 data/chunked/ChunkedData#;
27 use unicode_widthrust-analyzer cargo unicode-width 0.2.2 crate/::UnicodeWidthStrrust-analyzer cargo unicode-width 0.2.2 UnicodeWidthStr#;
28
29 use craterust-analyzer cargo bottom 0.14.9 crate/::{
30 canvasrust-analyzer cargo bottom 0.14.9 canvas/::componentsrust-analyzer cargo bottom 0.14.9 canvas/components/::time_seriesrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/::LegendConstraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/base/LegendConstraints#,
31 utilsrust-analyzer cargo bottom 0.14.9 utils/::generalrust-analyzer cargo bottom 0.14.9 utils/general/::{saturating_log2rust-analyzer cargo bottom 0.14.9 utils/general/saturating_log2()., saturating_log10rust-analyzer cargo bottom 0.14.9 utils/general/saturating_log10().},
•32 utilsrust-analyzer cargo bottom 0.14.9 utils/::stringsrust-analyzer cargo bottom 0.14.9 utils/strings/::truncate_strrust-analyzer cargo bottom 0.14.9 utils/strings/truncate_str().,
33 };
34
35 pub const DEFAULT_LEGEND_CONSTRAINTSrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/DEFAULT_LEGEND_CONSTRAINTS.: LegendConstraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/base/LegendConstraints# = LegendConstraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/base/LegendConstraints# {
36 widthrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/base/LegendConstraints#width.: Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Ratiorust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Ratio#(1, 4),
37 heightrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/base/LegendConstraints#height.: Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Lengthrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Length#(4),
38 };
39
40 /// A single graph point.
41 pub type Pointrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Point# = (f64, f64);
42
43 /// An axis bound type. Allows us to save a f64 since we know that we are
44 /// usually bound from some values [0.0, a], or [-b, 0.0].
45 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
46 pub enum AxisBoundrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/AxisBound# {
47 /// Just 0.
48 #[defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/default:]
49 Zerorust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/AxisBound#Zero#,
50 /// Bound by a minimum value to 0.
51 Minrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/AxisBound#Min#(f64),
52 /// Bound by 0 and a max value.
53 Maxrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/AxisBound#Max#(f64),
54 }
55
56 impl AxisBoundrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/AxisBound# {
57 fn get_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[AxisBound]get_bounds().(&self) -> [f64; 2] {
58 match self {
59 AxisBoundrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/AxisBound#::Zerorust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/AxisBound#Zero# => [0.0, 0.0],
60 AxisBoundrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/AxisBound#::Minrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/AxisBound#Min#(min) => [*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().min, 0.0],
61 AxisBoundrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/AxisBound#::Maxrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/AxisBound#Max#(max) => [0.0, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().max],
62 }
63 }
64 }
65
66 /// An X or Y axis for the [`TimeChart`] widget
67 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
68 pub struct Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#<'a> {
69 /// Title displayed next to axis end
70 pub(craterust-analyzer cargo bottom 0.14.9 crate/) titlerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#title.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#<'a>>,
71 /// Bounds for the axis (all data points outside these limits will not be
72 /// represented)
73 pub(craterust-analyzer cargo bottom 0.14.9 crate/) boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#bounds.: AxisBoundrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/AxisBound#,
74 /// A list of labels to put to the left or below the axis
75 pub(craterust-analyzer cargo bottom 0.14.9 crate/) labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#labels.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Spanrust-analyzer cargo ratatui-core 0.1.2 text/span/Span#<'a>>>,
76 /// The style used to draw the axis itself
77 pub(craterust-analyzer cargo bottom 0.14.9 crate/) stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#,
78 /// The alignment of the labels of the Axis
79 pub(craterust-analyzer cargo bottom 0.14.9 crate/) labels_alignmentrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#labels_alignment.: Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#,
80 }
81
82 impl<'a> Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#<'a> {
83 /// Sets the axis title
84 ///
85 /// It will be displayed at the end of the axis. For an X axis this is the
86 /// right, for a Y axis, this is the top.
87 #[must_use = "method moves the value of self and returns the modified value"]
88 #[cfg_attr(not(test), expect(dead_code))]
89 pub fn titlerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`]title().<T>(mut self, title: T) -> Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#<'a>
90 where
91 T: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#<'a>>,
92 {
93 self.titlerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#title. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(title.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().());
94 self
95 }
96
97 /// Sets the bounds of this axis.
98 #[must_use = "method moves the value of self and returns the modified value"]
99 pub fn boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`]bounds().(mut self, bounds: AxisBoundrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/AxisBound#) -> Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#<'a> {
100 self.boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#bounds. = bounds;
101 self
102 }
103
104 /// Sets the axis labels
105 ///
106 /// - For the X axis, the labels are displayed left to right.
107 /// - For the Y axis, the labels are displayed bottom to top.
108 #[must_use = "method moves the value of self and returns the modified value"]
109 pub fn labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`]labels().(mut self, labels: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Spanrust-analyzer cargo ratatui-core 0.1.2 text/span/Span#<'a>>) -> Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#<'a> {
110 self.labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#labels. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(labels);
111 self
112 }
113
114 /// Sets the axis style.
115 #[must_use = "method moves the value of self and returns the modified value"]
116 pub fn stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`]style().<S: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#>>(mut self, style: S) -> Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#<'a> {
117 self.stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#style. = style.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
118 self
119 }
120
121 /// Sets the labels alignment of the axis
122 ///
123 /// The alignment behaves differently based on the axis:
124 /// - Y axis: The labels are aligned within the area on the left of the axis
125 /// - X axis: The first X-axis label is aligned relative to the Y-axis
126 ///
127 /// On the X axis, this parameter only affects the first label.
128 #[must_use = "method moves the value of self and returns the modified value"]
129 #[expect(dead_code)]
130 pub fn labels_alignmentrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`]labels_alignment().(mut self, alignment: Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#) -> Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#<'a> {
131 self.labels_alignmentrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#labels_alignment. = alignment;
132 self
133 }
134 }
135
136 /// Allow users to specify the position of a legend in a [`TimeChart`]
137 ///
138 /// See [`TimeChart::legend_position`]
139 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
140 pub enum LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition# {
141 /// Legend is centered on top
142 Toprust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Top#,
143 /// Legend is in the top-right corner. This is the **default**.
144 #[defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/default:]
145 TopRightrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#TopRight#,
146 /// Legend is in the top-left corner
147 TopLeftrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#TopLeft#,
148 /// Legend is centered on the left
149 Leftrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Left#,
150 /// Legend is centered on the right
151 Rightrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Right#,
152 /// Legend is centered on the bottom
153 Bottomrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Bottom#,
154 /// Legend is in the bottom-right corner
155 BottomRightrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#BottomRight#,
156 /// Legend is in the bottom-left corner
157 BottomLeftrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#BottomLeft#,
158 }
159
160 impl LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition# {
161 fn layoutrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition]layout().(
162 &self, area: Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#, legend_width: u16, legend_height: u16, x_title_width: u16,
163 y_title_width: u16,
164 ) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#> {
165 let mut height_margin = (area.heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().legend_height) as i32;
166 if x_title_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().0 {
167 height_margin rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`SubAssign<Self>`]sub_assign().1;
168 }
169 if y_title_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().0 {
170 height_margin rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`SubAssign<Self>`]sub_assign().1;
171 }
172 if height_margin rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().0 {
173 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
174 };
175
176 let (x, y) = match self {
177 Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition]::TopRightrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#TopRight# => {
178 if legend_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().y_title_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().area.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. {
179 (area.rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().legend_width, area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().1)
180 } else {
181 (area.rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().legend_width, area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().())
182 }
183 }
184 Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition]::TopLeftrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#TopLeft# => {
185 if y_title_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().0 {
186 (area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().(), area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().1)
187 } else {
188 (area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().(), area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().())
189 }
190 }
191 Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition]::Toprust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Top# => {
192 let x = (area.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().legend_width) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div().2;
193 if area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().y_title_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().x {
194 (area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().x, area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().1)
195 } else {
196 (area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().x, area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().())
197 }
198 }
199 Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition]::Leftrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Left# => {
200 let mut y = (area.heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().legend_height) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div().2;
201 if y_title_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().0 {
202 y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign().1;
203 }
204 if x_title_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().0 {
205 y = y.saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(1);
206 }
207 (area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().(), area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().y)
208 }
209 Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition]::Rightrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Right# => {
210 let mut y = (area.heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().legend_height) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div().2;
211 if y_title_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().0 {
212 y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign().1;
213 }
214 if x_title_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().0 {
215 y = y.saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(1);
216 }
217 (area.rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().legend_width, area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().y)
218 }
219 Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition]::BottomLeftrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#BottomLeft# => {
220 if x_title_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().legend_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().area.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. {
221 (area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().(), area.bottomrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]bottom().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().legend_height rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().1)
222 } else {
223 (area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().(), area.bottomrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]bottom().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().legend_height)
224 }
225 }
226 Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition]::BottomRightrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#BottomRight# => {
227 if x_title_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]ne().0 {
228 (
229 area.rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().legend_width,
230 area.bottomrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]bottom().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().legend_height rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().1,
231 )
232 } else {
233 (area.rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().legend_width, area.bottomrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]bottom().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().legend_height)
234 }
235 }
236 Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition]::Bottomrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Bottom# => {
237 let x = area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().(area.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().legend_width) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div().2;
238 if x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().legend_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().area.rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().x_title_width {
239 (x, area.bottomrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]bottom().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().legend_height rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().1)
240 } else {
241 (x, area.bottomrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]bottom().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().legend_height)
242 }
243 }
244 };
245
246 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(x, y, legend_width, legend_height))
247 }
248 }
249
250 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
251 pub struct ParseLegendPositionErrorrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ParseLegendPositionError#;
252
253 impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition# {
254 type Errrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition][FromStr]Err# = ParseLegendPositionErrorrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ParseLegendPositionError#;
255
256 fn from_strrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition][FromStr]from_str().(s: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition][FromStr], Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition][FromStr]::Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#Err#> {
257 match s {
258 "top" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition][FromStr]::Toprust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Top#),
259 "top-left" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition][FromStr]::TopLeftrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#TopLeft#),
260 "top-right" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition][FromStr]::TopRightrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#TopRight#),
261 "left" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition][FromStr]::Leftrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Left#),
262 "right" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition][FromStr]::Rightrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Right#),
263 "bottom-left" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition][FromStr]::BottomLeftrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#BottomLeft#),
264 "bottom" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition][FromStr]::Bottomrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Bottom#),
265 "bottom-right" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition][FromStr]::BottomRightrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#BottomRight#),
266 _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ParseLegendPositionErrorrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ParseLegendPositionError#),
267 }
268 }
269 }
270
271 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
272 enum Datarust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Data#<'a, F> {
273 Somerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Data#Some# {
274 timesrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Data#Some#times.: &'a [Instantrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/Instant#],
275 valuesrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Data#Some#values.: &'a ChunkedDatarust-analyzer cargo timeless 0.1.0 data/chunked/ChunkedData#<F>,
276 },
277 #[defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/default:]
278 Nonerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Data#None#,
279 }
280
281 /// A group of data points
282 ///
283 /// This is the main element composing a [`TimeChart`].
284 ///
285 /// A dataset can be [named](Dataset::name). Only named datasets will be
286 /// rendered in the legend.
287 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
288 pub struct Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#<'a, F: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy# + Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# + Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<f64> = f64> {
289 /// Name of the dataset (used in the legend if shown)
290 namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#name.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#<'a>>,
291 /// A reference to data.
292 datarust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#data.: Datarust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Data#<'a, F>,
293 /// Symbol used for each points of this dataset
294 markerrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#marker.: symbolsrust-analyzer cargo ratatui-core 0.1.2 symbols/::Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#,
295 /// Determines graph type used for drawing points
296 graph_typerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#graph_type.: GraphTyperust-analyzer cargo ratatui-widgets 0.3.2 chart/GraphType#,
297 /// Style used to plot this dataset
298 stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#,
299 }
300
301 impl<'a, F: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy# + Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# + Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<f64>> Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#<'a, F> {
302 /// Sets the name of the dataset.
303 #[must_use = "method moves the value of self and returns the modified value"]
304 pub fn namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().<S>(mut self, name: S) -> Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#<'a, F>
305 where
306 S: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#<'a>>,
307 {
308 self.namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#name. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(name.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().());
309 self
310 }
311
312 /// Sets the data points of this dataset
313 ///
314 /// Points will then either be rendered as scattered points or with lines
315 /// between them depending on [`Dataset::graph_type`].
316 ///
317 /// Data consist in an array of `f64` tuples (`(f64, f64)`), the first
318 /// element being X and the second Y. It's also worth noting that,
319 /// unlike the [`Rect`], here the Y axis is bottom to top, as in math.
320 #[must_use = "method moves the value of self and returns the modified value"]
321 pub fn datarust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]data().(mut self, times: &'a [Instantrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/Instant#], values: &'a ChunkedDatarust-analyzer cargo timeless 0.1.0 data/chunked/ChunkedData#<F>) -> Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#<'a, F> {
322 self.datarust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#data. = Datarust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Data#::Somerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Data#Some# { timesrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Data#Some#times., valuesrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Data#Some#values. };
323 self
324 }
325
326 /// Sets the kind of character to use to display this dataset
327 ///
328 /// You can use dots (`•`), blocks (`█`), bars (`▄`), braille (`⠓`, `⣇`,
329 /// `⣿`) or half-blocks (`█`, `▄`, and `▀`). See [symbols::Marker] for
330 /// more details.
331 ///
332 /// Note [`Marker::Braille`] requires a font that supports Unicode Braille
333 /// Patterns.
334 #[must_use = "method moves the value of self and returns the modified value"]
335 #[expect(dead_code)]
336 pub fn markerrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]marker().(mut self, marker: symbolsrust-analyzer cargo ratatui-core 0.1.2 symbols/::Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#) -> Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#<'a, F> {
337 self.markerrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#marker. = marker;
338 self
339 }
340
341 /// Sets how the dataset should be drawn
342 ///
343 /// [`TimeChart`] can draw either a [scatter](GraphType::Scatter) or
344 /// [line](GraphType::Line) charts. A scatter will draw only the points
345 /// in the dataset while a line will also draw a line between them. See
346 /// [`GraphType`] for more details
347 #[must_use = "method moves the value of self and returns the modified value"]
348 pub fn graph_typerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]graph_type().(mut self, graph_type: GraphTyperust-analyzer cargo ratatui-widgets 0.3.2 chart/GraphType#) -> Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#<'a, F> {
349 self.graph_typerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#graph_type. = graph_type;
350 self
351 }
352
353 /// Sets the style of this dataset
354 ///
355 /// The given style will be used to draw the legend and the data points.
356 /// Currently the legend will use the entire style whereas the data
357 /// points will only use the foreground.
358 ///
359 /// `style` accepts any type that is convertible to [`Style`] (e.g.
360 /// [`Style`], [`Color`], or your own type that implements
361 /// [`Into<Style>`]).
362 #[must_use = "method moves the value of self and returns the modified value"]
363 pub fn stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]style().<S: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#>>(mut self, style: S) -> Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#<'a, F> {
364 self.stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#style. = style.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
365 self
366 }
367 }
368
369 /// A container that holds all the infos about where to display each elements of
370 /// the chart (axis, labels, legend, ...).
371 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
372 struct ChartLayoutrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout# {
373 /// Location of the title of the x axis
374 title_xrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#title_x.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(u16, u16)>,
375 /// Location of the title of the y axis
376 title_yrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#title_y.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(u16, u16)>,
377 /// Location of the first label of the x axis
378 label_xrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#label_x.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u16>,
379 /// Location of the first label of the y axis
380 label_yrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#label_y.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u16>,
381 /// Y coordinate of the horizontal axis
382 axis_xrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#axis_x.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u16>,
383 /// X coordinate of the vertical axis
384 axis_yrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#axis_y.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u16>,
385 /// Area of the legend
386 legend_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#legend_area.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#>,
387 /// Area of the graph
388 graph_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#graph_area.: Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#,
389 }
390
391 /// Whether to additionally scale all values before displaying them. Defaults to
392 /// none.
393 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:)]
394 pub(craterust-analyzer cargo bottom 0.14.9 crate/) enum ChartScalingrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartScaling# {
395 #[defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/default:]
396 Linearrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartScaling#Linear#,
397 Log10rust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartScaling#Log10#,
398 Log2rust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartScaling#Log2#,
399 }
400
401 impl ChartScalingrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartScaling# {
402 /// Scale a value.
403 pub(superrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/) fn scalerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[ChartScaling]scale().(&self, value: f64) -> f64 {
404 // Remember to do saturating log checks as otherwise 0.0 becomes inf, and you
405 // get gaps!
406 match self {
407 ChartScalingrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartScaling#::Linearrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartScaling#Linear# => value,
408 ChartScalingrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartScaling#::Log10rust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartScaling#Log10# => saturating_log10rust-analyzer cargo bottom 0.14.9 utils/general/saturating_log10().(value),
409 ChartScalingrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartScaling#::Log2rust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartScaling#Log2# => saturating_log2rust-analyzer cargo bottom 0.14.9 utils/general/saturating_log2().(value),
410 }
411 }
412 }
413
414 /// A "custom" chart, just a slightly tweaked [`ratatui::widgets::Chart`] from
415 /// ratatui, but with greater control over the legend, and built with the idea
416 /// of drawing data points relative to a time-based x-axis.
417 ///
418 /// Main changes:
419 /// - Styling option for the legend box
420 /// - Automatically trimming out redundant draws in the x-bounds.
421 /// - Automatic interpolation to points that fall *just* outside of the screen.
422 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
423 pub(superrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/) struct TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#<'a, F: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy# + Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# + Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<f64> = f64> {
424 /// A block to display around the widget eventually
425 blockrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#block.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Blockrust-analyzer cargo ratatui-widgets 0.3.2 block/Block#<'a>>,
426 /// The horizontal axis
427 x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#x_axis.: Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#<'a>,
428 /// The vertical axis
429 y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#y_axis.: Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#<'a>,
430 /// A reference to the datasets
431 datasetsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#datasets.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#<'a, F>>,
432 /// The widget base style
433 stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#,
434 /// The legend's style.
435 legend_stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#legend_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#,
436 /// Constraints used to determine whether the legend should be shown or not.
437 hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#hidden_legend_constraints.: (Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#, Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#),
438 /// The position determining whether the length is shown or hidden,
439 /// regardless of `hidden_legend_constraints`
440 legend_positionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#legend_position.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#>,
441 /// The marker type.
442 markerrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#marker.: Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#,
443 /// Whether to scale the values differently.
444 scalingrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#scaling.: ChartScalingrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartScaling#,
445 }
446
447 impl<'a, F: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy# + Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# + Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<f64>> TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#<'a, F> {
448 /// Creates a chart with the given [datasets](Dataset).
449 pub fn newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]new().(datasets: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#<'a, F>>) -> TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#<'a, F> {
450 TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart# {
451 blockrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#block.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
452 x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#x_axis.: Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`][Default]default().(),
453 y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#y_axis.: Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`][Default]default().(),
454 stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#::defaultrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style][Default]default().(),
455 legend_stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#legend_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#::defaultrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style][Default]default().(),
456 datasetsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#datasets.,
457 hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#hidden_legend_constraints.: (Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Ratiorust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Ratio#(1, 4), Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Ratiorust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Ratio#(1, 4)),
458 legend_positionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#legend_position.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition][Default]default().()),
459 markerrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#marker.: Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#::Braillerust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#Braille#,
460 scalingrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#scaling.: ChartScalingrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartScaling#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[ChartScaling][Default]default().(),
461 }
462 }
463
464 /// Wraps the chart with the given [`Block`]
465 #[must_use = "method moves the value of self and returns the modified value"]
466 pub fn blockrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]block().(mut self, block: Blockrust-analyzer cargo ratatui-widgets 0.3.2 block/Block#<'a>) -> TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#<'a, F> {
467 self.blockrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#block. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(block);
468 self
469 }
470
471 /// Sets the style of the entire chart
472 ///
473 /// `style` accepts any type that is convertible to [`Style`] (e.g.
474 /// [`Style`], [`Color`], or your own type that implements
475 /// [`Into<Style>`]).
476 ///
477 /// Styles of [`Axis`] and [`Dataset`] will have priority over this style.
478 #[must_use = "method moves the value of self and returns the modified value"]
479 pub fn stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]style().<S: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#>>(mut self, style: S) -> TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#<'a, F> {
480 self.stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#style. = style.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
481 self
482 }
483
484 /// Sets the legend's style.
485 #[must_use = "method moves the value of self and returns the modified value"]
486 pub fn legend_stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]legend_style().(mut self, legend_style: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#) -> TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#<'a, F> {
487 self.legend_stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#legend_style. = legend_style;
488 self
489 }
490
491 /// Sets the X [`Axis`]
492 ///
493 /// The default is an empty [`Axis`], i.e. only a line.
494 #[must_use = "method moves the value of self and returns the modified value"]
495 pub fn x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]x_axis().(mut self, axis: Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#<'a>) -> TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#<'a, F> {
496 self.x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#x_axis. = axis;
497 self
498 }
499
500 /// Sets the Y [`Axis`]
501 ///
502 /// The default is an empty [`Axis`], i.e. only a line.
503 #[must_use = "method moves the value of self and returns the modified value"]
504 pub fn y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]y_axis().(mut self, axis: Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#<'a>) -> TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#<'a, F> {
505 self.y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#y_axis. = axis;
506 self
507 }
508
509 /// Sets the marker type.
510 #[must_use = "method moves the value of self and returns the modified value"]
511 pub fn markerrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]marker().(mut self, marker: Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#) -> TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#<'a, F> {
512 self.markerrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#marker. = marker;
513 self
514 }
515
516 /// Sets the constraints used to determine whether the legend should be
517 /// shown or not.
518 ///
519 /// The tuple's first constraint is used for the width and the second for
520 /// the height. If the legend takes more space than what is allowed by
521 /// any constraint, the legend is hidden. [`Constraint::Min`] is an
522 /// exception and will always show the legend.
523 ///
524 /// If this is not set, the default behavior is to hide the legend if it is
525 /// greater than 25% of the chart, either horizontally or vertically.
526 #[must_use = "method moves the value of self and returns the modified value"]
527 pub fn hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]hidden_legend_constraints().(
528 mut self, constraints: (Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#, Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#),
529 ) -> TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#<'a, F> {
530 self.hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#hidden_legend_constraints. = constraints;
531 self
532 }
533
534 /// Sets the position of a legend or hide it.
535 ///
536 /// The default is [`LegendPosition::TopRight`].
537 ///
538 /// If [`None`] is given, hide the legend even if
539 /// [`hidden_legend_constraints`] determines it should be shown. In
540 /// contrast, if `Some(...)` is given, [`hidden_legend_constraints`] might
541 /// still decide whether to show the legend or not.
542 ///
543 /// See [`LegendPosition`] for all available positions.
544 ///
545 /// [`hidden_legend_constraints`]: Self::hidden_legend_constraints
546 #[must_use = "method moves the value of self and returns the modified value"]
547 pub fn legend_positionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]legend_position().(mut self, position: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#>) -> TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#<'a, F> {
548 self.legend_positionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#legend_position. = position;
549 self
550 }
551
552 /// Set chart scaling.
553 #[must_use = "method moves the value of self and returns the modified value"]
554 pub fn scalingrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]scaling().(mut self, scaling: ChartScalingrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartScaling#) -> TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#<'a, F> {
555 self.scalingrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#scaling. = scaling;
556 self
557 }
558
559 /// Compute the internal layout of the chart given the area. If the area is
560 /// too small some elements may be automatically hidden
561 fn layoutrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]layout().(&self, area: Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#) -> ChartLayoutrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout# {
562 let mut layout = ChartLayoutrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[ChartLayout][Default]default().();
563 if area.heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().0 || area.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().0 {
564 return layout;
565 }
566 let mut x = area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().();
567 let mut y = area.bottomrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]bottom().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().1;
568
569 if self.x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#x_axis..labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#labels..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() && y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().() {
570 layout.label_xrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#label_x. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(y);
571 y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`SubAssign<Self>`]sub_assign().1;
572 }
573
574 layout.label_yrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#label_y. = self.y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#y_axis..labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#labels..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().andrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(x));
575 x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign().self.max_width_of_labels_left_of_y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]max_width_of_labels_left_of_y_axis().(area, self.y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#y_axis..labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#labels..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().());
576
577 if self.x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#x_axis..labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#labels..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() && y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().() {
578 layout.axis_xrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#axis_x. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(y);
579 y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`SubAssign<Self>`]sub_assign().1;
580 }
581
582 if self.y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#y_axis..labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#labels..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() && x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().area.rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().() {
583 layout.axis_yrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#axis_y. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(x);
584 x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`AddAssign<Self>`]add_assign().1;
585 }
586
587 if x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().area.rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().() && y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().1 {
588 layout.graph_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#graph_area. = Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(x, area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().(), area.rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().x, y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().1);
589 }
590
591 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref title) = self.x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#x_axis..titlerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#title. {
592 let w = title.widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().() as u16;
593 if w rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().layout.graph_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#graph_area..widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. && layout.graph_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#graph_area..heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().2 {
594 layout.title_xrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#title_x. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().layout.graph_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#graph_area..widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().w, y));
595 }
596 }
597
598 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref title) = self.y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#y_axis..titlerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#title. {
599 let w = title.widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().() as u16;
600 if w rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().layout.graph_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#graph_area..widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. && layout.graph_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#graph_area..heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().2 {
601 layout.title_yrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#title_y. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((x, area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().()));
602 }
603 }
604
605 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(legend_position) = self.legend_positionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#legend_position. {
606 let entry_widths: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u16> = self
607 .datasetsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#datasets.
608 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
609 .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|d| Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(d.namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#name..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()..widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().() as u16))
610 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
611
612 let entry_count = entry_widths.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() as u16;
613
614 if entry_count rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().0 {
615 let [max_legend_width] = Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#::horizontalrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]horizontal().([self.hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#hidden_legend_constraints..0])
616 .flexrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]flex().(Flexrust-analyzer cargo ratatui-core 0.1.2 layout/flex/Flex#::Startrust-analyzer cargo ratatui-core 0.1.2 layout/flex/Flex#Start#)
617 .areasrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]areas().(layout.graph_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#graph_area.);
618
619 let [max_legend_height] = Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#::verticalrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]vertical().([self.hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#hidden_legend_constraints..1])
620 .flexrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]flex().(Flexrust-analyzer cargo ratatui-core 0.1.2 layout/flex/Flex#::Startrust-analyzer cargo ratatui-core 0.1.2 layout/flex/Flex#Start#)
621 .areasrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]areas().(layout.graph_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#graph_area.);
622
623 let max_entries = minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/min().(entry_count, max_legend_height.heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height..saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(2));
624 let visible = &entry_widths[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#max_entries as usize]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().;
625
626 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&max_width) = visible.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#max().() {
627 let min_width = visible.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#min().().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(0);
628 let min_required_width = min_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().2;
629
630 let legend_width = max_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().2;
631 let legend_height = max_entries rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().2;
632
633 if max_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().0
634 && max_legend_width.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge().min_required_width
635 && max_entries rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().0
636 {
637 layout.legend_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#legend_area. = legend_position.layoutrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[LegendPosition]layout().(
638 layout.graph_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#graph_area.,
639 minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/min().(legend_width, max_legend_width.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width.),
640 legend_height,
641 layout
642 .title_xrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#title_x.
643 .andrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and().(self.x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#x_axis..titlerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#title..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().())
644 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|t| t.widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().() as u16)
645 .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().(),
646 layout
647 .title_yrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#title_y.
648 .andrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and().(self.y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#y_axis..titlerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#title..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().())
649 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|t| t.widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().() as u16)
650 .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().(),
651 );
652 }
653 }
654 }
655 }
656 layout
657 }
658
659 fn max_width_of_labels_left_of_y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]max_width_of_labels_left_of_y_axis().(&self, area: Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#, has_y_axis: bool) -> u16 {
660 let mut max_width = self
661 .y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#y_axis.
662 .labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#labels.
663 .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()
664 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|l| l.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Spanrust-analyzer cargo ratatui-core 0.1.2 text/span/Span#::widthrust-analyzer cargo ratatui-core 0.1.2 text/span/impl#[`Span<'a>`]width().).maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#max().().unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().() as u16)
665 .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().();
666
667 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(first_x_label) = self
668 .x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#x_axis.
669 .labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#labels.
670 .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()
671 .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|labels| labels.firstrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]first().())
672 {
673 let first_label_width = first_x_label.contentrust-analyzer cargo ratatui-core 0.1.2 text/span/Span#content..widthrust-analyzer cargo unicode-width 0.2.2 impl#[str][UnicodeWidthStr]width().() as u16;
674 let width_left_of_y_axis = match self.x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#x_axis..labels_alignmentrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#labels_alignment. {
675 Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#::Leftrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/HorizontalAlignment#Left# => {
676 // The last character of the label should be below the Y-Axis when it exists,
677 // not on its left
678 let y_axis_offset = u16::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u16][`From<bool>`]from().(has_y_axis);
679 first_label_width.saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(y_axis_offset)
680 }
681 Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#::Centerrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/HorizontalAlignment#Center# => first_label_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div().2,
682 Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#::Rightrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/HorizontalAlignment#Right# => 0,
683 };
684 max_width = maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/max().(max_width, width_left_of_y_axis);
685 }
686 // labels of y axis and first label of x axis can take at most 1/3rd of the
687 // total width
688 max_width.minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#min().(area.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div().3)
689 }
690
691 fn render_x_labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]render_x_labels().(
692 &self, buf: &mut Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#, layout: &ChartLayoutrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#, chart_area: Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#, graph_area: Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#,
693 ) {
694 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(y) = layout.label_xrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#label_x. else { return };
695 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(labels) = self.x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#x_axis..labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#labels..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() else {
696 return;
697 };
698 let labels_len = labels.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() as u16;
699 if labels_len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().2 {
700 return;
701 }
702
703 let first_label = labels.firstrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]first().().expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("must have at least 2 labels");
704 let last_label = labels.lastrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]last().().expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("must have at least 2 labels");
705
706 let width_between_ticks = graph_area.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div().labels_len;
707
708 let label_area = self.first_x_label_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]first_x_label_area().(
709 y,
710 first_label.widthrust-analyzer cargo ratatui-core 0.1.2 text/span/impl#[`Span<'a>`]width().() as u16,
711 width_between_ticks,
712 chart_area,
713 graph_area,
714 );
715
716 let label_alignment = match self.x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#x_axis..labels_alignmentrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#labels_alignment. {
717 Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#::Leftrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/HorizontalAlignment#Left# => Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#::Rightrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/HorizontalAlignment#Right#,
718 Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#::Centerrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/HorizontalAlignment#Center# => Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#::Centerrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/HorizontalAlignment#Center#,
719 Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#::Rightrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/HorizontalAlignment#Right# => Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#::Leftrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/HorizontalAlignment#Left#,
720 };
721
722 Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]::render_labelrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]render_label().(buf, first_label, label_area, label_alignment);
723
724 for (i, label) in labels[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#labels.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() {
725 // We add 1 to x (and width-1 below) to leave at least one space before each
726 // intermediate labels
727 let x = graph_area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().(i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1) as u16 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().width_between_ticks rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().1;
728 let label_area = Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(x, y, width_between_ticks.saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(1), 1);
729
730 Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]::render_labelrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]render_label().(buf, label, label_area, Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#::Centerrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/HorizontalAlignment#Center#);
731 }
732
733 let x = graph_area.rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().width_between_ticks;
734 let label_area = Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(x, y, width_between_ticks, 1);
735 // The last label should be aligned Right to be at the edge of the graph area
736 Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]::render_labelrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]render_label().(buf, last_label, label_area, Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#::Rightrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/HorizontalAlignment#Right#);
737 }
738
739 fn first_x_label_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]first_x_label_area().(
740 &self, y: u16, label_width: u16, max_width_after_y_axis: u16, chart_area: Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#,
741 graph_area: Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#,
742 ) -> Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect# {
743 let (min_x, max_x) = match self.x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#x_axis..labels_alignmentrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#labels_alignment. {
744 Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#::Leftrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/HorizontalAlignment#Left# => (chart_area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().(), graph_area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().()),
745 Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#::Centerrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/HorizontalAlignment#Center# => (
746 chart_area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().(),
747 graph_area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().max_width_after_y_axis.minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#min().(label_width),
748 ),
749 Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#::Rightrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/HorizontalAlignment#Right# => (
750 graph_area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().().saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(1),
751 graph_area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().max_width_after_y_axis,
752 ),
753 };
754
755 Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(min_x, y, max_x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().min_x, 1)
756 }
757
758 fn render_labelrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]render_label().(buf: &mut Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#, label: &Spanrust-analyzer cargo ratatui-core 0.1.2 text/span/Span#<'_>, label_area: Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#, alignment: Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#) {
759 let label_width = label.widthrust-analyzer cargo ratatui-core 0.1.2 text/span/impl#[`Span<'a>`]width().() as u16;
760 let bounded_label_width = label_area.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width..minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#min().(label_width);
761
762 let x = match alignment {
763 Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#::Leftrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/HorizontalAlignment#Left# => label_area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().(),
764 Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#::Centerrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/HorizontalAlignment#Center# => label_area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().label_area.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div().2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().bounded_label_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div().2,
765 Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#::Rightrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/HorizontalAlignment#Right# => label_area.rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().bounded_label_width,
766 };
767
768 buf.set_spanrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_span().(x, label_area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().(), label, bounded_label_width);
769 }
770
771 fn render_y_labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]render_y_labels().(
772 &self, buf: &mut Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#, layout: &ChartLayoutrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#, chart_area: Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#, graph_area: Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#,
773 ) {
774 // FIXME: Control how many y-axis labels are rendered based on height.
775
776 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(x) = layout.label_yrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#label_y. else { return };
777 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(labels) = self.y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#y_axis..labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#labels..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() else {
778 return;
779 };
780 let labels_len = labels.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() as u16;
781
782 for (i, label) in labels.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() {
783 let dy = i as u16 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Mul<Self>`]mul().(graph_area.heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().1) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Div<Self>`]div().(labels_len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().1);
784 if dy rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().graph_area.bottomrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]bottom().() {
785 let label_area = Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(
786 x,
787 graph_area.bottomrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]bottom().().saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(1) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().dy,
788 (graph_area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().chart_area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().()).saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(1),
789 1,
790 );
791 Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]::render_labelrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]render_label().(buf, label, label_area, self.y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#y_axis..labels_alignmentrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#labels_alignment.);
792 }
793 }
794 }
795 }
796
797 impl<F: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy# + Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# + Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<f64>> Widgetrust-analyzer cargo ratatui-core 0.1.2 widgets/widget/Widget# for TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#<'_, F> {
798 fn renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'_, F>`][Widget]render().(self, area: Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#, buf: &mut Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#) {
799 buf.set_stylerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_style().(area, self.stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#style.);
800
801 self.blockrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#block..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().renderrust-analyzer cargo ratatui-core 0.1.2 widgets/widget/impl#[`Option<W>`][Widget]render().(area, buf);
802 let chart_area = self.blockrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#block..inner_if_somerust-analyzer cargo ratatui-widgets 0.3.2 block/impl#[`Option<Block<'_>>`][BlockExt]inner_if_some().(area);
803 if chart_area.is_emptyrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]is_empty().() {
804 return;
805 }
806
807 // Sample the style of the entire widget. This sample will be used to reset the
808 // style of the cells that are part of the components put on top of the
809 // graph area (i.e legend and axis names).
810 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(original_style) = buf.cellrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]cell().((area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().(), area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().())).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|cell| cell.stylerust-analyzer cargo ratatui-core 0.1.2 buffer/cell/impl#[Cell]style().())
811 else {
812 return;
813 };
814
815 let layout = self.layoutrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]layout().(chart_area);
816 let graph_area = layout.graph_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#graph_area.;
817 if graph_area.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().1 || graph_area.heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().1 {
818 return;
819 }
820
821 self.render_x_labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]render_x_labels().(buf, &layout, chart_area, graph_area);
822 self.render_y_labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]render_y_labels().(buf, &layout, chart_area, graph_area);
823
824 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(y) = layout.axis_xrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#axis_x. {
825 for x in graph_area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().()..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#graph_area.rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().() {
826 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(cell) = buf.cell_mutrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]cell_mut().((x, y)) {
827 cell.set_symbolrust-analyzer cargo ratatui-core 0.1.2 buffer/cell/impl#[Cell]set_symbol().(symbolsrust-analyzer cargo ratatui-core 0.1.2 symbols/::linerust-analyzer cargo ratatui-core 0.1.2 symbols/line/::HORIZONTALrust-analyzer cargo ratatui-core 0.1.2 symbols/line/HORIZONTAL.)
828 .set_stylerust-analyzer cargo ratatui-core 0.1.2 buffer/cell/impl#[Cell]set_style().(self.x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#x_axis..stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#style.);
829 }
830 }
831 }
832
833 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(x) = layout.axis_yrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#axis_y. {
834 for y in graph_area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().()..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#graph_area.bottomrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]bottom().() {
835 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(cell) = buf.cell_mutrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]cell_mut().((x, y)) {
836 cell.set_symbolrust-analyzer cargo ratatui-core 0.1.2 buffer/cell/impl#[Cell]set_symbol().(symbolsrust-analyzer cargo ratatui-core 0.1.2 symbols/::linerust-analyzer cargo ratatui-core 0.1.2 symbols/line/::VERTICALrust-analyzer cargo ratatui-core 0.1.2 symbols/line/VERTICAL.)
837 .set_stylerust-analyzer cargo ratatui-core 0.1.2 buffer/cell/impl#[Cell]set_style().(self.y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#y_axis..stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#style.);
838 }
839 }
840 }
841
842 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(y) = layout.axis_xrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#axis_x.
843 && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(x) = layout.axis_yrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#axis_y.
844 && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(cell) = buf.cell_mutrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]cell_mut().((x, y))
845 {
846 cell.set_symbolrust-analyzer cargo ratatui-core 0.1.2 buffer/cell/impl#[Cell]set_symbol().(symbolsrust-analyzer cargo ratatui-core 0.1.2 symbols/::linerust-analyzer cargo ratatui-core 0.1.2 symbols/line/::BOTTOM_LEFTrust-analyzer cargo ratatui-core 0.1.2 symbols/line/BOTTOM_LEFT.)
847 .set_stylerust-analyzer cargo ratatui-core 0.1.2 buffer/cell/impl#[Cell]set_style().(self.x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#x_axis..stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#style.);
848 }
849
850 let x_bounds = self.x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#x_axis..boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#bounds..get_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[AxisBound]get_bounds().();
851 let y_bounds = self.y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#y_axis..boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#bounds..get_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[AxisBound]get_bounds().();
852
853 Canvasrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Canvas<'a, F>`][Default]default().()
854 .background_colorrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Canvas<'a, F>`]background_color().(self.stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#style..bgrust-analyzer cargo ratatui-core 0.1.2 style/Style#bg..unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Resetrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Reset#))
855 .x_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Canvas<'a, F>`]x_bounds().(x_bounds)
856 .y_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Canvas<'a, F>`]y_bounds().(y_bounds)
857 .markerrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Canvas<'a, F>`]marker().(self.markerrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#marker.)
858 .paintrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Canvas<'a, F>`]paint().(|ctx| {
859 self.draw_pointsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/points/impl#[`TimeChart<'_, F>`]draw_points().(ctx);
860 })
861 .renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Canvas<'_, F>`][Widget]render().(graph_area, buf);
862
863 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((x, y)) = layout.title_xrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#title_x.
864 && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(title) = self.x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#x_axis..titlerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#title..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()
865 {
866 let width = graph_area
867 .rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().()
868 .saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(x)
869 .minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#min().(title.widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().() as u16);
870 buf.set_stylerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_style().(
871 Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect# {
872 xrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#x.,
873 yrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#y.,
874 widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width.,
875 heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height.: 1,
876 },
877 original_style,
878 );
879 buf.set_linerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_line().(x, y, title, width);
880 }
881
882 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((x, y)) = layout.title_yrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#title_y.
883 && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(title) = self.y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#y_axis..titlerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#title..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()
884 {
885 let width = graph_area
886 .rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().()
887 .saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(x)
888 .minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#min().(title.widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().() as u16);
889 buf.set_stylerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_style().(
890 Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect# {
891 xrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#x.,
892 yrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#y.,
893 widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width.,
894 heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height.: 1,
895 },
896 original_style,
897 );
898 buf.set_linerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_line().(x, y, title, width);
899 }
900
901 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(legend_area) = layout.legend_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#legend_area. {
902 buf.set_stylerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_style().(legend_area, original_style);
903
904 let block = Blockrust-analyzer cargo ratatui-widgets 0.3.2 block/Block#::defaultrust-analyzer cargo ratatui-widgets 0.3.2 block/impl#[`Block<'a>`][Default]default().()
905 .bordersrust-analyzer cargo ratatui-widgets 0.3.2 block/impl#[`Block<'a>`]borders().(Bordersrust-analyzer cargo ratatui-widgets 0.3.2 borders/Borders#::ALLrust-analyzer cargo ratatui-widgets 0.3.2 borders/impl#[Borders]ALL.)
906 .border_stylerust-analyzer cargo ratatui-widgets 0.3.2 block/impl#[`Block<'a>`]border_style().(self.legend_stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#legend_style.);
907
908 for pos in block.innerrust-analyzer cargo ratatui-widgets 0.3.2 block/impl#[`Block<'a>`]inner().(legend_area).positionsrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]positions().() {
909 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(cell) = buf.cell_mutrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]cell_mut().(pos) {
910 cell.set_symbolrust-analyzer cargo ratatui-core 0.1.2 buffer/cell/impl#[Cell]set_symbol().(" ");
911 }
912 }
913
914 block.renderrust-analyzer cargo ratatui-widgets 0.3.2 block/impl#[`Block<'_>`][Widget]render().(legend_area, buf);
915
916 let max_width = legend_area.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().2;
917
918 for (i, (dataset_name, dataset_style)) in self
919 .datasetsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#datasets.
920 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
921 .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|ds| Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((ds.namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#name..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()., ds.stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Styled]style().())))
922 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
923 .takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().((legend_area.heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().2) as usize)
924 {
925 let line = if dataset_name.widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().() as u16 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]le().max_width {
926 dataset_name.clonerust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`][Clone]clone().()
927 } else {
928 let inner = dataset_name.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().();
•929 let truncated = truncate_strrust-analyzer cargo bottom 0.14.9 utils/strings/truncate_str().(&inner, max_width as usize);
930
931 Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#::fromrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'_>`][`From<String>`]from().(truncated.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())
932 };
933
934 let name = line.patch_stylerust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]patch_style().(dataset_style);
935 name.renderrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'_>`][Widget]render().(
936 Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect# {
937 xrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#x.: legend_area.xrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#x. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().1,
938 yrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#y.: legend_area.yrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#y. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().i as u16,
939 widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width.: max_width,
940 heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height.: 1,
941 },
942 buf,
943 );
944 }
945 }
946 }
947 }
948
949 impl<'a> Styledrust-analyzer cargo ratatui-core 0.1.2 style/stylize/Styled# for Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#<'a> {
950 type Itemrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`][Styled]Item# = Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#<'a>;
951
952 fn stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`][Styled]style().(&self) -> Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style# {
953 self.stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#style.
954 }
955
956 fn set_stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`][Styled]set_style().<S: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#>>(self, style: S) -> Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`][Styled]::Itemrust-analyzer cargo ratatui-core 0.1.2 style/stylize/Styled#Item# {
957 self.stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`]style().(style)
958 }
959 }
960
961 impl<'a, F: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy# + Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# + Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<f64>> Styledrust-analyzer cargo ratatui-core 0.1.2 style/stylize/Styled# for Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#<'a, F> {
962 type Itemrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Styled]Item# = Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#<'a, F>;
963
964 fn stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Styled]style().(&self) -> Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style# {
965 self.stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#style.
966 }
967
968 fn set_stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Styled]set_style().<S: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#>>(self, style: S) -> Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Styled]::Itemrust-analyzer cargo ratatui-core 0.1.2 style/stylize/Styled#Item# {
969 self.stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]style().(style)
970 }
971 }
972
973 impl<'a, F: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy# + Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# + Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<f64>> Styledrust-analyzer cargo ratatui-core 0.1.2 style/stylize/Styled# for TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#<'a, F> {
974 type Itemrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`][Styled]Item# = TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#<'a, F>;
975
976 fn stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`][Styled]style().(&self) -> Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style# {
977 self.stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#style.
978 }
979
980 fn set_stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`][Styled]set_style().<S: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#>>(self, style: S) -> Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`][Styled]::Itemrust-analyzer cargo ratatui-core 0.1.2 style/stylize/Styled#Item# {
981 self.stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]style().(style)
982 }
983 }
984
985 /// Tests taken from ratatui.
986 #[cfg(test)]
987 mod testsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/ {
988 macro_rules! assert_buffer_eqrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/assert_buffer_eq! {
989 ($actual_expr:expr, $expected_expr:expr) => {
990 match (&$actual_expr, &$expected_expr) {
991 (actual, expected) => {
992 if actual.area != expected.area {
993 panic!(
994 "buffer areas not equal - expected: {expected:?} - actual: {actual:?}",
995 );
996 }
997 let diff = expected.diff(&actual);
998 if !diff.is_empty() {
999 let nice_diff = diff
1000 .iter()
1001 .enumerate()
1002 .map(|(i, (x, y, cell))| {
1003 let expected_cell = expected.cell((*x, *y)).unwrap();
1004 indoc::formatdoc! {"
1005 {i}: at ({x}, {y})
1006 expected: {expected_cell:?}
1007 actual: {cell:?}
1008 "}
1009 })
1010 .collect::<Vec<String>>()
1011 .join("\n");
1012 panic!(
1013 indoc::indoc!(
1014 "
1015 buffer contents not equal
1016 expected: {:?}
1017 actual: {:?}
1018 diff:
1019 {}"
1020 ),
1021 expected, actual, nice_diff
1022 );
1023 }
1024 // shouldn't get here, but this guards against future behavior
1025 // that changes equality but not area or content
1026 assert_eq!(actual, expected, "buffers not equal");
1027 }
1028 }
1029 };
1030 }
1031
1032 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/::Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#;
1033
1034 use ratatuirust-analyzer cargo ratatui 0.30.2 crate/::stylerust-analyzer cargo ratatui-core 0.1.2 style/::{Modifierrust-analyzer cargo ratatui-core 0.1.2 style/Modifier#, Stylizerust-analyzer cargo ratatui-core 0.1.2 style/stylize/Stylize#};
1035
1036 use superrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/::*;
1037 use craterust-analyzer cargo bottom 0.14.9 crate/::apprust-analyzer cargo bottom 0.14.9 app/::datarust-analyzer cargo bottom 0.14.9 app/data/::Valuesrust-analyzer cargo bottom 0.14.9 app/data/time_series/Values#;
1038
1039 struct LegendTestCaserust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/LegendTestCase# {
1040 chart_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/LegendTestCase#chart_area.: Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#,
1041 hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/LegendTestCase#hidden_legend_constraints.: (Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#, Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#),
1042 legend_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/LegendTestCase#legend_area.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#>,
1043 }
1044
1045 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1046 fn it_should_hide_the_legendrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/it_should_hide_the_legend().() {
1047 let now = Instantrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/Instant#::nowrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[Instant]now().();
1048 let times = [
1049 now,
1050 now.checked_addrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[Instant]checked_add().(Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#::from_secsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]from_secs().(1)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
1051 now.checked_addrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[Instant]checked_add().(Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#::from_secsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]from_secs().(2)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
1052 ];
1053 let mut values = Valuesrust-analyzer cargo bottom 0.14.9 app/data/time_series/Values#::defaultrust-analyzer cargo timeless 0.1.0 data/chunked/impl#[`ChunkedData<D>`][Default]default().();
1054 values.pushrust-analyzer cargo timeless 0.1.0 data/chunked/impl#[`ChunkedData<D>`]push().(5.0);
1055 values.pushrust-analyzer cargo timeless 0.1.0 data/chunked/impl#[`ChunkedData<D>`]push().(6.0);
1056 values.pushrust-analyzer cargo timeless 0.1.0 data/chunked/impl#[`ChunkedData<D>`]push().(7.0);
1057
1058 let cases = [
1059 LegendTestCaserust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/LegendTestCase# {
1060 chart_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/LegendTestCase#chart_area.: Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(0, 0, 100, 100),
1061 hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/LegendTestCase#hidden_legend_constraints.: (Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Ratiorust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Ratio#(1, 4), Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Ratiorust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Ratio#(1, 4)),
1062 legend_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/LegendTestCase#legend_area.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(88, 0, 12, 12)),
1063 },
1064 LegendTestCaserust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/LegendTestCase# {
1065 chart_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/LegendTestCase#chart_area.: Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(0, 0, 100, 100),
1066 hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/LegendTestCase#hidden_legend_constraints.: (Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Ratiorust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Ratio#(1, 10), Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Ratiorust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Ratio#(1, 4)),
1067 legend_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/LegendTestCase#legend_area.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
1068 },
1069 ];
1070 for case in &cases {
1071 let datasets = (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10)
1072 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|i| {
1073 let name = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("Dataset #{i}");
1074 Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().(name).datarust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]data().(&times, &values)
1075 })
1076 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>();
1077 let chart = TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]new().(datasets)
1078 .x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]x_axis().(Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`][Default]default().().titlerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`]title().("X axis"))
1079 .y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]y_axis().(Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`][Default]default().().titlerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`]title().("Y axis"))
1080 .hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]hidden_legend_constraints().(case.hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/LegendTestCase#hidden_legend_constraints.);
1081 let layout = chart.layoutrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]layout().(case.chart_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/LegendTestCase#chart_area.);
1082 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(layout.legend_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#legend_area., case.legend_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/LegendTestCase#legend_area.);
1083 }
1084 }
1085
1086 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1087 fn axis_can_be_stylizedrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/axis_can_be_stylized().() {
1088 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1089 Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`][Default]default().().blackrust-analyzer cargo ratatui-core 0.1.2 style/stylize/Stylize#black().().on_whiterust-analyzer cargo ratatui-core 0.1.2 style/stylize/Stylize#on_white().().boldrust-analyzer cargo ratatui-core 0.1.2 style/stylize/Stylize#bold().().not_dimrust-analyzer cargo ratatui-core 0.1.2 style/stylize/Stylize#not_dim().().stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#style.,
1090 Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#::defaultrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style][Default]default().()
1091 .fgrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]fg().(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Blackrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Black#)
1092 .bgrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]bg().(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Whiterust-analyzer cargo ratatui-core 0.1.2 style/color/Color#White#)
1093 .add_modifierrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]add_modifier().(Modifierrust-analyzer cargo ratatui-core 0.1.2 style/Modifier#::BOLDrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Modifier]BOLD.)
1094 .remove_modifierrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]remove_modifier().(Modifierrust-analyzer cargo ratatui-core 0.1.2 style/Modifier#::DIMrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Modifier]DIM.)
1095 )
1096 }
1097
1098 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1099 fn dataset_can_be_stylizedrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/dataset_can_be_stylized().() {
1100 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1101 Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::<f64>::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().()
1102 .blackrust-analyzer cargo ratatui-core 0.1.2 style/stylize/Stylize#black().()
1103 .on_whiterust-analyzer cargo ratatui-core 0.1.2 style/stylize/Stylize#on_white().()
1104 .boldrust-analyzer cargo ratatui-core 0.1.2 style/stylize/Stylize#bold().()
1105 .not_dimrust-analyzer cargo ratatui-core 0.1.2 style/stylize/Stylize#not_dim().()
1106 .stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#style.,
1107 Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#::defaultrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style][Default]default().()
1108 .fgrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]fg().(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Blackrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Black#)
1109 .bgrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]bg().(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Whiterust-analyzer cargo ratatui-core 0.1.2 style/color/Color#White#)
1110 .add_modifierrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]add_modifier().(Modifierrust-analyzer cargo ratatui-core 0.1.2 style/Modifier#::BOLDrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Modifier]BOLD.)
1111 .remove_modifierrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]remove_modifier().(Modifierrust-analyzer cargo ratatui-core 0.1.2 style/Modifier#::DIMrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Modifier]DIM.)
1112 )
1113 }
1114
1115 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1116 fn chart_can_be_stylizedrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/chart_can_be_stylized().() {
1117 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1118 TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#::<f64>::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]new().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![])
1119 .blackrust-analyzer cargo ratatui-core 0.1.2 style/stylize/Stylize#black().()
1120 .on_whiterust-analyzer cargo ratatui-core 0.1.2 style/stylize/Stylize#on_white().()
1121 .boldrust-analyzer cargo ratatui-core 0.1.2 style/stylize/Stylize#bold().()
1122 .not_dimrust-analyzer cargo ratatui-core 0.1.2 style/stylize/Stylize#not_dim().()
1123 .stylerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#style.,
1124 Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#::defaultrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style][Default]default().()
1125 .fgrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]fg().(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Blackrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Black#)
1126 .bgrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]bg().(Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Whiterust-analyzer cargo ratatui-core 0.1.2 style/color/Color#White#)
1127 .add_modifierrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]add_modifier().(Modifierrust-analyzer cargo ratatui-core 0.1.2 style/Modifier#::BOLDrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Modifier]BOLD.)
1128 .remove_modifierrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]remove_modifier().(Modifierrust-analyzer cargo ratatui-core 0.1.2 style/Modifier#::DIMrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Modifier]DIM.)
1129 )
1130 }
1131
1132 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1133 fn graph_type_to_stringrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/graph_type_to_string().() {
1134 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(GraphTyperust-analyzer cargo ratatui-widgets 0.3.2 chart/GraphType#::Scatterrust-analyzer cargo ratatui-widgets 0.3.2 chart/GraphType#Scatter#.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), "Scatter");
1135 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(GraphTyperust-analyzer cargo ratatui-widgets 0.3.2 chart/GraphType#::Linerust-analyzer cargo ratatui-widgets 0.3.2 chart/GraphType#Line#.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), "Line");
1136 }
1137
1138 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1139 fn graph_type_from_strrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/graph_type_from_str().() {
1140 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("Scatter".parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<GraphTyperust-analyzer cargo ratatui-widgets 0.3.2 chart/GraphType#>(), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(GraphTyperust-analyzer cargo ratatui-widgets 0.3.2 chart/GraphType#::Scatterrust-analyzer cargo ratatui-widgets 0.3.2 chart/GraphType#Scatter#));
1141 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("Line".parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<GraphTyperust-analyzer cargo ratatui-widgets 0.3.2 chart/GraphType#>(), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(GraphTyperust-analyzer cargo ratatui-widgets 0.3.2 chart/GraphType#::Linerust-analyzer cargo ratatui-widgets 0.3.2 chart/GraphType#Line#));
1142 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!("".parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<GraphTyperust-analyzer cargo ratatui-widgets 0.3.2 chart/GraphType#>().is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
1143 }
1144
1145 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1146 fn it_does_not_panic_if_title_is_wider_than_bufferrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/it_does_not_panic_if_title_is_wider_than_buffer().() {
1147 let widget = TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#::<f64>::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`][Default]default().()
1148 .y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]y_axis().(Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`][Default]default().().titlerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`]title().("xxxxxxxxxxxxxxxx"))
1149 .x_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]x_axis().(Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`][Default]default().().titlerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`]title().("xxxxxxxxxxxxxxxx"));
1150 let mut buffer = Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::emptyrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]empty().(Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(0, 0, 8, 4));
1151 widget.renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'_, F>`][Widget]render().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area., &mut buffer);
1152
1153 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer, Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::with_linesrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]with_lines().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![" ".repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(8); 4]))
1154 }
1155
1156 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1157 fn datasets_without_name_do_not_contribute_to_legend_heightrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/datasets_without_name_do_not_contribute_to_legend_height().() {
1158 let data_named_1 = Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().("data1"); // must occupy a row in legend
1159 let data_named_2 = Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().(""); // must occupy a row in legend, even if name is empty
1160 let data_unnamed = Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().(); // must not occupy a row in legend
1161 let widget = TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#::<f64>::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]new().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![data_named_1, data_unnamed, data_named_2]);
1162 let buffer = Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::emptyrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]empty().(Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(0, 0, 50, 25));
1163 let layout = widget.layoutrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]layout().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area.);
1164
1165 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(layout.legend_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#legend_area..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().());
1166 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(layout.legend_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#legend_area..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height., 4); // 2 for borders, 2
1167 // for rows
1168 }
1169
1170 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1171 fn no_legend_if_no_named_datasetsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/no_legend_if_no_named_datasets().() {
1172 let dataset = Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::<f64>::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().();
1173 let widget = TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]new().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![dataset; 3]);
1174 let buffer = Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::emptyrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]empty().(Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(0, 0, 50, 25));
1175 let layout = widget.layoutrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]layout().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area.);
1176
1177 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(layout.legend_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#legend_area..is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
1178 }
1179
1180 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1181 fn dataset_legend_style_is_patchedrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/dataset_legend_style_is_patched().() {
1182 let long_dataset_name = Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::<f64>::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().("Very long name");
1183 let short_dataset =
1184 Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().(Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#::fromrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`][`From<&'a str>`]from().("Short name").alignmentrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]alignment().(Alignmentrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/Alignment#::Rightrust-analyzer cargo ratatui-core 0.1.2 layout/alignment/HorizontalAlignment#Right#));
1185 let widget = TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]new().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![long_dataset_name, short_dataset])
1186 .hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]hidden_legend_constraints().((100.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), 100.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()));
1187 let mut buffer = Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::emptyrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]empty().(Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(0, 0, 20, 5));
1188
1189 widget.renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'_, F>`][Widget]render().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area., &mut buffer);
1190
1191 let expected = Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::with_linesrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]with_lines().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1192 " ┌──────────────┐",
1193 " │Very long name│",
1194 " │ Short name│",
1195 " └──────────────┘",
1196 " ",
1197 ]);
1198 assert_buffer_eqrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/assert_buffer_eq!!(buffer, expected);
1199 }
1200
1201 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1202 fn test_chart_have_a_topleft_legendrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/test_chart_have_a_topleft_legend().() {
1203 let chart = TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#::<f64>::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]new().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().("Ds1")])
1204 .legend_positionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]legend_position().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#::TopLeftrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#TopLeft#));
1205
1206 let area = Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(0, 0, 30, 20);
1207 let mut buffer = Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::emptyrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]empty().(area);
1208
1209 chart.renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'_, F>`][Widget]render().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area., &mut buffer);
1210
1211 let expected = Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::with_linesrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]with_lines().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1212 "┌───┐ ",
1213 "│Ds1│ ",
1214 "└───┘ ",
1215 " ",
1216 " ",
1217 " ",
1218 " ",
1219 " ",
1220 " ",
1221 " ",
1222 " ",
1223 " ",
1224 " ",
1225 " ",
1226 " ",
1227 " ",
1228 " ",
1229 " ",
1230 " ",
1231 " ",
1232 ]);
1233
1234 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer, expected);
1235 }
1236
1237 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1238 fn test_chart_have_a_long_y_axis_title_overlapping_legendrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/test_chart_have_a_long_y_axis_title_overlapping_legend().() {
1239 let chart = TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#::<f64>::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]new().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().("Ds1")])
1240 .y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]y_axis().(Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`][Default]default().().titlerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`]title().("The title overlap a legend."));
1241
1242 let area = Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(0, 0, 30, 20);
1243 let mut buffer = Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::emptyrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]empty().(area);
1244
1245 chart.renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'_, F>`][Widget]render().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area., &mut buffer);
1246
1247 let expected = Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::with_linesrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]with_lines().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1248 "The title overlap a legend. ",
1249 " ┌───┐",
1250 " │Ds1│",
1251 " └───┘",
1252 " ",
1253 " ",
1254 " ",
1255 " ",
1256 " ",
1257 " ",
1258 " ",
1259 " ",
1260 " ",
1261 " ",
1262 " ",
1263 " ",
1264 " ",
1265 " ",
1266 " ",
1267 " ",
1268 ]);
1269
1270 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer, expected);
1271 }
1272
1273 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1274 fn test_chart_have_overflowed_y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/test_chart_have_overflowed_y_axis().() {
1275 let chart = TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#::<f64>::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]new().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().("Ds1")])
1276 .y_axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]y_axis().(Axisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Axis#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`][Default]default().().titlerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Axis<'a>`]title().("The title overlap a legend."));
1277
1278 let area = Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(0, 0, 10, 10);
1279 let mut buffer = Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::emptyrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]empty().(area);
1280
1281 chart.renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'_, F>`][Widget]render().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area., &mut buffer);
1282
1283 let expected = Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::with_linesrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]with_lines().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1284 " ",
1285 " ",
1286 " ",
1287 " ",
1288 " ",
1289 " ",
1290 " ",
1291 " ",
1292 " ",
1293 " ",
1294 ]);
1295
1296 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer, expected);
1297 }
1298
1299 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1300 fn test_legend_area_can_fit_same_chart_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/test_legend_area_can_fit_same_chart_area().() {
1301 let name = "Data";
1302 let chart = TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#::<f64>::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]new().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().(name)])
1303 .hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]hidden_legend_constraints().((Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Percentagerust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Percentage#(100), Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Percentagerust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Percentage#(100)));
1304
1305 let area = Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(0, 0, name.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() as u16 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().2, 3);
1306 let mut buffer = Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::emptyrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]empty().(area);
1307
1308 let expected = Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::with_linesrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]with_lines().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["┌────┐", "│Data│", "└────┘"]);
1309
1310 [
1311 LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#::TopLeftrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#TopLeft#,
1312 LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#::Toprust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Top#,
1313 LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#::TopRightrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#TopRight#,
1314 LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#::Leftrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Left#,
1315 LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#::Rightrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Right#,
1316 LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#::Bottomrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Bottom#,
1317 LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#::BottomLeftrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#BottomLeft#,
1318 LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#::BottomRightrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#BottomRight#,
1319 ]
1320 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
1321 .for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]for_each().(|&position| {
1322 let chart = chart.clonerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`][Clone]clone().().legend_positionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]legend_position().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(position));
1323 buffer.resetrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]reset().();
1324 chart.renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'_, F>`][Widget]render().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area., &mut buffer);
1325 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(buffer, expected);
1326 });
1327 }
1328
1329 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1330 fn test_legend_of_chart_have_odd_margin_sizerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/test_legend_of_chart_have_odd_margin_size().() {
1331 let name = "Data";
1332 let base_chart = TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#::<f64>::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]new().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().(name)])
1333 .hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]hidden_legend_constraints().((Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Percentagerust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Percentage#(100), Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Percentagerust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Percentage#(100)));
1334
1335 let area = Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(0, 0, name.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() as u16 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().3, 3 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().3);
1336 let mut buffer = Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::emptyrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]empty().(area);
1337
1338 let chart = base_chart
1339 .clonerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`][Clone]clone().()
1340 .legend_positionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]legend_position().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#::TopLeftrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#TopLeft#));
1341 buffer.resetrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]reset().();
1342 chart.renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'_, F>`][Widget]render().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area., &mut buffer);
1343 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1344 buffer,
1345 Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::with_linesrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]with_lines().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1346 "┌────┐ ",
1347 "│Data│ ",
1348 "└────┘ ",
1349 " ",
1350 " ",
1351 " ",
1352 ])
1353 );
1354 buffer.resetrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]reset().();
1355
1356 let chart = base_chart
1357 .clonerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`][Clone]clone().()
1358 .legend_positionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]legend_position().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#::Toprust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Top#));
1359 buffer.resetrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]reset().();
1360 chart.renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'_, F>`][Widget]render().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area., &mut buffer);
1361 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1362 buffer,
1363 Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::with_linesrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]with_lines().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1364 " ┌────┐ ",
1365 " │Data│ ",
1366 " └────┘ ",
1367 " ",
1368 " ",
1369 " ",
1370 ])
1371 );
1372
1373 let chart = base_chart
1374 .clonerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`][Clone]clone().()
1375 .legend_positionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]legend_position().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#::TopRightrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#TopRight#));
1376 buffer.resetrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]reset().();
1377 chart.renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'_, F>`][Widget]render().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area., &mut buffer);
1378 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1379 buffer,
1380 Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::with_linesrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]with_lines().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1381 " ┌────┐",
1382 " │Data│",
1383 " └────┘",
1384 " ",
1385 " ",
1386 " ",
1387 ])
1388 );
1389
1390 let chart = base_chart
1391 .clonerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`][Clone]clone().()
1392 .legend_positionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]legend_position().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#::Leftrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Left#));
1393 buffer.resetrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]reset().();
1394 chart.renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'_, F>`][Widget]render().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area., &mut buffer);
1395 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1396 buffer,
1397 Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::with_linesrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]with_lines().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1398 " ",
1399 "┌────┐ ",
1400 "│Data│ ",
1401 "└────┘ ",
1402 " ",
1403 " ",
1404 ])
1405 );
1406 buffer.resetrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]reset().();
1407
1408 let chart = base_chart
1409 .clonerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`][Clone]clone().()
1410 .legend_positionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]legend_position().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#::Rightrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Right#));
1411 buffer.resetrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]reset().();
1412 chart.renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'_, F>`][Widget]render().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area., &mut buffer);
1413 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1414 buffer,
1415 Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::with_linesrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]with_lines().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1416 " ",
1417 " ┌────┐",
1418 " │Data│",
1419 " └────┘",
1420 " ",
1421 " ",
1422 ])
1423 );
1424
1425 let chart = base_chart
1426 .clonerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`][Clone]clone().()
1427 .legend_positionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]legend_position().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#::BottomLeftrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#BottomLeft#));
1428 buffer.resetrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]reset().();
1429 chart.renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'_, F>`][Widget]render().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area., &mut buffer);
1430 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1431 buffer,
1432 Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::with_linesrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]with_lines().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1433 " ",
1434 " ",
1435 " ",
1436 "┌────┐ ",
1437 "│Data│ ",
1438 "└────┘ ",
1439 ])
1440 );
1441
1442 let chart = base_chart
1443 .clonerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`][Clone]clone().()
1444 .legend_positionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]legend_position().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#::Bottomrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#Bottom#));
1445 buffer.resetrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]reset().();
1446 chart.renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'_, F>`][Widget]render().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area., &mut buffer);
1447 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1448 buffer,
1449 Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::with_linesrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]with_lines().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1450 " ",
1451 " ",
1452 " ",
1453 " ┌────┐ ",
1454 " │Data│ ",
1455 " └────┘ ",
1456 ])
1457 );
1458
1459 let chart = base_chart
1460 .clonerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`][Clone]clone().()
1461 .legend_positionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]legend_position().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(LegendPositionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#::BottomRightrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/LegendPosition#BottomRight#));
1462 buffer.resetrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]reset().();
1463 chart.renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'_, F>`][Widget]render().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area., &mut buffer);
1464 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1465 buffer,
1466 Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::with_linesrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]with_lines().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1467 " ",
1468 " ",
1469 " ",
1470 " ┌────┐",
1471 " │Data│",
1472 " └────┘",
1473 ])
1474 );
1475
1476 let chart = base_chart.clonerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`][Clone]clone().().legend_positionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]legend_position().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
1477 buffer.resetrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]reset().();
1478 chart.renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'_, F>`][Widget]render().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area., &mut buffer);
1479 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1480 buffer,
1481 Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::with_linesrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]with_lines().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1482 " ",
1483 " ",
1484 " ",
1485 " ",
1486 " ",
1487 " ",
1488 ])
1489 );
1490 }
1491
1492 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1493 fn legend_truncates_entries_by_heightrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/legend_truncates_entries_by_height().() {
1494 // 5 datasets but only room for 3 entries in the legend (height=5, so 5-2=3
1495 // entries).
1496 let datasets: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#5)
1497 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|i| Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("D{i}")))
1498 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1499 let chart = TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#::<f64>::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]new().(datasets)
1500 .hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]hidden_legend_constraints().((Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Percentagerust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Percentage#(100), Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Percentagerust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Percentage#(100)));
1501
1502 // Height 5 means room for 3 entries (5 - 2 borders).
1503 let area = Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(0, 0, 20, 5);
1504 let layout = chart.layoutrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]layout().(area);
1505
1506 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(layout.legend_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#legend_area..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().());
1507 let legend = layout.legend_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#legend_area..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
1508 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(legend.heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height., 5); // 3 entries + 2 borders
1509 }
1510
1511 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1512 fn legend_truncates_entries_renders_only_visiblerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/legend_truncates_entries_renders_only_visible().() {
1513 // 5 datasets but height only fits 2 entries.
1514 let datasets: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#5)
1515 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|i| Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("D{i}")))
1516 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1517 let chart = TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#::<f64>::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]new().(datasets)
1518 .hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]hidden_legend_constraints().((Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Percentagerust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Percentage#(100), Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Percentagerust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Percentage#(100)));
1519
1520 let area = Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(0, 0, 20, 4); // 4 - 2 = 2 entries
1521 let mut buffer = Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::emptyrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]empty().(area);
1522 chart.renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'_, F>`][Widget]render().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area., &mut buffer);
1523
1524 let expected = Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::with_linesrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]with_lines().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1525 " ┌──┐",
1526 " │D0│",
1527 " │D1│",
1528 " └──┘",
1529 ]);
1530 assert_buffer_eqrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/assert_buffer_eq!!(buffer, expected);
1531 }
1532
1533 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1534 fn legend_width_capped_to_constraintrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/legend_width_capped_to_constraint().() {
1535 let datasets = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1536 Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().("Short"),
1537 Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().("A very long dataset name"),
1538 ];
1539 let chart = TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#::<f64>::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]new().(datasets)
1540 .hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]hidden_legend_constraints().((Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Percentagerust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Percentage#(100), Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Percentagerust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Percentage#(100)));
1541
1542 // Width 12 means legend_width capped to 12, inner width = 10.
1543 let area = Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(0, 0, 12, 10);
1544 let layout = chart.layoutrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]layout().(area);
1545
1546 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(layout.legend_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#legend_area..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().());
1547 let legend = layout.legend_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#legend_area..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
1548 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(legend.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width., 12); // capped to area width
1549 }
1550
1551 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1552 fn legend_width_truncates_long_names_with_ellipsisrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/legend_width_truncates_long_names_with_ellipsis().() {
1553 // Short entry fits untruncated (satisfies min_required_width), but the
1554 // long entry exceeds the capped legend width and gets an ellipsis.
1555 let datasets = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1556 Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().("AB"),
1557 Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().("Very long name here"),
1558 ];
1559 let chart = TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#::<f64>::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]new().(datasets)
1560 .hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]hidden_legend_constraints().((Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Percentagerust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Percentage#(100), Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Percentagerust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Percentage#(100)));
1561
1562 // Width 8, legend box capped to 8, inner is 6, long name truncated.
1563 let area = Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(0, 0, 8, 4);
1564 let mut buffer = Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::emptyrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]empty().(area);
1565 chart.renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'_, F>`][Widget]render().(buffer.arearust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#area., &mut buffer);
1566
1567 #[rustfmt::skip]
1568 let expected = Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#::with_linesrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]with_lines().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1569 "┌──────┐",
1570 "│AB │",
1571 "│Very …│",
1572 "└──────┘",
1573 ]);
1574 assert_buffer_eqrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/assert_buffer_eq!!(buffer, expected);
1575 }
1576
1577 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1578 fn legend_width_uses_only_visible_entriesrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/tests/legend_width_uses_only_visible_entries().() {
1579 // First 2 entries have short names, last entry has a very long name.
1580 // With height=4 (2 visible entries), the legend width should be based
1581 // on the short names only, not the long hidden one.
1582 let datasets = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1583 Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().("AB"),
1584 Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().("CD"),
1585 Datasetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/Dataset#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`][Default]default().().namerust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`Dataset<'a, F>`]name().("A very long dataset name"),
1586 ];
1587 let chart = TimeChartrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/TimeChart#::<f64>::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]new().(datasets)
1588 .hidden_legend_constraintsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]hidden_legend_constraints().((Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Percentagerust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Percentage#(100), Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Percentagerust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Percentage#(100)));
1589
1590 let area = Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#::newrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]new().(0, 0, 30, 4); // height 4 → 2 visible entries
1591 let layout = chart.layoutrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/impl#[`TimeChart<'a, F>`]layout().(area);
1592
1593 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(layout.legend_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#legend_area..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().());
1594 let legend = layout.legend_arearust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/ChartLayout#legend_area..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
1595 // Width should be based on "AB"/"CD" (2 chars) + 2 borders = 4, not the long
1596 // name.
1597 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(legend.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width., 4);
1598 }
1599 }