Jump to content

Need help in a mathematical logic for a jQuery plugin development


Recommended Posts

Posted

Hi, I'm developing a jQuery chart plugin which will allow to create any type of charts but currently donut charts are allowed. It has 2 options, one of those is "maxProgress" and another is "completed". These options can be modified using "max-progress" & "completed" attributes of a "div" element. And in the CSS part has a fixed property of "600" for "stroke-dasharray". And when a donut chart has been created "style=stroke-dashoffset" is added to the "circle" tag inside an svg element using jquery. So what I need to do is, somehow calculate the "stroke-dashoffset" value which cannot be greater than "600".

For example, if an user creates the following element:

<div class="sgn-charts" max-progress="100" completed="50"></div>
Then the circle of the chart should be half-filled. It should work like a clock.

Another example is,

<div class="sgn-charts" max-progress="100" completed="70"></div>
In this case, the circle should look as it looks in an analogue clock when the time is "12:40".

Can anyone help me to do this?

Thanks in advance.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...