bruno
bruno copied to clipboard
环状图value值有几个很小的时候,title会重叠
环状图value值有几个很小的时候,title会重叠
你好,感谢使用,还请将你的问题截图和代码按照提bug的模板贴上,方便我们排查~
两个问题: 1、title 重叠 2、title 足够长超过屏幕
截图:
代码段
import 'dart:math';
import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
class DoughnutChartExample extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return DoughnutChartExampleState();
}
}
class DoughnutChartExampleState extends State<DoughnutChartExample> {
BrnDoughnutDataItem? selectedItem;
List<BrnDoughnutDataItem> dataList = [];
List<Color> preinstallColors = [
Color(0xffFF862D),
Color(0xff26BB7D),
Color(0xffFFDD00),
Color(0xff6AA6FB),
Color(0xff0984F9),
];
List<double> values = [1, 2, 1, 100, 200];
int count = 5;
void initState() {
super.initState();
for (int i = 0; i < count; i++) {
dataList.add(BrnDoughnutDataItem(
title: '示例示例示例示例示例示例$i',
value: values[i],
color: getColorWithIndex(i)));
}
}
int random(int min, int max) {
final _random = Random();
return min + _random.nextInt(max - min + 1);
}
Color getColorWithIndex(int index) {
return this.preinstallColors[index % this.preinstallColors.length];
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: BrnAppBar(
title: '数据展示',
),
body: Column(
children: <Widget>[
BrnDoughnutChart(
padding: EdgeInsets.all(50),
width: 200,
height: 200,
data: dataList,
selectedItem: selectedItem,
showTitleWhenSelected: false,
selectCallback: (BrnDoughnutDataItem? selectedItem) {
setState(() {
this.selectedItem = selectedItem;
});
},
),
DoughnutChartLegend(
data: this.dataList,
legendStyle: BrnDoughnutChartLegendStyle.wrap),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Padding(
padding: EdgeInsets.only(left: 20),
child: Text('数据个数'),
),
Expanded(
child: Slider(
value: count.toDouble(),
divisions: 10,
onChanged: (data) {
setState(() {
this.count = data.toInt();
dataList.clear();
for (int i = 0; i < count; i++) {
dataList.add(BrnDoughnutDataItem(
title: '示例',
value: random(1, 5).toDouble(),
color: getColorWithIndex(i)));
}
});
},
onChangeStart: (data) {},
onChangeEnd: (data) {},
min: 1,
max: 10,
label: '$count',
activeColor: Colors.green,
inactiveColor: Colors.grey,
semanticFormatterCallback: (double newValue) {
return '${newValue.round()}}';
}),
),
],
),
],
),
);
}
}
你好,感谢使用,还请将你的问题截图和代码按照提bug的模板贴上,方便我们排查~
你好,这个有解决的计划吗?