package yem.base.common.utils;

import kd.bos.form.chart.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * zhangh
 * 饼图帮助类
 */
public class PieChartHelp {
    public static void drawChart(PieChart pieChart, List<ItemValue> list){
        pieChart.clearData();

        pieChart.setShowTooltip(true);
        pieChart.setShowLegend(true);

        pieChart.setLegendPropValue("orient", "vertical");
        pieChart.setLegendPropValue("x", "right");
        pieChart.setMargin(Position.right, "80");

        PieSeries series = pieChart.createPieSeries("额度占比");
        ItemValue[] itemValues = list.toArray(new ItemValue[]{});
        series.setData(itemValues);
        Label label = new Label();
        label.setShow(false);
        label.setFontSize("10");
        label.setFormatter("{a}:{b}");
        label.setPosition(Position.inside);
        series.setLabel(label);

        pieChart.refresh();
    }
}
