Giter VIP home page Giter VIP logo

svg-circular-chart's Introduction

Simple Circular Chart

This is a circular chart that is implemented completely with SVG. It consists of:

  • The main bar
  • The amount that is completed in the middle of the circle either on absolute number or in % percentage
  • A label bellow the percentage

Props Available

  • width (REQUIRED)(type: integer) (e.g: width={200})
  • amountFilled (REQUIRED)(type: integer) (e.g: amountFilled={50})
  • amountFilledDisplay (DEFAULT: false)(type: boolean) (e.g: amountFilledDisplay={true})
  • displayInPercentage (DEFAULT: false)(type: boolean) (e.g: displayInPercentage={false})
  • base (DEFAULT: 100)(type: integer) (e.g: base={100})
  • MainLineWidth (OPTIONAL)(type: integer) (e.g: MainLineWidth= {6})
  • color (DEFAULT BLACK)(type: any color value compatible to html5) (e.g: color={"#ff001f"})
  • BackgroundLineWidth (DEFAULT: equal to MainLineWidth)(type: integer) (e.g: BackgroundLineWidth={6})
  • backgroundColor (DEFAULT TRANSPARENT)(type: any color value compatible to html5) (e.g: color={"#ff001f"})
  • numberColor (OPTIONAL)(type: any color value compatible to html5) (e.g: numberColor={"#000"})
  • labelText (OPTIONAL)(type: string) (e.g labelText={"TOTAL"})
  • labelColor (OPTIONAL)(type: any color value compatible to html5) (e.g: labelColor={"#000"})
  • roundedEdge (DEFAULT FALSE)(type: boolean) (e.g: roundedEdge= {true})

Example Usage:

import CircleChart from "<your path>/CircleChart"" //Add your Circular chart component in your components folder and import it
.
.
.
.
<CircleChart
    width={250}
    amountFilled={82}
    amountFilledDisplay={true}
    displayInPercentage={true}
    base={200}
    MainLineWidth={6}
    BackgroundLineWidth={6}
    numberColor={"#000"}
    labelText={"TOTAL"}
    color={"#ff001f"}
    labelColor={"#666"}
    backgroundColor={"#eee"}
    roundedEdge={true}
/>

Demo Image

The component is inspired by this article in Medium

svg-circular-chart's People

Contributors

amanolar94 avatar

Watchers

 avatar  avatar

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.