Custom per-item colors for line and scatter plot#608
Open
mihaly-sisak wants to merge 8 commits intoepezent:masterfrom
Open
Custom per-item colors for line and scatter plot#608mihaly-sisak wants to merge 8 commits intoepezent:masterfrom
mihaly-sisak wants to merge 8 commits intoepezent:masterfrom
Conversation
Contributor
Author
|
Renamed |
Modifies implot.h DragPoint, DragLineX, DragLineY, DragRect functions held argument to out_held. The last parameter is called out_held in the implementation cpp file. This change brings that to the header, provides clearer understanding for the user.
This was referenced Oct 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello!
I've implemented user-settable per-item colors for line and scatter plots.
I've tried to match your coding style as close as I was able.
Please consider merging this pull request, or provide feedback how can I improve the implementation so it can be merged.
All previously available public plot APIs are unchanged.
I've added two new plot types:
The user can write a callback to set the item color based on the index.
I've added to the demo to showcase the new APIs.
The single-color plots are drawn with a new
struct ColorGetterthat is basically just a wrapper aroundImGui::GetColorU32(GetItemData().Colors[col]).I wanted to cache the plot colors so the ImVec4->ImU32 conversion happens only once. If you can give me any direction how can I achieve this more elegantly (than the current
fill_colors()) please point me to the right direction. With this setup the ImVec4->ImU32 conversion happens only once, just as before with the single-color only version.The per-item-colored plots are drawn with
struct ColorGetterFuncPtr, implemented in the same style asstruct GetterXYandstruct GetterFuncPtr.