Piechart overlaps items overlap
Closed this issue · 3 comments
Ava-Fleming commented
When part of the dataset is substantially larger than the remaining set there is overlapping text. This seems to be a problem when the smaller sets are almost the same.
Sample code:
let mut pie_chart = PieChart::new( vec![]);
pie_chart.series_list.push((
"item 1",
vec![29 as f32],
).into());
pie_chart.series_list.push((
"item 2",
vec![2 as f32],
).into());
pie_chart.series_list.push((
"item 3",
vec![2 as f32],
).into());
Ava-Fleming commented
It looks like the label offset on is_left plays into this. the end.y is adjusted it generally seems to fix it.
I'm taking the index and doing some crude math to see what changes I can make it do here.
let is_left = angle > 180.0;
if is_left {
end.x -= label_offset;
end.y -= 10.0-(label_offset/(index as f32));
} else {
end.x += label_offset;
}
vicanso commented
@Ava-Fleming Please try the latest version.
Ava-Fleming commented
Tested this today, it looks like it resolves the problem. Thank you!