@@ -2204,22 +2204,22 @@ CALL_INSTANTIATE_FOR_NUMERIC_TYPES()
22042204IMPLOT_INLINE void RenderPieSlice (ImDrawList& draw_list, const ImPlotPoint& center, double radius, double a0, double a1, ImU32 col, bool detached = false ) {
22052205 const float resolution = 50 / (2 * IM_PI);
22062206 ImVec2 buffer[52 ];
2207-
2207+
22082208 int n = ImMax (3 , (int )((a1 - a0) * resolution));
22092209 double da = (a1 - a0) / (n - 1 );
22102210 int i = 0 ;
22112211
22122212 if (detached) {
22132213 const double offset = 0.08 ; // Offset of the detached slice
22142214 const double width_scale = 0.95 ; // Scale factor for the width of the detached slice
2215-
2215+
22162216 double a_mid = (a0 + a1) / 2 ;
22172217 double new_a0 = a_mid - (a1 - a0) * width_scale / 2 ;
22182218 double new_a1 = a_mid + (a1 - a0) * width_scale / 2 ;
22192219 double new_da = (new_a1 - new_a0) / (n - 1 );
2220-
2220+
22212221 ImPlotPoint offsetCenter (center.x + offset * cos (a_mid), center.y + offset * sin (a_mid));
2222-
2222+
22232223 // Start point (center of the offset)
22242224 buffer[0 ] = PlotToPixels (offsetCenter, IMPLOT_AUTO, IMPLOT_AUTO);
22252225
@@ -2237,17 +2237,17 @@ IMPLOT_INLINE void RenderPieSlice(ImDrawList& draw_list, const ImPlotPoint& cent
22372237 for (; i < n; ++i) {
22382238 double a = a0 + i * da;
22392239 buffer[i + 1 ] = PlotToPixels (
2240- center.x + radius * cos (a),
2241- center.y + radius * sin (a),
2240+ center.x + radius * cos (a),
2241+ center.y + radius * sin (a),
22422242 IMPLOT_AUTO, IMPLOT_AUTO);
22432243 }
22442244 }
22452245 // Close the shape
22462246 buffer[i + 1 ] = buffer[0 ];
2247-
2247+
22482248 // fill
22492249 draw_list.AddConvexPolyFilled (buffer, n + 2 , col);
2250-
2250+
22512251 // border (for AA)
22522252 draw_list.AddPolyline (buffer, n + 2 , col, 0 , 2 .0f );
22532253}
@@ -2318,7 +2318,7 @@ void PlotPieChartEx(const char* const label_ids[], const T* values, int count, I
23182318int PieChartFormatter (double value, char * buff, int size, void * data) {
23192319 const char * fmt = (const char *)data;
23202320 return snprintf (buff, size, fmt, value);
2321- };
2321+ }
23222322
23232323template <typename T>
23242324void PlotPieChart (const char * const label_ids[], const T* values, int count, double x, double y, double radius, const char * fmt, double angle0, ImPlotPieChartFlags flags) {
@@ -2358,7 +2358,7 @@ void PlotPieChart(const char* const label_ids[], const T* values, int count, dou
23582358 ImVec2 size = ImGui::CalcTextSize (buffer);
23592359 double angle = a0 + (a1 - a0) * 0.5 ;
23602360 const bool hovered = ImPlot::IsLegendEntryHovered (label_ids[i]) && ImHasFlag (flags, ImPlotPieChartFlags_Exploding);
2361- const double offset = (hovered ? 0.6 : 0.5 ) * radius;
2361+ const double offset = (hovered ? 0.6 : 0.5 ) * radius;
23622362 ImVec2 pos = PlotToPixels (center.x + offset * cos (angle), center.y + offset * sin (angle), IMPLOT_AUTO, IMPLOT_AUTO);
23632363 ImU32 col = CalcTextColor (ImGui::ColorConvertU32ToFloat4 (item->Color ));
23642364 draw_list.AddText (pos - size * 0 .5f , col, buffer);
0 commit comments