1.1.0 • Published 4 years ago

@frontend-trends/donut-chart v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

<donut-chart>

A small Web Component using VanillaJS. This webcomponent follows the open-wc recommendation.

Test it live!

Installation

npm i @frontend-trends/donut-chart -D

Usage

<script type="module">
    import '@frontend-trends/donut-chart/donut-chart.js';
</script>

<donut-chart width="250" height="250" radius="40" stroke-width="20" legend-position="right" data='[
{
    "color": "green",
    "percent": 50,
    "name": "VW"
},
{
    "color": "pink",
    "percent": 20,
    "name": "Opel"
}
]'></donut-chart>

For old browser add polyfill

<script src="node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script>

Attributes

AttributeDefaultDescription
width300defines the width of the web component
height300defines the height of the web component
legend-positionrightdefines the legend position
highlight-color#a8d1ffdefines the highlight color
radius40defines the donut radius
stroke-width30defines the stroke width of the donut
datastringified Array of Objects

Testing using Karma

npm run test
1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago