Skip to content

Commit

Permalink
Merge pull request #616 from robertosw/master
Browse files Browse the repository at this point in the history
Examples in Docs of DashedLineSeries
  • Loading branch information
AaronErhardt authored Jul 16, 2024
2 parents 80a4d60 + d0191d6 commit dd1296a
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion plotters/src/series/line_series.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,43 @@ impl<DB: DrawingBackend, Coord> LineSeries<DB, Coord> {
}
}

/// A dashed line series, map an iterable object to the dashed line element.
/// A dashed line series, map an iterable object to the dashed line element. Can be used to draw simple dashed and dotted lines.
///
/// If you want to use more complex shapes as points in the line, you can use `plotters::series::line_series::DottedLineSeries`.
///
/// # Examples
///
/// Dashed line:
/// ```Rust
/// chart_context
/// .draw_series(DashedLineSeries::new(
/// data_series,
/// 5, /* size = length of dash */
/// 10, /* spacing */
/// ShapeStyle {
/// color: BLACK.mix(1.0),
/// filled: false,
/// stroke_width: 1,
/// },
/// ))
/// .unwrap();
/// ```
///
/// Dotted line: (keep `size` and `stroke_width` the same to achieve dots)
/// ```Rust
/// chart_context
/// .draw_series(DashedLineSeries::new(
/// data_series,
/// 1, /* size = length of dash */
/// 4, /* spacing, best to keep this at least 1 larger than size */
/// ShapeStyle {
/// color: BLACK.mix(1.0),
/// filled: false,
/// stroke_width: 1,
/// },
/// ))
/// .unwrap();
/// ```
pub struct DashedLineSeries<I: Iterator + Clone, Size: SizeDesc> {
points: I,
size: Size,
Expand Down

0 comments on commit dd1296a

Please sign in to comment.