Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8334900: IOOBE when adding data to a Series of a BarChart that already contains data #1488

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

drmarmac
Copy link
Contributor

@drmarmac drmarmac commented Jun 24, 2024

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.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issues

  • JDK-8334900: IOOBE when adding data to a Series of a BarChart that already contains data (Bug - P4)
  • JDK-8334901: Style class "negative" is not always added for new BarChart data with negative value (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1488/head:pull/1488
$ git checkout pull/1488

Update a local copy of the PR:
$ git checkout pull/1488
$ git pull https://git.openjdk.org/jfx.git pull/1488/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1488

View PR using the GUI difftool:
$ git pr show -t 1488

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1488.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 24, 2024

👋 Welcome back mmack! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@drmarmac
Copy link
Contributor Author

/issue add JDK-8334901

@openjdk
Copy link

openjdk bot commented Jun 24, 2024

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Ready for review label Jun 24, 2024
@openjdk
Copy link

openjdk bot commented Jun 24, 2024

@drmarmac
Adding additional issue to issue list: 8334901: Style class "negative" is not always added for new BarChart data with negative value.

@mlbridge
Copy link

mlbridge bot commented Jun 24, 2024

Webrevs

Copy link
Collaborator

@mstr2 mstr2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea to deduplicate the code in dataItemAdded and seriesAdded. The patch looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rfr Ready for review
2 participants