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.

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

Commit messages:
 - BarChart: Fix adding non-empty series
 - BarChart: Add styleClass "negative" for added data

Changes: https://git.openjdk.org/jfx/pull/1488/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1488&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8334900
  Stats: 82 lines in 2 files changed: 59 ins; 21 del; 2 mod
  Patch: https://git.openjdk.org/jfx/pull/1488.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1488/head:pull/1488

PR: https://git.openjdk.org/jfx/pull/1488

Reply via email to