Draws this histogram in the drawing panel. @param drawingPanel @param g
(DrawingPanel drawingPanel, Graphics g)
| 357 | * @param g |
| 358 | */ |
| 359 | @Override |
| 360 | public synchronized void draw(DrawingPanel drawingPanel, Graphics g) { |
| 361 | if (bins.size() == 0 || !visible) { |
| 362 | return; |
| 363 | } |
| 364 | // Shape oldClip = g.getClip(); |
| 365 | g = g.create(); |
| 366 | g.setColor(binFillColor); |
| 367 | g.clipRect(0, 0, drawingPanel.getWidth(), drawingPanel.getHeight()); |
| 368 | for (Iterator<Integer> keys = bins.keySet().iterator(); keys.hasNext();) { |
| 369 | Integer binNumber = keys.next(); |
| 370 | Double d = (bins.get(binNumber)); |
| 371 | if (d == null) { |
| 372 | break; |
| 373 | } |
| 374 | double occurrences = d.doubleValue(); |
| 375 | if (normalizedToOne) { |
| 376 | occurrences /= sum; |
| 377 | } |
| 378 | if (binStyle == DRAW_BIN) { |
| 379 | drawBin(drawingPanel, g, binNumber.intValue(), occurrences); |
| 380 | } else { |
| 381 | drawPoint(drawingPanel, g, binNumber.intValue(), occurrences); |
| 382 | } |
| 383 | } |
| 384 | // g.setClip(oldClip); |
| 385 | g.dispose(); |
| 386 | } |
| 387 | |
| 388 | /** Clears all data from this histogram and resets min and max values. */ |
| 389 | public synchronized void clear() { |
nothing calls this directly
no test coverage detected