Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1.5.x #279

Merged
merged 2 commits into from
Jun 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 34 additions & 3 deletions src/main/java/org/jfree/chart/plot/SpiderWebPlot.java
Original file line number Diff line number Diff line change
@@ -220,6 +220,9 @@ public class SpiderWebPlot extends Plot implements Cloneable, Serializable {
/** controls if the web polygons are filled or not */
private boolean webFilled = true;

/** The alpha value of the fill portion of a polygon. */
private float webFillAlpha = 0.1F;

/** A tooltip generator for the plot ({@code null} permitted). */
private CategoryToolTipGenerator toolTipGenerator;

@@ -360,6 +363,34 @@ public void setWebFilled(boolean flag) {
fireChangeEvent();
}


/**
* Method to set the alpha value for the fill of a plot polygon.
*
* @param alpha the new alpha value. If it is outsite [0,1] it will be corrected to fit the range.
* @see #getWebFillAlpha()
*/
public void setWebFillAlpha(float alpha) {
this.webFillAlpha = alpha;
if (webFillAlpha < 0f) {
webFillAlpha = 0f;
} else if (webFillAlpha > 1f) {
webFillAlpha = 1f;
}
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).
*
@@ -616,8 +647,8 @@ public Paint getSeriesPaint() {
}

/**
* Sets the paint for ALL series in the plot. If this is set to
* {@code null}, then a list of paints is used instead (to allow different
* Sets the paint for ALL series in the plot. If this is set to
* {@code null}, then a list of paints is used instead (to allow different
* colors to be used for each series of the radar group).
*
* @param paint the paint ({@code null} permitted).
@@ -1311,7 +1342,7 @@ protected void drawRadarPoly(Graphics2D g2,

if (this.webFilled) {
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
0.1f));
webFillAlpha));
g2.fill(polygon);
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
getForegroundAlpha()));