xml中文件
<chart:pieChart id="pieChart"
datasource="keyvalueDs"
angle="30"
depth3D="30"
theme="LIGHT"
height="400px"
labelsEnabled="false"
labelText="[[title]]"
marginRight="20"
titleField="country"
valueField="litres"
width="100%"
align="MIDDLE_CENTER">
<chart:legend enabled="true"
verticalGap="1"
fontSize="12"
align="CENTER"
autoMargins="true"
valueText=" "
equalWidths="true"
markerType="CIRCLE"
position="BOTTOM"/>
</chart:pieChart>
代码
pieChart.setCaption(params.get("title").toString());
List<Map<String,String>> list = (List<Map<String,String>>) params.get("pieMap");
List<KeyValueEntity> listKeyValue = new ArrayList<>();
list.forEach(map->{
KeyValueEntity keyValueEntity = new KeyValueEntity();
keyValueEntity.setValue("country",map.get("country"));
keyValueEntity.setValue("litres",map.get("litres"));
listKeyValue.add(keyValueEntity);
});
listKeyValue.forEach(keyValueEntity -> keyvalueDs.addItem(keyValueEntity));