Comments (7)
Hmm are you sure? When the radius is set to 100px, my circle is at exactly 200px by 200px (twice the radius). http://i.imgur.com/IDlxFbf.png
from angular-svg-round-progressbar.
I need to be more specific: the problem is the size of <svg>
(it is 230 with stroke 15 and 202 with stroke 1), not <circle>
. Seems like it is little more complicated than just incorrect size
, right?
from angular-svg-round-progressbar.
Ah you're correct that the SVG element is slightly larger. I'll look into it.
from angular-svg-round-progressbar.
Great. I ended up for now with
element.css({
"width": size + "px",
"height": (isSemicircle ? size/2 : size) + "px",
"margin": -stroke/2 + "px",
"margin-bottom": isSemicircle ? 0 : -stroke/2 + "px",
"overflow": "hidden" // on some browsers the background overflows, if in semicircle mode
});
But maybe -Math.floor(stroke/2)
would be more appropriate. It may depend on rendering engine, but looks like it always occupies even amount of pixels, at least in Chrome.
from angular-svg-round-progressbar.
It was a while ago when I did this directive, but after looking at it again, I think I remember why the SVG element's size is the diameter + 2*stroke. Its because the stroke throws off the width and height. The browser doesn't consider the stroke as a part of the width of the circle
, in reality the circle's width and height are 230px as well. Just for fun I forced the same size on the SVG and the circle ended up overflowing.
It probably depends on what height you expect it to be. I think it would make more sense to take off the stroke from the width and height.
from angular-svg-round-progressbar.
I was afraid that it the circle would be truncated somehow, but it seems to look well in all browsers. I wasn't fond of temporary margin solution because of that extra 1px caused by antialiasing on odd stroke values.
from angular-svg-round-progressbar.
I've released a fix for this (d57571c). From now the element width and height will be the circle's diameter (radius*2)
from angular-svg-round-progressbar.
Related Issues (20)
- proposed new library HOT 7
- Question: Does v4 break on Angular 9? HOT 5
- [^4.0.0] [Angular 10.0.8] Production build isue. Related to #204 HOT 2
- Animation when max changed
- Errors with Angular 9 - ɵɵFactoryDef HOT 10
- Angular 9 error ɵɵFactoryDef
- Compilation failed after upgrading to 5.0.1 HOT 2
- Could not be served HOT 1
- contribution
- Support for Angular 11 HOT 1
- Small circle at the end of outer stroke
- Filling color in case of 0 current value HOT 1
- Support Angular 12 HOT 1
- Memory leak when drawing progress HOT 2
- Error - Angular 11.2.7 HOT 1
- ARIA progressbar nodes must have an accessible name HOT 1
- error TS2707: Generic type 'ɵɵComponentDeclaration' requires between 7 and 8 type arguments. HOT 2
- Angular 16 support HOT 1
- Angular-svg-round-progressbar for Angular 9? HOT 1
- Inconsistent URL Parsing in resolveColor function affecting SVG Strokes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-svg-round-progressbar.