Code Monkey home page Code Monkey logo

donutio's Introduction

Donutio 2.5.2

jQuery.Donutio - plugin that draws donut charts.

Using example

  $("#wrap").donutio({
    multiple: true,
    type: "donut",
    data: data,
    radius: 70,
    width: 10,
    padding: 10,
    color_negative: "#D2494B",
    color_positive: "#55A647",
    color_zero: "#ccc",
    percents: true,
    colored_percents: true
  });

Where is data is an array of objects with keys โ€“ value, text, url, id. Value must contain a number (ex. 12, -50, 38...). Text is array of strings (ex. ["Label", "100", "23", ...]) It can contain html tags. Each string will be placed into a separate html tag with unique class name. Url - if it exists, the donut container will be wrapped into link with indicated url. Id - should contain any unique data about current object.

Type - "donut" or "pie", see example on preview

Multiple - indicates that each data item should be drawn separately. By default true. In case of false, you have to add the parameter "active" with data item array index. For example, active: 2.

Radius - radius of donut chart

Width - donut line width. Don't need to indicate this parameter if you want pie-chart.

Padding - the distance between chart and its container

color_negative - highlighted segment color with negative value

color_positive - highlighted segment color with positive value

color_zero - segment color for zero value

Percents - If true, it calculates percents to show, depending on given values in data.

Colored-percents - true/false, makes coloured percent value (color depends on value)

onclick - callback function, accepts item argument with value from id key.

Data example

[
  {
    value: -628,
    text: ["46%", "-628.<span>00</span>", "Groceries"]
  },
  {
    value: -310,
    text: ["28%", "-310.<span>00</span>", "Cafe and restaurants"],
    id: "310-Cafes"
  },
  {
    value: -186,
    text: ["20%", "-186.<span>00</span>", "Lunches"]
  },
  {
    value: -100,
    text: ["6%", "-628.<span>00</span>", "Alcohol and bars"],
    url: "#bars"
  }
]

The plugin will draw four donut charts with text and highlighted value segment. (if multiple:true or without multiple option)

donutio's People

Contributors

mikehoh avatar alisnic avatar

Watchers

 avatar  avatar

Forkers

alisnic

donutio's Issues

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.