Skip to content

[Feature Request] Unify argument style of LineSeries::new and DashedLineSeries::new #666

Open
@duskmoon314

Description

@duskmoon314

What is the feature?

Currently, LineSeries::new and DashedLineSeries::new have different signature of style:

// LineSeries::new
pub fn new<I: IntoIterator<Item = Coord>, S: Into<ShapeStyle>>(iter: I, style: S) -> Self

// DashedLineSeries::new
pub fn new<I0>(points: I0, size: Size, spacing: Size, style: ShapeStyle) -> Self

I suggest adjusting the latter to:

pub fn new<I0, S: Into<ShapeStyle>>(points: I0, size: Size, spacing: Size, style: S) -> Self 

(Optional) Why is this feature useful, and how would people use the feature?

Some other series share the same signature with LineSeries::new:

// PointSeries
pub fn new<S: Into<ShapeStyle>>(iter: I, size: Size, style: S) -> Self

// AreaSeries
pub fn new<S: Into<ShapeStyle>, I: IntoIterator<Item = (X, Y)>>(
        iter: I,
        baseline: Y,
        area_style: S,
    ) -> Self

This FR lets users expect a similar API when using DashedLineSeries.

(Optional) Additional Information

This will cause a breaking if the user previously passes some_style.into() to DashedLineSeries::new, which will get an error from rustc (type annotations needed cannot satisfy _: Into<ShapeStyle>).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions