Git Product home page Git Product logo

js-plugin-circliful's Introduction

Circle Statistics

Test it https://stackblitz.com/edit/js-2m2bs7

New implementation of circliful, without any dependencies - dependencies are only used for development like webpack, jest, typescript, tslint and babel.

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

How to use circliful

Include circliful to your Site via script tag. If you want to use font-awesome icons you need to include the files separately.

Github clone / download

<link href="dist/main.css" rel="stylesheet" type="text/css" />

<div id="circle"></div>

<script src="dist/circliful.js"></script>
<script>
    circliful.newCircle({
        percent: 50,
        id: 'circle',
        type: 'simple',
    });
</script>

npm package

npm i js-plugin-circliful
import {circliful} from 'js-plugin-circliful';

circliful.newCircle({
  percent: 50,
  id: 'circle',
  type: 'simple',
});
@import 'js-plugin-circliful/dist/main.css';
<div id="circle"></div>

Documentation

If you feel there is something missing in the documentation or the library please open a issue.

Donation

If you find this plugin useful or/and use it commercially feel free to donate me a cup of coffee :)

js-plugin-circliful's People

Contributors

nebhead avatar pguso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

js-plugin-circliful's Issues

Source code (unminified)?

Nice work!
Could you please post the unminified JS source? (i.e. jquery.circliful.js) so that we can fork and contribute?
For example, I'd like to:

  • customize the animation speed (or disable it entirely),
  • find out why the DIV element requires an id (and auto-generate one if it does not, based on a timestamp for example)
  • find out why the classes placed on the DIV disappear (I'd like to put a float class there)

Thanks

Is it possible to add tooltip ?

I want to add tooltip on both portions of circle, one filled semi circle and other blank semi circle with different text. Is it possible to do that as its canvas.

Data-bordersize don't work.

Got these options: <div class="stat" id="myStat1" data-dimension="180" data-text="90" data-info="" data-width="15" data-bordersize="15" data-fontsize="50" data-percent="90" data-fgcolor="#3c989e" data-bgcolor="#eee" data-fill="white" data-total="100" data-part="90" data-icon="long-arrow-up" data-icon-size="28" data-icon-color="#fff" data-animationstep="0.4"></div>

Bordersize didn't change.

Half Circle still uses full dimenison

When you create half circle, it uses the full dimension (height/width). For example, default data-dimension 200 (200px X 200px). This creates wasted white space below the half circle. It should be 200px by 100px in revised dimension calculation. I realize we can use negative padding or margins in CSS to get around this. But, I was hoping to avoid that.

Outline data border with

I started using your plugin recently and it serves me quite well, but i need an extra feature, and i didnt see in your documentation how to do it.
What i need is to set exact width of outer border width. I noticed that outer border getting smaller proportionaly with data-width, but when i set data-width to 1px, my outer border stays somewhere between 10-15px. Is there any way that i can explicitly set outer border width to 3px.

Multiple console.log's being written

Line 55 of circliful.js is writing the count to the console. Should this be happening?

var timer = window.setInterval(function () {console.log(count++)....

Info text missing

Hi, it seems that info text is missing inside circle, or am I doing something wrong?

I added .text(info) to function addInfoText and now it is ok.

        function addInfoText(obj, factor) {
            $('<span></span>')
                .appendTo(obj)
                .addClass('circle-info-half')
                .text(info)
                .css(
                'line-height', (customSettingsObj.dimension * factor) + 'px'
            );
        }

data-text not breaking lines

How do i break lines in data-text ? Is it possible to have two or three lines of text depending on the lenght of the string ?

Inconsistencies with data-icon-color / data-iconcolor

Hi,

Just wanted to let you guys know that in the docs it says data-icon-color and data-icon-size but the javascript uses iconcolor and iconsize. Use data-iconcolor and data-iconsize inorder to use these methods.

Yours sincerely,
wally

Circle charts broken

I was using the most recent version which included an update to include text instead of icons below the percentage. All was well with that. All of the charts on my site broke with the recent renaming of the files. I updated the css and js cdn paths, but now be charts will not initialize.

Using:
<link href="https://cdn.rawgit.com/pguso/jquery-plugin-circliful/master/css/jquery.circliful.css" rel="stylesheet">
<script src="https://cdn.rawgit.com/pguso/jquery-plugin-circliful/master/js/jquery.circliful.min.js"></script>

To test, I have an element called "test-chart".
<div id="test-chart"></div>

I am initializing on document load with:
$("#test-chart").circliful({ animationStep: 5, foregroundBorderWidth: 15, backgroundBorderWidth: 15, percent: 20, foregroundColor: "#4caf50", text: "CPU" });

All I see is an empty chart with a gray outer border, none of the settings above applied.

image

Same thing happens in jsfiddle:
[https://jsfiddle.net/k1sfd7rt/]

circle disappear after window resize or device rotation

I am using the latest js from here.
The pie circle disappear after resize or rotate the device. Need a refresh to reset.

I grabbed an old version from web which does not have this problem. (but with other error code)

Any ideas how to fix it?

0.1.6 tagged release has incorrect bower.json version (0.1.5)

Just noticed bower was failing to resolve this dependency. Looks like it was finding the 0.1.6 tagged release and crashing out once it read the bower.json.

mismatch Version declared in the json (0.1.5) is different than the resolved one (0.1.6)

Seems a few of my other dependencies have this issue too and seem to resolve, though. shrug

data-total and data-part

Are not these two suppose to show percentage without data-percent attribute? It is not working for me unless i add data-percent and that kills the reason of above two. The examples also using all three of there attributes. What i am missing here?

Only one circle is displayed in mobile

When I test my site on mobile using this plugin I only get one white circle. There is no grey to display the percentage and all the other circles is gone

Small issues found with font-awesome

Hi guys,
I just downloaded this plugin and it's awesome, great job. But I found two small issues:

  • I already have font-awesome included in my website and I followed your instructions in adding only the icon name without fa-, but this doesn't work. After looking through the source code, I found this:
.addClass('fa ' + $(this).data('icon')) 

instead of

.addClass('fa fa-' + $(this).data('icon')) 
  • After I fixed the problem with the icon I noticed that icon is being included before the text and not after. I found this in addCircleText function:
.prepend(icon) 

instead of

.append(icon) 

Beside these small issues everything is awesome thanks.

Best regards

jQuery dependency?

In the Readme it lists a hard dependency on 1.10, and I see in the bower file it's >= 1.5 -- can you be more specific?

Renamed filename

There was a breaking change to the library's filename without notice.
Also the bowerfile still points to the old file name.

firefox 34.0.5 - renders 3 times

This plugin is just what i've been looking for - but when i render the demo code, it gets rendered three times - once with the circle and text where it should be, then the text, then the empty circle.

The code i have added to my page:
< div id="myStat" data-dimension="250" data-text="35%" data-info="New Clients" data-width="30" data-fontsize="38" data-percent="35" data-fgcolor="#61a9dc" data-bgcolor="#eee" data-fill="#ddd" data-total="200" data-part="35" data-icon="long-arrow-up" data-icon-size="28" data-icon-color="#fff">< /div>

Text

Love the new implementation, but lost the ability to have text instead of icons? Is there a way to use the old functionality to add text below the percentage instead of using an older version?

Why divide by 0.996 ?

When i pass the data-type="half" parameter to the plugin , behind the scenes the following math is performed:

if ($(this).data('type') !== undefined) {
type = $(this).data('type');

            if (type == 'half') {
                startAngle = 2.0 * Math.PI;
                endAngle = 3.13;
                circ = Math.PI;
                quart = Math.PI / 0.996;
            }
        }

My question is about this line here quart = Math.PI / 0.996;

Now why is that line not:

quart = Math.PI;

or

quart = Math.PI / 1;

Which would be more logical ? or have you done that intentinally so that the drawing lines starts slightly before where it actually should ? i mean why devide by 0.996 ?

Line of code can be found HERE https://github.com/pguso/jquery-plugin-circliful/blob/master/js/jquery.circliful.js#L144

data-total attribute by default maximum value is 100 ?

Hi,
it amazing plugin...
i was facing some minor issue on setting the attribute values to data-total

some time data-total maximum values will be less than the 100 ?
in this scenario, data-total attribute is setting minimum = 100

let say example :



the circle is not showing correctly....
by default is taking data-total="100" data-percent="8".....

As per my scenario some time data-total will be less than 100...so how can i handle this situation...

animationstep not recognized

I've attempted to set animationstep="0" in the div tag, but it still animates. It also appears to animate the same speed, regardless of the animationstep setting.

Is there any way to update on AJAX success response?

Hi,

I had used this great chart in few of my projects for dashboard chart purpose, however in one of my projects I want this to be re-draw based on AJAX response is this possible?

your help is much appreciated.

Pixelation after upgrading from 0.1.4 to 0.1.5

Hey, neat plugin.

After using 0.1.4 on a project last year, I upgraded to 0.1.5 and noticed pixelation (jagged edges) on the foreground circle.

For the life of me, I cannot see what has changed from a canvas/drawing perspective.

I noticed there is now a bgrCircle() function which causes the undesirable rendering (compared to the previous version when all the drawing was inside animate()).

Any ideas?

0.1.4

circliful-0 1 4

0.1.5

circliful-0 1 5

IE8 drawing

Hi must do app with circliful on IE8 added excanvas so i don't have any error in console but plugin don't drawing circles so how this look on IE8
image
and how look on modern browsers
image

Callback function

Please, add callback function when animation stoped (in param options). Thank you.

Not working Inside Phonegap App On Android

I've got the plugin implemented in a simple phonegap application, and it doesn't work for some reason. No errors that I can see in the debug panel, just doesn't render.

I have web version for development and that works perfectly, but for some reason, not in the app. The main container shows up on the first load of the given page, but doesn't draw the ring. Then if I switch pages, then switch back, nothing appears at all.

The app is built with Backbone.js which includes the following:

jquery.js (2.1.0)
underscore.js (1.5.2)
backbone.js (1.1.0)
pageslider.js (no version reference)
moment.js (2.6.0)

Then of course all my backbone models and views.

Any thoughts or suggestions would be greatly appreciated.

-Vince

Retina Support

The graphs look a little bit blurry on retina displays. Is there anyway we can add retina support?

Thank you for an awesome plugin!

This chart not working in Widows Safari browser!

this is a very good plugin and I had used in many of my projects.

some of my clients asked me that these charts are not working in Safari browser. So I would like to ask you that if any fixes for this are available.

Thanks for a good plugin.

I will be waiting for this.

Not working in CS6

I cannot get this to work at all in CS6.

I have added link and scripts to head
I have added scripts to the end
I have added all example elements the main page
only a couple numbers and names show up and no circles/colors

I've uploaded the file to my server and it does not work on my existing page
I also uploaded the circliful index to my server and that seems to render everything just fine.

The only thing I did not do is replace the font-awesome.min file because I have version 4.3 and the one it comes with is 4.1.

Help??
Thanks,

late binding issues

First of all thanks for the great work....

I am using AnglularJS and with the following example ( lots of attributes omitted for brevity)

<div id="myStat" ...... data-text="{{scope_text_variable}}" 
    data-total="{{scope_total_variable}}" 
    data-part="{{scope_value_variable}}"></div>

The chart does not display the values as the chart is drawn before the scope variables are resolved.

Do you know a simple/elegant way to convert your pure jQuery library to a more AngularJS friendly one?

Thank you in advance for the help

Always full circle

For some reason, my circles are always at 100%. This used to work, but is broken since the latest release (0.1.5)

capture

<div class="circliful" data-dimension="90" data-text="vCPUs" data-width="5" data-bordersize="3" data-fontsize="14" data-total="200" data-part="82" data-fgcolor="#5fbeaa" data-bgcolor="#ebeff2" style="width: 90px;"></div>

$('.circliful').circliful();

Am I missing something?

Update percentage and circle

Is there a way to update the percentage and the circle without re doing the circle?

I just want to update the circle every time the user performs certain action.

Thank you.

Circliful not working withing an ng repeat

I'm trying to use circliful to create a bunch of graphs within an ng repeat. However it isn't working . Will circliful not work when used within an ng repeat.

<div ng-repeat="type in types">
    <div>
        <div id="myStat" data-dimension="300" data-text="{{type.value}}" data-info="" data-type="half"    data-width="40" data-fontsize="38" data-percent="35" data-fgcolor="#61a9dc" data-bgcolor="#eee" data-fill="#fff" data-total="200" data-part="35" data-icon="long-arrow-up" data-icon-size="28" data-icon-color="#fff"></div>
    </div>
</div>

This is what my markup looks like. Any help or suggestions would be appreciated.

Consider multiple percentage support

I have a scenario where I want the circle to display multiple percentage segments each with a different color while the percentage text displayed would be the first percentage segment. Consider a scenario that presents the percentage success, warning and failure of something. The combination of these would add up to 100% or if they don't, the existing gray would be the remaining segment.

Any thoughts on whether this is worthwhile supporting in this component? If not, perhaps some extensibility points could be added such that circliful could be extended to provide this support.

Circle fill color cannot be set without using data attribute

When I try to set the circles' fill colour in my script, e.g. .circliful({fill: "#FFF"}), this has no effect. Using data-fill="#FFF" does work, however. I am able to set all other options without using data- attributes except for this one.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.