A simple radial bar chart

by Thimo Grauerholz

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js"></script>
<script src="https://npmcdn.com/[email protected]/dist/react-with-addons.min.js"></script>
<script src="https://npmcdn.com/[email protected]/dist/react-dom.min.js"></script>
<script src="https://npmcdn.com/prop-types/prop-types.min.js"></script>
<script src="https://npmcdn.com/recharts/umd/Recharts.min.js"></script>
<div id="container">
    <!-- This element's contents will be replaced with your component. -->
</div>

CSS

body {
  margin: 0;
}
#container {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  padding: 10px;
  width: 800px;
  height: 800px;
  background-color: #fff;
}

Babel + JSX

const {RadialBarChart, RadialBar, Legend,LabelList} = Recharts;

const data = [
      {name: 'OK', uv: 13, fill: '#13b213'},
      {name: 'Warning', uv: 1,  fill: '#ffa700'},
      {name: 'Danger', uv:4, fill: '#e53e3e'},
      {name: 'Disabled', uv:1, fill: '#6c757d'}
    ];
    
  const style = {
  	top: 0,
  	left: 350,
  	lineHeight: '24px'
  };
  
  const RenderCustomizedLabel = (labelProps) => {
    const {
      cx, cy, width, value, index, dataGraph,name
    } = labelProps;

console.log(labelProps);

    return (<g>
          <text
            x={cx + width / 2}
            y={cy}
            dy={-5}
            fill="rgb(108, 117, 125)"
            fontSize={13}
            textAnchor="middle"
          >
            {name}
          </text>
        </g>
    );
    }

const SimpleRadialBarChart = React.createClass({
	render () {
  	return (
    	<RadialBarChart width={500} height={300} cx={150} cy={150} innerRadius={20} outerRadius={140} data={data} startAngle={90} 
  endAngle={360}><RadialBar minAngle={15} data={data} background clockWise  />
        
        </RadialBarChart>
    );
  }
})

ReactDOM.render(
  <SimpleRadialBarChart />,
  document.getElementById('container')
);