On Fri, 21 Jun 2024 22:07:22 GMT, Markus Mack <[email protected]> wrote:
>> This PR provides the test case given in the JBS issue, and a simple fix for
>> the index calculation when inserting data after previous data with duplicate
>> categories.
>>
>> Also, I've added a comment to `BarChart`s javadoc, clarifying the behavior
>> that was apparently assumed (but broken) previously.
>>
>> The index lookup is skipped for performance reasons if there are no
>> duplicates, corresponding to the previous implementation.
>> Further optimizations would be possible, but probably are not really helpful
>> without more extensive changes. The previous code already loops over all
>> categories to check if they are present, typically nested in a loop adding
>> many data items, thus already scaling quadratically when adding lots of
>> mostly unique data points.
>
> Markus Mack has updated the pull request incrementally with one additional
> commit since the last revision:
>
> testAddingDataAtIndex & fix
modules/javafx.controls/src/main/java/javafx/scene/chart/BarChart.java line 227:
> 225: var uniqueCategories = new HashSet<String>();
> 226: for (var entry : seriesCategoryMap.entrySet()) {
> 227: Series s = entry.getKey();
would it make sense to add a comment explaining the reasoning for this more
complex code?
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1476#discussion_r1649465456