adobe-webplatform / Snap.svg

The JavaScript library for modern SVG graphics.
http://snapsvg.io
Apache License 2.0
13.95k stars 1.15k forks source link

stroke colour not changing #593

Closed ckalas closed 6 years ago

ckalas commented 6 years ago

I am trying to set the stroke colour of a path like so:

var path;
path = svg_circle_arc_path(500, 500, 450, -90, val * 180.0 - 90);
arc = svg.path(path)
arc.attr({
    stroke: 'red'
 });

But this does nothing. If I set the class and use a css style it colours the stroke, but I can't use this method to colour the path an arbitrary colour at run time.

ibrierley commented 6 years ago

Can you put the example on a jsfiddle

ckalas commented 6 years ago

here is an example from someone else, by adding stroke: 'black' to line 32 of the js and or removing the css colours for the data-arc classes you can see the issue.

ibrierley commented 6 years ago

That works fine and turns it black, as long as the overriding class in the css is removed.

ckalas commented 6 years ago

when I remove the class from the attribute and add a stroke, I don't see anything drawn.

ibrierley commented 6 years ago

You need to put a fiddle up showing the exact problem.

ckalas commented 6 years ago

it worked now when I did attrs = { style: "stroke: xxxxx"} instead of attrs = {stroke: xxxx}