lucid-ui
Version:
A UI component library from AppNexus.
25 lines (24 loc) • 698 B
JavaScript
/* eslint-disable comma-spacing */
import _ from 'lodash';
import React from 'react';
import createClass from 'create-react-class';
import { PieChart } from '../../../index';
const data = [
{ x: 'Leslie', y: 60 },
{ x: 'Ron', y: 40 },
{ x: 'Tom', y: 30 },
{ x: 'Gary', y: 20 },
{ x: 'Ben', y: 15 },
];
const total = _.sum(_.map(data, 'y'));
const style = {
paddingTop: '4rem',
};
export default createClass({
render() {
return (React.createElement("div", { style: style },
React.createElement(PieChart, { data: data, yAxisFormatter: (value) => {
return `${((value / total) * 100).toFixed(1)}%`;
} })));
},
});