import React, { Component } from 'react'; import { Chart, Geom, Axis, Tooltip, Coord, Label, Legend, View, Guide, Shape, G2 } from 'bizcharts'; import { DataView } from '@antv/data-set'; const { Html } = Guide; const data = [ { item: 5, count: 0, title: 'xxx' }, { item: 4, count: 0, title: 'x;ghxx' }, { item: 3, count: 1.43, title: 'xxdgdfx' }, { item: 2, count: 98.57, title: 'xxrgrex' }, { item: 1, count: 0, title: 'xdfdxx' } ]; const dv = new DataView(); dv.source(data).transform({ type: 'percent', field: 'count', dimension: 'title', as: 'percent' }); const cols = { percent: { formatter: val => { val = val * 100; return Number(val).toFixed(2)+'%'; } } }; export default class PieC extends Component { render() { return { percent = percent * 100; return { name: title, value: Number(percent).toFixed(2)+'%', }; } ]} style={{ lineWidth: 1, stroke: "#fff" }} > } };