kg_charts
kg_charts 图标库。目前只有雷达图。未来可能会添加其他类型的图表
开始
dependencies:
kg_charts: ^0.0.4
雷达图效果如下
caption
使用示例
RadarWidget(
radarMap: RadarMapModel(
legend: [
LegendModel('10/10',const Color(0XFF0EBD8D)),
LegendModel('10/11',const Color(0XFFEAA035)),
],
indicator: [
IndicatorModel("English",100),
IndicatorModel("Physics",100),
IndicatorModel("Chemistry",100),
IndicatorModel("Biology",100),
IndicatorModel("Politics",100),
IndicatorModel("History",100),
],
data: [
// MapDataModel([48,32.04,1.00,94.5,19,60,50,30,19,60,50]),
// MapDataModel([42.59,34.04,1.10,68,99,30,19,60,50,19,30]),
MapDataModel([100,90,90,90,10,20]),
MapDataModel([90,90,90,90,10,20]),
],
radius: 130,
duration: 2000,
shape: Shape.square,
maxWidth: 70,
line: LineModel(4),
),
textStyle: const TextStyle(color: Colors.black,fontSize: 14),
isNeedDrawLegend: true,
lineText: (p,length) => "${(p*100~/length)}%",
dilogText: (IndicatorModel indicatorModel,List<LegendModel> legendModels,List<double> mapDataModels) {
StringBuffer text = StringBuffer("");
for(int i=0;i<mapDataModels.length;i++){
text.write("${legendModels[i].name} : ${mapDataModels[i].toString()}");
if(i!=mapDataModels.length-1){
text.write("\n");
}
}
return text.toString();
},
outLineText: (data,max)=> "${data*100~/max}%",
),
参数说明
| 参数 | 类型 | 必需 | 描述 |
|---|---|---|---|
| radarMap | RadarMapModel | 是 | 包含图例、雷达点、雷达数据、半径、雷达类型(圆形、方形)、文本最大宽度以及内部绘制的几条线(linemodel包含绘制线的颜色、文字大小等) |
| 文本样式 | style | no | 外部绘制文本的颜色和大小 |
| isNeedDrawLegend | 布尔值 | no | 默认 true |
| lineText | 函数 | no | 内部绘制的文本根据数据动态生成。如果为空,则不显示 |
| dilogText | 函数 | no | 点击出现的对话框根据数据动态生成。如果为空,则不显示 |
| outLineText | 函数 | no | 外部绘制的文本根据数据动态生成。如果为空,则不显示 |





