JSFiddle - React, Tailwind, and code Playground
by Margus Martsepp
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://cdn.rawgit.com/pguso/jquery-plugin-circliful/1.2.0/js/jquery.circliful.js"></script>
<section class="container">
<h3>Circliful</h3>
<div class="row">
<div class="col-lg-4">
<div id="test-circle"></div>
</div> </div>
</section>
<script>
$( document ).ready(function() { // 6,32 5,38 2,34
test =[
{'percent': 0, 'color': '#C0C0C0', 'title': 'Gryffindor' },
{'percent': 0, 'color': '#00ff00', 'title': 'Ravenclaw' },
{'percent': 0, 'color': '#31e8fd', 'title': 'Hufflepuff' },
{'percent': 0, 'color': '#c52cfd', 'title': 'Slytherin' },
{'percent': 0, 'color': '#ffc733', 'title': 'Slytherin' }
];
test[1].percent = 29;
$('#test-circle').attr({
"data-animation": 1,
"data-animationStep": 1,
"data-foregroundBorderWidth": 7,
"data-backgroundBorderWidth": 3,
"data-textSize": 28,
"data-textStyle": 'font-size: 24px;',
"data-textColor": '#CD7F32',
"data-text":"Bronze",
"data-multiPercentage": 1,
"data-percentages": test,
"data-multiPercentageLegend": 1,
"data-replacePercentageByText": '',
"data-backgroundColor": '#eee',
"data-icon": 'f005',
"data-iconPosition": 'top',
"data-iconColor": '#CD7F32'
});
$('#test-circle').circliful();
});
</script>
CSS
.circliful .outer {
fill: transparent;
stroke: #333;
stroke-width: 19.8;
stroke-dasharray: 534;
transition: stroke-dashoffset 1s;
-webkit-animation-play-state: running;
/* firefox bug fix - won't rotate at 90deg angles */
-moz-transform: rotate(-89deg) translateX(-190px);
}
/* full circle 25 empty 534 */
.circliful .inner {
fill: transparent;
stroke: orange;
stroke-width: 20;
stroke-dasharray: 534;
transition: stroke-dashoffset 1s;
-webkit-animation-play-state: running;
/* firefox bug fix - won't rotate at 90deg angles */
-moz-transform: rotate(-89deg) translateX(-190px);
stroke-dashoffset: 0;
}
.circliful {
overflow: visible !important;
}
.svg-container {
width: 100%;
margin: 0 auto;
overflow: visible;
position: relative;
}
svg .icon {
font-family: FontAwesome;
}
.legend-line {
white-space: nowrap;
}
.color-box {
width: 15px;
height: 15px;
border-radius: 2px;
display: inline-block;
float: left;
padding-top: 3px;
margin: 2px 5px 0 0;
}