andlehma / piechartinput

interactive pie chart for selecting percentages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

image

Pie Chart Input

Custom HTML Element for selecting percentages.

Installation / Usage

Include <script src="piechartinput.js"></script> in the body of your html file.

The tag is <pie-input>, and the available attributes are size (in pixels), value (comma-separated list), initial-angle (in radians), colors (comma-separated list), line-thickness (in pixels), handle-radius (in pixels), and onchange (function name string).

Example:

<pie-input size="300" values=".25, .45, .3" initial-angle="3.14" colors="red, blue, #00FF00" line-thickness="10" handle-radius="15"></pie-input>

The value attribute is updated every time the values change, so they can be accessed with

document.querySelector('pie-input').getAttribute('value')

However, it is advisable to use an onchange function. See demo.html for an example.

About

interactive pie chart for selecting percentages


Languages

Language:JavaScript 93.8%Language:HTML 6.2%