plotters icon indicating copy to clipboard operation
plotters copied to clipboard

[BUG] canvas backend stroke width

Open ensonmj opened this issue 3 years ago • 4 comments

Describe the bug does anyone make stoke width work?

To Reproduce I clone this repo,and try to change style from &RED to let style = Into::<ShapeStyle>::into(&BLUE).stroke_width(100).filled(); in example wasm-demo but nothing changed. (color changed)

Version Information plotters 0.3

ensonmj avatar Mar 05 '21 01:03 ensonmj

Issue persists on Canvas backends with custom WASM project, might be related to the getter/setter of bindgen implementation?

FlareFlo avatar Dec 21 '22 13:12 FlareFlo

Adding support to the above comment, directly acting on the attributes seemed to work for me:

    let mut style = ShapeStyle::from(RED);
    style.stroke_width=4_u32;

MitchellNeill avatar Feb 21 '23 05:02 MitchellNeill

I can confirm that the stroke_width on CanvasBackend isn't working on the latest main. I build the Struct from its field directly:

ShapeStyle{
  color: BLACK.into(),
  filled: true,
  stroke_width: 4
}

The value of the stroke_width doesn't have any effect when using with draw_series.

Value of 10: image

Value of 5: image

Value of 1: image

(The colors are different because i generate a different palette at each run)

vpochapuis avatar Mar 01 '24 03:03 vpochapuis

Actually it comes from the Backend code that didn't get released since the fix:

https://github.com/plotters-rs/plotters-canvas/issues/11

vpochapuis avatar Mar 05 '24 08:03 vpochapuis