Skip to content

[Feature] Pie chart: no text and specify colors #662

@CosminPerRam

Description

@CosminPerRam

Feature description
Hey! Some time ago I made a sorting visualizer by utilizing this great library and I'd like to add support for visualizing via pie plots, but I can't exactly do this as I'd like because:

  1. I can't specify what color I'd like an element to have (see photo 1)
  2. I can't hide the element's text (see photo 2)

Additionally, if it's possible I'd like to be able to set the weight/size of each element to be an equal amount to each (this is very visible in photo 1, the 12'o'clock right element is bigger than the left one).

Feature videos/screenshots
Below I have attached some context screenshots amongst with some very ugly and hacky changes I attempted to made.

Photo 1: Can't specify colors for the pie elements.
Image
Fix: Called a custom function here to generate a color based on the element's value.

ImU32 col = GetCurrentItem()->Color;

Photo 2: Can't hide element's text
Image
Fix: removed these lines

implot/implot_items.cpp

Lines 2363 to 2364 in 81b8b19

ImU32 col = CalcTextColor(ImGui::ColorConvertU32ToFloat4(item->Color));
draw_list.AddText(pos - size * 0.5f, col, buffer);

Photo 3: With both limits mitigated, this is something I'd like to have (note that the additional request I mentioned isn't that visible now).
Image

The first problem (and the additional one) could maybe be solved via a flag, but for the second I'm not sure what the best solution would be.
These requests sound a bit odd for a normal pie chart usecase but if these are not fit to be made for this library that's fine.
If this issue could have better been split into separate ones please mention to do so and close this one.
I'm sorry if I missed the obvious, haven't touched implot/imgui for a long while, thanks for the wonderful library and welcome new maintainer (:

Metadata

Metadata

Assignees

No one assigned

    Labels

    prio:mediumMedium prioritystatus:ideaFeature under considerationtype:featNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions