private void fillScatter(DataSeries series, int points) { Random random = new Random(); for (int i = 0; i < points; i++) { double x = random.nextDouble() * 30 + 150; double y = 60; if (random.nextBoolean()) { y += random.nextDouble() * 15; if (random.nextBoolean() && x > 170) { y += random.nextDouble() * 30; } } else { y -= random.nextDouble() * 20; } x = Math.floor(x * 10) / 10; y = Math.floor(y * 10) / 10; int colorNumber = (int) Math.floor((x - 150) / 30 * 255); Color color = new SolidColor(colorNumber, 0, 255 - colorNumber); DataSeriesItem item = new DataSeriesItem(x, y); // item.setColor(color); series.add(item); } }