cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

              <p>Inspired from <a href="https://codepen.io/jo-asakura/pen/stFHi?editors=1100" target="_blank">https://codepen.io/jo-asakura/pen/stFHi?editors=1100</a></p>

<p>Github repository here: <a href="https://github.com/roparz/cg-percent-pie">https://github.com/roparz/cg-percent-pie</a></p>

<main ng-app="app">
  <cg-percent-pie percent="0"></cg-percent-pie>
  <cg-percent-pie percent="1"></cg-percent-pie>
  <cg-percent-pie percent="2"></cg-percent-pie>
  <cg-percent-pie percent="7"></cg-percent-pie>
  <cg-percent-pie percent="13"></cg-percent-pie>
  <cg-percent-pie percent="23"></cg-percent-pie>
  <cg-percent-pie percent="43"></cg-percent-pie>
  <cg-percent-pie percent="53"></cg-percent-pie>
  <cg-percent-pie percent="73"></cg-percent-pie>
  <cg-percent-pie percent="83"></cg-percent-pie>
  <cg-percent-pie percent="97"></cg-percent-pie>
  <cg-percent-pie percent="100"></cg-percent-pie>
              @mixin cg-percent-pie($border-size: 3px, $circle-size: 80px, $percent-font-size: 20%, $circle-color: rgb(85, 199, 215), $circle-shadow: rgb(212, 212, 212))

    &, &:before, &:after
      box-sizing: border-box

      display: block
      transform: rotate(45deg)

    clip: rect(0, 1em, 1em, .5em)
      display: none

    font-size: $circle-size
    width: 1em
    height: 1em
    position: relative
    float: left
    border: $border-size solid $circle-shadow
    border-radius: 50%
    @extend %box-sizing

      content: attr(data-percent) '%'
      font-family: sans-serif
      white-space: nowrap
      font-size: $percent-font-size
      position: absolute
      top: 50%
      left: 50%
      transform: translate(-50%, -50%)

    position: absolute
    top: -$border-size
    left: -$border-size
    width: 1em
    height: 1em
    @extend %box-sizing

    &:after, &:before
      content: ''
      position: absolute
      width: 100%
      height: 100%
      border-width: $border-size
      border-style: solid
      border-color: $circle-color $circle-color transparent transparent
      border-radius: 50%

    @for $i from 0 through 100
          $rotate: -135 + ($i * 3.6)
          transform: rotate($rotate * 1deg)

    @for $i from 0 through 50
        @extend %clip-pie

    @for $i from 51 through 100
          @extend %right-cirlce
@include cg-percent-pie()

  margin: 10px
              angular.module('app', [])
.directive 'cgPercentPie', ->
  restrict: 'E'
  replace: true
  template: '
<div class="cg-pie-wrapper" data-percent="{{ percent }}">
  <div class="cg-pie percent-{{ percent }}"></div>
    percent: '@'
Loading ..................