import React, { Component } from 'react'; import { Chart, Geom, Axis, Tooltip, Coord, Label, Legend, View, Guide, Shape } from 'bizcharts'; import DataSet from '@antv/data-set'; const { DataView } = DataSet; const { Text } = Guide; let data = [ { action: '浏览网站', pv: 50000 }, { action: '放入购物车', pv: 35000 }, { action: '生成订单', pv: 25000 }, { action: '支付订单', pv: 15000 }, { action: '完成交易', pv: 8000 } ]; const dv = new DataView().source(data); dv.transform({ type: 'percent', field: 'pv', dimension: 'action', as: 'percent' }); data = dv.rows; const cols = { percent: { nice: false } } export default class Basic extends Component { render() { return ( {data.map((obj,index) => { return () })} { return { name: action, percent: parseInt(percent * 100) + '%', pv: pv }; }]} > ); } }