UNPKG

lucid-ui

Version:

A UI component library from AppNexus.

39 lines (37 loc) 740 B
import _map from "lodash/map"; import _sum from "lodash/sum"; import React from 'react'; import createClass from 'create-react-class'; import { PieChart } from '../../../index'; var data = [{ x: 'Leslie', y: 60 }, { x: 'Ron', y: 40 }, { x: 'Tom', y: 30 }, { x: 'Gary', y: 20 }, { x: 'Ben', y: 15 }]; var total = _sum(_map(data, 'y')); var style = { paddingTop: '4rem' }; export default createClass({ render: function render() { return /*#__PURE__*/React.createElement("div", { style: style }, /*#__PURE__*/React.createElement(PieChart, { data: data, yAxisFormatter: function yAxisFormatter(value) { return "".concat((value / total * 100).toFixed(1), "%"); } })); } });