All Projects → vonbearshark → react-donut-chart

vonbearshark / react-donut-chart

Licence: other
An extendable SVG donut chart React component

Programming Languages

typescript
32286 projects
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to react-donut-chart

git-pretty
🤖 A helpful CLI for your git troubles!
Stars: ✭ 29 (+11.54%)
Mutual labels:  chart
wxcharts
微信小程序 chart 、K线图、分时图
Stars: ✭ 11 (-57.69%)
Mutual labels:  chart
chart4s
Draw a web chart by Scala
Stars: ✭ 36 (+38.46%)
Mutual labels:  chart
toast-ui.vue-chart
Toast UI Chart for Vue
Stars: ✭ 53 (+103.85%)
Mutual labels:  chart
Mermaid
Provides a parser function to generate diagrams and flowcharts with the help of the mermaid script language
Stars: ✭ 27 (+3.85%)
Mutual labels:  chart
LineChartView
An interactive line chart written in SwiftUI with many customizations (colors, line size, dots, haptic feedbacks). Support value and time series.
Stars: ✭ 59 (+126.92%)
Mutual labels:  chart
helm-postgresql
Helm Chart for postgresql
Stars: ✭ 35 (+34.62%)
Mutual labels:  chart
AMVennDiagramView
AMVennDiagramView is a view can display the diagram like Venn diagram.
Stars: ✭ 39 (+50%)
Mutual labels:  chart
Android-System-Related-Charts
各种与Android系统相关的框架图、流程图
Stars: ✭ 52 (+100%)
Mutual labels:  chart
ScalaTIKZ
ScalaTIKZ is an open-source library for PGF/TIKZ vector graphics.
Stars: ✭ 18 (-30.77%)
Mutual labels:  chart
UCharts
UCharts allows creating radar charts, pie charts, half pie chart in your Unity3d Games.
Stars: ✭ 33 (+26.92%)
Mutual labels:  chart
ng-charts
🎨📉 A fully functional Angular 14+ Chart.js library based from ng2-charts
Stars: ✭ 14 (-46.15%)
Mutual labels:  chart
awsdtc
AWS Data Transfer Cost Explorer
Stars: ✭ 90 (+246.15%)
Mutual labels:  chart
area3d vis
3D Graph Visualization for Kibana 5
Stars: ✭ 28 (+7.69%)
Mutual labels:  chart
ChartTheStockMarket
🔥 📈 💸 Chart the Stock Market - FCC Challenge
Stars: ✭ 39 (+50%)
Mutual labels:  chart
sprite
🖌 Draw charts in code. Render in real-time. Embed anywhere as .png.
Stars: ✭ 202 (+676.92%)
Mutual labels:  chart
leaflet.minichart
Leaflet.minichart is a leaflet plugin for adding to a leaflet map small animated charts
Stars: ✭ 27 (+3.85%)
Mutual labels:  chart
billimek-charts
DEPRECATED - new home is https://github.com/k8s-at-home/charts
Stars: ✭ 90 (+246.15%)
Mutual labels:  chart
horoscope
Open source horoscope generation engine
Stars: ✭ 18 (-30.77%)
Mutual labels:  chart
helm-charts
Helm charts for sigstore project
Stars: ✭ 33 (+26.92%)
Mutual labels:  chart

react-donut-chart

An extendable SVG-based donut chart React component.

Example


Installation

npm install react-donut-chart --save


Usage

import DonutChart from 'react-donut-chart';

// things I would never do:
<DonutChart
  data={[
    {
      label: 'Give you up',
      value: 25,
    },
    {
      label: '',
      value: 75,
      isEmpty: true,
    },
  ]}
/>;

View the demo online


Props

Name Required Default Description
data true [{
  value: 100,
  label: '',
  isEmpty:true
}]
The chart data
className false donutchart This is the className given to the top-level svg element. All subclasses are prefixed from this name:
  • ${className}-arcs accesses the entire graph area
    • ${className}-arcs-paths accesses the individual arc paths
  • ${className}-innertext accesses all of the text within the inner donut area
    • ${className}-innertext-label accesses the label within this area
    • ${className}-innertext-value accesses the value within this area
  • ${className}-legend accesses the legend component
    • ${className}-legend accesses the legend rectangle items
    • ${className}-legend-label accesses the labels of the legend items
In addition the selected class is given to selected items, the toggled class to all toggled items, and the isEmpty class to all isEmpty items. All style (and animations) can be manipulated from the CSS
height false 500 Height of the entire component
width false 750 Width of the entire component. If no legend is specified, then the chart takes up the entire width. If a legend is toggled, then the chart takes up 2/3 of the width, and the legend takes up 1/3
colors false ['#f44336', '#e91e63', '#9c27b0', '#673ab7', '#3f51b5', '#2196f3', '#03a9f4', '#00bcd4', '#009688', '#4caf50', '#8bc34a', '#cddc39', '#ffeb3b', '#ffc107', '#ff9800', '#ff5722', '#795548', '#607d8b' ] An array of colors (could be hex strings or named colors) for the data items. Defaults to an array of Google colors
emptyColor false '#e0e0e0' A color for empty data items, defaults to gray
strokeColor false '#212121' A color for the stroke around the items in the graph and legend, defaults to black
colorFunction false (colors, index) => colors[(index % colors.length)] The default cycles through the array of colors and loops for excess
innerRadius false 0.70 The inner donut radius
outerRadius false 0.90 The outer donut radius
selectedOffset false 0.03 The outerRadius offset when an item is selected
emptyOffset false 0.08 The innerRadius and outerRadius offset on isEmpty items
toggledOffset false 0.04 The innerRadius and outerRadius offset on toggle-clicked items
formatValues false (values, total) => `${(values / total * 100).toFixed(2)}%` Custom format for values displayed in the donut chart's inner text area. By default formats as percentages rounded to two decimal places.
onMouseEnter false (item) => item Callback that fires when an item is hovered
onMouseLeave false (item) => item Callback that fires when an item is unhovered
onClick false onClick: (item, toggled) => (toggled ? item : null) Callback that fires when an item is toggle-clicked
legend false true Determines whether or not to create a legend
clickToggle false true Determines whether or not to toggle-freeze the graph on the arc that has been clicked
interactive false true Determines whether to add interactive handlers

Changelog

1.3.0

  • Add interactive prop

1.2.0

  • New module infrastructure
  • Typescript

...

1.1.7

  • Updated dependencies for bug fixes
  • Updated linting

...

1.0.3

  • Bug fixes when no data present and when 100%.

1.0.2:

  • No legend offset by default
  • Hacking for condition of 100%.

1.0.1:

  • Adding lib dist build process to fix importing/

1.0.0:

  • Initial release with demo
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].