plotters-rs / plotters

A rust drawing library for high quality data plotting for both WASM and native, statically and realtimely 🦀 📈🚀
https://plotters-rs.github.io/home/
MIT License
3.81k stars 276 forks source link

[BUG] canvas backend stroke width #235

Open ensonmj opened 3 years ago

ensonmj commented 3 years ago

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

FlareFlo commented 1 year ago

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

MitchellNeill commented 1 year ago

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;
vpochapuis commented 6 months ago

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 commented 6 months ago

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

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