Skip to content

Commit

Permalink
Apply rendering hints to overlay drawing - fixes bug #187
Browse files Browse the repository at this point in the history
  • Loading branch information
jfree committed Nov 10, 2020
1 parent 4522d95 commit 2a85da3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The home page for the project is:

http://www.jfree.org/jfreechart

JFreeChart requires JDK 1.6.0 or later. If JavaFX support is required, you
JFreeChart requires JDK 1.8.0 or later. If JavaFX support is required, you
need to also include the JFreeChart-FX extensions:

https://github.com/jfree/jfreechart-fx
Expand All @@ -33,7 +33,7 @@ To use JFreeChart in your projects, add the following dependency to your build t
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</dependency>


Expand Down Expand Up @@ -77,6 +77,7 @@ History
- modify buffer in ChartPanel to handle high DPI displays (bug #170);
- add options to control pan vs zoom in `ChartPanel` (https://github.com/jfree/jfreechart/pull/172)
- fix for exception on extreme zoom on NumberAxis (bug #64);
- apply rendering hints to overlays - fixes bug #187;
- added generics
- DefaultIntervalCategoryDataset no longer allows null keys in constructor (this
is a consequence of introducing generics)
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/jfree/chart/ChartPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,7 @@ else if (drawHeight > this.maximumDrawHeight) {

// zap the buffer onto the panel...
g2.drawImage(this.chartBuffer, insets.left, insets.top, (int) available.getWidth(), (int) available.getHeight(), this);
g2.addRenderingHints(this.chart.getRenderingHints()); // bug#187

} else { // redrawing the chart every time...
AffineTransform saved = g2.getTransform();
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/org/jfree/chart/panel/CrosshairOverlay.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,12 @@ public void removeDomainCrosshair(Crosshair crosshair) {

/**
* Clears all the domain crosshairs from the overlay and sends an
* {@link OverlayChangeEvent} to all registered listeners.
* {@link OverlayChangeEvent} to all registered listeners (unless there
* were no crosshairs to begin with).
*/
public void clearDomainCrosshairs() {
if (this.xCrosshairs.isEmpty()) {
return; // nothing to do
return; // nothing to do - avoids firing change event
}
for (Crosshair c : getDomainCrosshairs()) {
this.xCrosshairs.remove(c);
Expand Down Expand Up @@ -177,11 +178,12 @@ public void removeRangeCrosshair(Crosshair crosshair) {

/**
* Clears all the range crosshairs from the overlay and sends an
* {@link OverlayChangeEvent} to all registered listeners.
* {@link OverlayChangeEvent} to all registered listeners (unless there
* were no crosshairs to begin with).
*/
public void clearRangeCrosshairs() {
if (this.yCrosshairs.isEmpty()) {
return; // nothing to do
return; // nothing to do - avoids change notification
}
for (Crosshair c : getRangeCrosshairs()) {
this.yCrosshairs.remove(c);
Expand Down

0 comments on commit 2a85da3

Please sign in to comment.