1
0
Fork 0
mirror of https://github.com/gwm17/implot.git synced 2024-11-22 18:28:53 -05:00

make pie plots respond to fits

This commit is contained in:
Evan Pezent 2021-06-09 11:26:54 -07:00
parent e9469cf347
commit ab24f756fa

View File

@ -1730,6 +1730,10 @@ void PlotPieChart(const char* const label_ids[], const T* values, int count, dou
double percent = normalize ? (double)values[i] / sum : (double)values[i];
a1 = a0 + 2 * IM_PI * percent;
if (BeginItem(label_ids[i])) {
if (FitThisFrame()) {
FitPoint(ImPlotPoint(x-radius,y-radius));
FitPoint(ImPlotPoint(x+radius,y+radius));
}
ImU32 col = GetCurrentItem()->Color;
if (percent < 0.5) {
RenderPieSlice(DrawList, center, radius, a0, a1, col);