1.0.1 • Published 7 years ago

pguso-jquery-plugin-circliful v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

jquery-plugin-circliful

  • show Infos as Circle Statistics, no images used
  • based on SVG and jquery
  • many options can be set
  • fully responsive

How to use circliful

Include circliful & jquery to your Site.

<link href="css/jquery.circliful.css" rel="stylesheet" type="text/css" />

<script src="http://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="js/jquery.circliful.min.js"></script>

It's tested up to jQuery Versions:

  • 1.12.4
  • 2.2.4
  • 3.1.0

Test it directly on JS Fiddle https://jsfiddle.net/9dajqcr1/

Add an element to your Site with a unique id and an "container" around it that controls the size of your circle statistic, here a example with bootstrap:

<div class="row">
    <div class="col-lg-2">
        <div id="test-circle"></div>
    </div>
</div>

Add this code at the end of your site

<script>
    $( document ).ready(function() {
	$("#your-circle").circliful({
                animationStep: 5,
                foregroundBorderWidth: 5,
                backgroundBorderWidth: 15,
                percent: 75
           });
   });
</script>

Options

OptionDescriptionTypeDefault
foregroundColorcolor of the foreground circle (no color add value 'none')RGB or string#3498DB
backgroundColorcolor of the background circle (no color add value 'none')RGB or string#eee
fillColorfill color of circleRGB or stringnone
pointColorfill color of point circleRGB or stringnone
pointSizeSize of point circleint28.5
foregroundBorderWidthwidth of foreground circle borderint15
backgroundBorderWidthwidth of background circle borderint15
fontColorcolor of the percentageRGB#aaa
percentageYvertical position of the percentage textinteger100
percentageXhorizontal position of the percentage textinteger100
percentcan be 1 to 100integer75
animationif the circle should be animated initiallyint1
animationStepcan be 1 to 100, how fast or slow the animation should beint5
progressColorchange color of foreground circle as percents changed({ 50: '#FF6C00', 60: '#FF6C00'}){integer:RGB}null
iconfont awesome icon, details bellowstringnone
iconSizefont size of the iconinteger30
iconColorcolor of the iconRGB#ccc
iconPositionposition of the icon (top, bottom, left, right or middle)stringtop
percentageTextSizefont size of the percentage textinteger22
textAdditionalCssadditional css for the percentage textstring''
targetPercentdraws a circle around the main circleinteger0
targetTextSizefont size of the target percentageinteger17
targetColorfill color of the target circleRGB#2980B9
textinfo text shown bellow the percentage in the circlestring''
textStylecss inline style you want to add to your info textstring''
textColorfont color of the info textRGB#666
textYvertical position of your info textintegernull
textXhorizontal position of your info textintegernull
textBelowaligns string of "text" property centered below the circlebooleanfalse
multiPercentageturns multiple bars on if set to 1integer1
percentagesarray of percent, color and title for each circlearray[]
multiPercentageLegendshow a legend with title, color and percentage on the rightinteger0
noPercentageSignto hide the percentage signbooleanfalse
replacePercentageByTextreplace the percentage shown in the circle by textstringnull
halfCircledraw half circle see example bellowbooleanfalse
animateInViewanimate circle on scroll into viewbooleanfalse
decimalsnumber of decimal places to showinteger0
alwaysDecimalsshows decimals while animating instead of only at the end or if less than 1booleanfalse
titletitle of the circlestringCircle Chart
descriptiondescription of the circlestring''

Data Attributes

All Options can also be set as data attributes, for example:

<div id="test-circle" data-animation="1" data-animationStep="5" data-percent="58"></div>

Half Circle

Example:

$("#test-circle5").circliful({
    animationStep: 5,
    foregroundBorderWidth: 5,
    backgroundBorderWidth: 15,
    percent: 80,
    halfCircle: 1,
});

full

Multiple Bars

Example:

$("#test-circle").circliful({
        animation: 1,
        animationStep: 5,
        foregroundBorderWidth: 7,
        backgroundBorderWidth: 7,
        textSize: 28,
        textStyle: 'font-size: 12px;',
        textColor: '#666',
        multiPercentage: 1,
        percentages: [
        	{'percent': 10, 'color': '#3180B8', 'title': 'Gryffindor' },
		{'percent': 30, 'color': '#4ADBEA', 'title': 'Ravenclaw' },
		{'percent': 50, 'color': '#49EBA8', 'title': 'Hufflepuff' },
		{'percent': 70, 'color': '#FFCA35', 'title': 'Slytherin' }
        ],
        multiPercentageLegend: 1,
    replacePercentageByText: '',
        backgroundColor: '#eee',
        icon: 'f0d0',
        iconPosition: 'middle',
        iconColor: '#273B4E'
    });

In action: https://jsfiddle.net/0c8qaqaj/

Use callback function

Get's fired on complete.

Example:

$("#circli").circliful({
        animation: 1,
        animationStep: 10,
        foregroundBorderWidth: 5,
        backgroundColor: "none",
        fillColor: '#eee',
        percent: 75,
        iconColor: '#3498DB',
        icon: 'f206',
        iconSize: '40',
        iconPosition: 'middle',
        start:50,
        showPercent:1,
        target:0
    }, function(){
        alert('done !');
    });

Font Awesome Usage

Go to https://github.com/FortAwesome/Font-Awesome/blob/master/css/font-awesome.css and copy/paste the string after the slash for Example hdd icon:

.fa-hdd-o:before {
    content: "\f0a0";
}

copy/paste f0a0 into the parameter field { icon: 'f0a0' }

Examples

full full full full full

Donation

If you find this plugin usefull or/and use it commercially please donate as much as you like.

npm.io

1.0.1

7 years ago

1.0.0

7 years ago

1.0.2

7 years ago