Phase 6: Rendering cleanup — PlotContent_Category + PlotContent_XY#961
Open
timmolter wants to merge 2 commits into
Open
Phase 6: Rendering cleanup — PlotContent_Category + PlotContent_XY#961timmolter wants to merge 2 commits into
timmolter wants to merge 2 commits into
Conversation
The _Bar suffix was a historical artifact from when category charts only supported bar rendering. The class now renders all CategorySeries render styles: Bar, Stick, Line, Area, Scatter, and SteppedBar. Update the single instantiation site in Plot_Category.java accordingly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The 47-line error bar drawing block (top/bottom value calculation + drawing three Line2D segments) is self-contained. Extract it into a private paintErrorBar() helper to reduce doPaint() length and improve readability. No logic changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Summary
Low-risk rendering cleanup targeting the two largest
PlotContent_*classes. No logic changes — pixel output is identical before and after.Step 1: Rename
PlotContent_Category_Bar→PlotContent_CategoryThe
_Barsuffix was a historical artifact. The class renders allCategorySeriesrender styles (Bar, Stick, Line, Area, Scatter, SteppedBar). Updated the single instantiation site inPlot_Category.java.Step 2: Extract private methods from
PlotContent_Category.doPaint()The 490-line
doPaint()is now a clean loop dispatcher. Extracted:computeBarDimensions(series, categoryCounter, gridStep, xLeftMargin, seriesCounter)barWidthandxOffsetfor a given category/series position (was an anonymous braced scope)processSteppedBarDataPoint(g, series, y, yOffset, zeroOffset, xOffset, gridStep, seriesCounter, isLastPoint, steppedPath, steppedReturnPath, previousY)previousYfinalizeSteppedBar(g, series, steppedPath, steppedReturnPath)Key design decisions:
steppedPath/steppedReturnPathpre-initialized as emptyArrayLists so they can be passed into extracted methods;isEmpty()replaces thenullsentinel checkdrawLabels()was already properly extracted — left as-isStep 3: Extract
paintErrorBar()fromPlotContent_XY.doPaint()The 47-line error bar block (top/bottom value + three
Line2Dsegments) was self-contained. Extracted intoprivate paintErrorBar(...).Verification