# percircle

> CSS percentage circle built with jQuery selectors.

Latest version **1.0.33** (published 2022-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install percircle
pnpm add percircle
yarn add percircle
bun add percircle
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.33 |
| Published | 2022-01-18 |
| First published | 2015-12-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 40.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 224 |
| Author | Teo Bais |
| Maintainers | toubou |
| Keywords | jquery-plugin, ecosystem:jquery, percentage, circle, ui |

## Links

- npm: https://www.npmjs.com/package/percircle
- Repository: https://github.com/teobais/percircle
- Homepage: https://github.com/teobais/percircle#readme
- Issues: https://github.com/teobais/percircle/issues
- npm.io page: https://npm.io/package/percircle

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.33 (latest) — 2022-01-18
- 1.0.32 — 2022-01-15
- 1.0.31 — 2022-01-15
- 1.0.30 — 2022-01-15
- 1.0.29 — 2019-10-27
- 1.0.28 — 2019-10-20
- 1.0.27 — 2018-03-04
- 1.0.26 — 2018-01-26
- 1.0.25 — 2017-11-02
- 1.0.24 — 2017-11-02
- 1.0.23 — 2017-11-02
- 1.0.22 — 2017-11-02
- 1.0.21 — 2017-06-17
- 1.0.20 — 2017-04-27
- 1.0.19 — 2017-04-27
- … 17 more at https://npm.io/package/percircle/versions

## README

# percircle
> CSS percentage circle built with jQuery

# [Demo](https://teobais.github.io/percircle)


> ## [Maintainers Wanted!](https://github.com/teobais/percircle/issues/43)
---

### Custom circles
```html
<div id="custom" class="yellow big"></div> 
<div id="clock" class="purple big"></div>
<div id="custom-color" class="big"></div>
<div id="countdown" class="big"></div>
```
<p align="center">
  <img  src="_img/custom2.PNG" alt="Custom" />
</p>
<hr>

### Update value dynamically

#### Declare your html

```html
<div class="clearfix">
    <div id="redBecomesBlue" class="red big"></div>
</div>
<a href="javascript:void(0);" id="changeCircle">Fill Circle to 95.5</a>
```
<p align="center">
  <img  src="_img/update-value-dynamically.gif" alt="Big blue circle" />
</p>

#### Handle the click in the script
```js
$(document).ready(function(){
    $("#redBecomesBlue").percircle({percent: 25,text: "25"});
    $('#changeCircle').click(function(e){
        e.preventDefault();
        changeCircle();
    });
});

function changeCircle(){
    $("#redBecomesBlue").percircle({text:''});
    $("#redBecomesBlue").percircle({
        text: "",
        percent: 95.5,
        progressBarColor: "#1252c0"
    });
}
```
<hr/>

# Usage

#### 1. Load the module to your page
```html
<!DOCTYPE HTML>
<html>
<head>
  <script src="../bower_components/jquery/dist/jquery.min.js"></script>
  <script type="text/javascript" src="../dist/js/percircle.js"></script>
  <link rel="stylesheet" href="../dist/css/percircle.css">
</head>
</html>
```

#### 2. Define the circle objects
Big blue circle marked with a percent of 50%:
```html
<div id="bluecircle" data-percent="17" class="big">
</div>
```
<p align="center">
  <img  src="_img/big_blue_17.gif" alt="Big blue circle" />
</p>

#### 3. Let the script get the job done
```html
<script type="text/javascript">
    $(function(){
        $("#bluecircle").percircle();
    });
</script>
```
<hr>

### npm
Percircle is registered as an npm package and can be installed with:
```
npm install percircle
```

### Bower
Percircle is also registered as a Bower package, so it can be pulled down using:
```
bower install percircle
```

<hr/>

### Options
| Option | Description | via configuration object | via data attribute | Default |
| -- | -- | -- | -- | -- |
| Animate | Whether to animate the progress bar on load (or view) | `{ animate: "true" }` | data-animate="true" | true |
| Clock | Display a clock in the percircle | `{ perclock: true}` | data-perclock="true" | false |
| Countdown | Display a countdown in the percircle | `{ perdown: true}` | data-perdown="true" | false |
| Countdown seconds | The amount of seconds to countdown. | `{ secs: 15 }` | data-secs="15" | - |
| Countdown time up text | Text to display when countdown has completed.	| `{ timeUpText: 'Complete!' }` | data-timeUpText="Complete!" | - |
| Countdown reset on click | Whether to reset the countdown on percircle click | `{ reset: true }` | data-reset="true" | false 
| Display text at zero | Whether to display text even when the percentage is 0 | `{ displayTextAtZero: true }` | n/a | false |
| Progress bar color | The colour of the progress bar | `{ progressBarColor: '#6188ff' }` | data-progressBarColor="#6188ff" | empty (inherit from class or css) |
| Text | Text to display inside the percirle | `{ percent: 65 }` | data-percent="65" | undefined (use percent value) |

<hr/>

### Building Percircle Locally

If you'd like to run the development version, `percircle` uses Webpack to handle build tasks like bundling and minification.
First, clone the repository, then run:

    # Install the dependencies
    npm install

    # Launch webpack dev server, whilst watching for any js or css changes 
    npm start

### Contribute
Contributions are more than welcome. Please ensure that you spent some time reading our [Contributor's Guidelines](https://github.com/teobais/percircle/blob/master/CONTRIBUTING.md).

### Contributors
[<img alt="teobais" src="https://avatars2.githubusercontent.com/u/5684688?v=4&s=117 width=117">](https://github.com/teobais) |[<img alt="chrisahardie" src="https://avatars0.githubusercontent.com/u/2429373?v=4&s=117 width=117">](https://github.com/chrisahardie) |[<img alt="chris--jones" src="https://avatars0.githubusercontent.com/u/10459377?v=4&s=117 width=117">](https://github.com/chris--jones) |[<img alt="tinglu" src="https://avatars0.githubusercontent.com/u/1032258?v=4&s=117 width=117">](https://github.com/tinglu) |[<img alt="tranthanhhoa" src="https://avatars0.githubusercontent.com/u/6691878?v=4&s=117 width=117">](https://github.com/tranthanhhoa) |[<img alt="ahmadajmi" src="https://avatars1.githubusercontent.com/u/626005?v=4&s=117 width=117">](https://github.com/ahmadajmi) |[<img alt="Sylphony" src="https://avatars3.githubusercontent.com/u/1796078?v=4&s=117 width=117">](https://github.com/Sylphony) |[<img alt="yireo" src="https://avatars0.githubusercontent.com/u/1373981?v=4&s=117 width=117">](https://github.com/yireo) | [<img alt="miller-kevin" src="https://avatars.githubusercontent.com/u/50149901?v=4&s=117 width=117">](https://github.com/miller-kevin)
:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
[teobais](https://github.com/teobais)|[chrisahardie](https://github.com/chrisahardie)|[chris--jones](https://github.com/chris--jones)|[tinglu](https://github.com/tinglu)|[tranthanhhoa](https://github.com/tranthanhhoa)|[ahmadajmi](https://github.com/ahmadajmi)|[Sylphony](https://github.com/Sylphony)|[yireo](https://github.com/yireo)|[miller-kevin](https://github.com/miller-kevin)|

### Credits
The original project was created from <a href="http://circle.firchow.net/" target="_blank">Andre Firchow</a> and as I didn't find any similar here, I uploaded it.

However, the project loaded all the css transformations, in the <code>percircle.css</code> file. Now, it uses jQuery to apply repeated functionality where needed.

---
_Source: https://npm.io/package/percircle · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
