Jump to content

Need help in a mathematical logic for a jQuery plugin development


sagnik

Recommended Posts

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...