Skip to content

Commit

Permalink
Add web fill alpha to SpiderWebPlot.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfree committed Jun 17, 2022
1 parent 2e7867a commit f7e307e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ History
- add new panel for background rendering of charts (PR [#233](https://github.com/jfree/jfreechart/pull/233))
- fix tick label font for `LogAxis` with number format override ([#98](https://github.com/jfree/jfreechart/issues/98));
- added `valueVisible` flag to `MeterPlot` ([#231](https://github.com/jfree/jfreechart/pull/231));
- added `get/setWebFillAlpha()` methods to SpiderWebPlot ([#279](https://github.com/jfree/jfreechart/pull/279))
- add argument checks for annotations ([#223](https://github.com/jfree/jfreechart/issues/223));
- removed `JFreeChartResources.java` file ([#239](https://github.com/jfree/jfreechart/issues/239))

Expand Down
29 changes: 16 additions & 13 deletions src/main/java/org/jfree/chart/plot/SpiderWebPlot.java
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,22 @@ public void setWebFilled(boolean flag) {
fireChangeEvent();
}

/**
* Returns the alpha value for filling a graph (in the range 0.0 to 1.0).
*
* @return The alpha value for filling a spider plot polygon.
*
* @see #setWebFillAlpha(float)
*/
public float getWebFillAlpha() {
return webFillAlpha;
}

/**
* Method to set the alpha value for the fill of a plot polygon.
* Sets the alpha value for the fill of a plot polygon and sends a {@link PlotChangeEvent} to all
* registered listeners.
*
* @param alpha the new alpha value. If it is outsite [0,1] it will be corrected to fit the range.
* @param alpha the new alpha value. If it is outside [0,1] it will be corrected to fit the range.
* @see #getWebFillAlpha()
*/
public void setWebFillAlpha(float alpha) {
Expand All @@ -380,17 +391,6 @@ public void setWebFillAlpha(float alpha) {
fireChangeEvent();
}

/**
* Method to return the alpha value for filling a graph.
*
* @return The alpha value for filling a spider plot polygon.
*
* @see #setWebFillAlpha(float)
*/
public float getWebFillAlpha() {
return webFillAlpha;
}

/**
* Returns the data extract order (by row or by column).
*
Expand Down Expand Up @@ -1497,6 +1497,9 @@ public boolean equals(Object obj) {
if (this.webFilled != that.webFilled) {
return false;
}
if (this.webFillAlpha != that.webFillAlpha) {
return false;
}
if (this.axisLabelGap != that.axisLabelGap) {
return false;
}
Expand Down
5 changes: 5 additions & 0 deletions src/test/java/org/jfree/chart/plot/SpiderWebPlotTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ public void testEquals() {
p2.setWebFilled(false);
assertEquals(p1, p2);

p1.setWebFillAlpha(0.5f);
assertNotEquals(p1, p2);
p2.setWebFillAlpha(0.5f);
assertEquals(p1, p2);

// axisLabelGap
p1.setAxisLabelGap(0.11);
assertNotEquals(p1, p2);
Expand Down

0 comments on commit f7e307e

Please sign in to comment.