Skip to content

Commit 12acc59

Browse files
committed
Make z-order element can be drawn by series
1 parent 8866f9e commit 12acc59

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/chart/context.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ use crate::coord::ranged3d::{ProjectionMatrix, ProjectionMatrixBuilder};
1010
use crate::coord::{CoordTranslate, ReverseCoordTranslate, Shift};
1111

1212
use crate::drawing::{DrawingArea, DrawingAreaErrorKind};
13-
use crate::element::{Drawable, EmptyElement, PathElement, PointCollection, Polygon, Text};
13+
use crate::element::{
14+
CoordMapper, Drawable, EmptyElement, PathElement, PointCollection, Polygon, Text,
15+
};
1416
use crate::style::text_anchor::{HPos, Pos, VPos};
1517
use crate::style::{ShapeStyle, TextStyle};
1618

@@ -97,13 +99,14 @@ impl<'a, DB: DrawingBackend, CT: CoordTranslate> ChartContext<'a, DB, CT> {
9799
// of points reference with the same lifetime.
98100
// However, this doesn't work if the coordinate doesn't live longer than the backend,
99101
// this is unnecessarily strict
100-
pub(super) fn draw_series_impl<E, R, S>(
102+
pub(super) fn draw_series_impl<B, E, R, S>(
101103
&mut self,
102104
series: S,
103105
) -> Result<(), DrawingAreaErrorKind<DB::ErrorType>>
104106
where
105-
for<'b> &'b E: PointCollection<'b, CT::From>,
106-
E: Drawable<DB>,
107+
B: CoordMapper,
108+
for<'b> &'b E: PointCollection<'b, CT::From, B>,
109+
E: Drawable<DB, B>,
107110
R: Borrow<E>,
108111
S: IntoIterator<Item = R>,
109112
{
@@ -120,13 +123,14 @@ impl<'a, DB: DrawingBackend, CT: CoordTranslate> ChartContext<'a, DB, CT> {
120123
}
121124

122125
/// Draw a data series. A data series in Plotters is abstracted as an iterator of elements
123-
pub fn draw_series<E, R, S>(
126+
pub fn draw_series<B, E, R, S>(
124127
&mut self,
125128
series: S,
126129
) -> Result<&mut SeriesAnno<'a, DB>, DrawingAreaErrorKind<DB::ErrorType>>
127130
where
128-
for<'b> &'b E: PointCollection<'b, CT::From>,
129-
E: Drawable<DB>,
131+
B: CoordMapper,
132+
for<'b> &'b E: PointCollection<'b, CT::From, B>,
133+
E: Drawable<DB, B>,
130134
R: Borrow<E>,
131135
S: IntoIterator<Item = R>,
132136
{

0 commit comments

Comments
 (0)