3.1.0 • Published 5 years ago

vue-arc-counter v3.1.0

Weekly downloads
36
License
MIT
Repository
github
Last release
5 years ago

VUE ARC COUNTER

This Vue component generates counter in a circular arc. The angles, colors, strokewidth, spacing between dashes and direction can all be controlled through properties.

Examples

diagram of arc counter

Sample code on codesandbox

Browser example on Codepen

Project setup

With a package manager

# npm
$ npm install vue-arc-counter

#yarn
$ yarn add vue-arc-counter

For the browser

<script src="unpkg.com/vue-arc-counter@latest/dist/arcCounter.umd.min.js"></script>

How it works

The component generates an SVG element with default width and height of 100% (outer diameter of the counter). Two dashed strokes are overlayed: the bottom one controlled by stroke and dashCount and the top one by activeStroke and activeCount. A start angle smaller than the end angle will make for clockwise counting, vice versa.

You can display a string of text to add a value or label, with limited positioning options. This can be styled with CSS.

The absolute difference between end and start angles should always be less than 360 degrees.

Properties

propdescriptiondefaultoptions
sizewidth and height of element10remString
dashCountTotal number of dashes21Natural number
activeCountNumber of dashes on top5Natural number
strokeWidthBottom stroke width as a percentage of the radius200 to 100
activeWidthTop stroke width as a percentage of the radius200 to 100
strokeStroke color of the bottom dasheslightgreycolor
activeStrokeStroke color of the top dashesdodgerbluecolor
dashSpacingFraction of width taken up by space between dashes1/40 to 1
startStart angle from top-120-360 to 360
endEnd angle from top120-360 to 360
textText string to display inside SVG""String
textXHorizontal position of svg text stringcentercenter, left, right
textYVertical position of svg text stringcentercenter, top, bottom

License

MIT Open Source License

3.1.0

5 years ago

3.0.0

5 years ago

2.0.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago