RFR: 8334900: IOOBE when adding data to a Series of a BarChart that already contains data [v2]

Andy Goryachev angorya at openjdk.org
Fri Jul 12 16:23:57 UTC 2024


On Fri, 12 Jul 2024 15:54:24 GMT, Markus Mack <mmack at openjdk.org> wrote:

>> This PR is a fix for another IOOBE that I discovered while working on #1476.
>> 
>> The PR simplifies the code for adding a series that already contains data by adding the data points one-by-one.
>> As far as I can see no attempt was previously made to optimize the bulk operation except for some trivial O(1) operations, so this should have no noticable performance impact.
>> 
>> Accidentally this fixes another bug related to the missing "negative" style class when negative data values are added.
>> 
>> Also, the PR aligns the handling of duplicate categories with the behavior clarified in #1476, when there are duplicates in the data that was already in the series before the series was added to the chart.
>> 
>> Note a change was made to the createTestSeries() test method, letting it start at index 1, avoiding the duplicate data items resulting from multiplying by 0.
>> Without this change `testSeriesRemoveAnimatedStyleClasses` would fail because it counts the number of plot children, where the duplicates are now removed.
>
> Markus Mack has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits:
> 
>  - Merge remote-tracking branch 'refs/remotes/origin/master' into fixes/bar-chart-add-nonempty-series
>    
>    # Conflicts:
>    #	modules/javafx.controls/src/test/java/test/javafx/scene/chart/BarChartTest.java
>  - BarChart: Fix adding non-empty series
>  - BarChart: Add styleClass "negative" for added data

I don't see the 'negative' style added to negative bars.  I do see BarChart:261 being hit, but nothing in the scene graph.

Tested with the Monkey Tester and double checked with Scenic View 11.0.2:

![Screenshot 2024-07-12 at 09 18 36](https://github.com/user-attachments/assets/9f7d3a23-cce2-4d36-91e0-e84f24e0fd49)

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1488#issuecomment-2225917257


More information about the openjfx-dev mailing list