Skip to content

Commit 5fe1975

Browse files
authored
feat: add borderRadius prop to Background and PlotOptionsSolidGauge (#8223)
Add new property for `Background` and `PlotOptionsSolidGauge` to enable setting `borderRadius`. The property was introduced in Highcharts V11. Also, adjust the `SolidGauge` example to use the new property and make it look better by increasing the pane size to better use the available space of the chart area.
1 parent a2c8180 commit 5fe1975

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

vaadin-charts-flow-parent/vaadin-charts-flow-integration-tests/src/main/java/com/vaadin/flow/component/charts/examples/other/SolidGauge.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,16 @@ public void initDemo() {
3333
Configuration configuration = chart.getConfiguration();
3434

3535
Pane pane = configuration.getPane();
36-
pane.setCenter(new String[] { "50%", "50%" });
36+
pane.setCenter(new String[] { "50%", "85%" });
37+
pane.setSize("140%");
3738
pane.setStartAngle(-90);
3839
pane.setEndAngle(90);
3940

4041
Background paneBackground = new Background();
4142
paneBackground.setInnerRadius("60%");
4243
paneBackground.setOuterRadius("100%");
4344
paneBackground.setShape(BackgroundShape.ARC);
45+
paneBackground.setBorderRadius("5");
4446
pane.setBackground(paneBackground);
4547

4648
YAxis yAxis = configuration.getyAxis();
@@ -53,6 +55,7 @@ public void initDemo() {
5355
yAxis.setMax(200);
5456

5557
PlotOptionsSolidgauge plotOptionsSolidgauge = new PlotOptionsSolidgauge();
58+
plotOptionsSolidgauge.setBorderRadius("5");
5659

5760
DataLabels dataLabels = plotOptionsSolidgauge.getDataLabels();
5861
dataLabels.setY(5);

vaadin-charts-flow-parent/vaadin-charts-flow/src/main/java/com/vaadin/flow/component/charts/model/Background.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
public class Background extends AbstractConfigurationObject {
2222
private Color backgroundColor;
2323
private Color borderColor;
24+
private String borderRadius;
2425
private Number borderWidth;
2526
private String className;
2627
private String outerRadius;
@@ -59,6 +60,27 @@ public void setBorderColor(Color borderColor) {
5960
this.borderColor = borderColor;
6061
}
6162

63+
/**
64+
* Returns the border radius of the background.
65+
*
66+
* @see #setBorderRadius(String)
67+
* @return The border radius of the background.
68+
*/
69+
public String getBorderRadius() {
70+
return borderRadius;
71+
}
72+
73+
/**
74+
* The border radius of the pane background when the shape is
75+
* {@link BackgroundShape#ARC}. Can be a number (pixels) or a percentage
76+
* string.
77+
*
78+
* @param borderRadius
79+
*/
80+
public void setBorderRadius(String borderRadius) {
81+
this.borderRadius = borderRadius;
82+
}
83+
6284
/**
6385
* @see #setBorderWidth(Number)
6486
*/

vaadin-charts-flow-parent/vaadin-charts-flow/src/main/java/com/vaadin/flow/component/charts/model/PlotOptionsSolidgauge.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class PlotOptionsSolidgauge extends GaugeOptions {
2222

2323
private Boolean animation;
2424
private Number animationLimit;
25+
private String borderRadius;
2526
private String className;
2627
private Boolean clip;
2728
private Boolean colorByPoint;
@@ -93,6 +94,24 @@ public void setAnimationLimit(Number animationLimit) {
9394
this.animationLimit = animationLimit;
9495
}
9596

97+
/**
98+
* @see #setBorderRadius(String)
99+
*/
100+
public String getBorderRadius() {
101+
return borderRadius;
102+
}
103+
104+
/**
105+
* The corner radius of the border surrounding solid gauge. A number
106+
* signifies pixels and percentage string, like for example 50%, signifies a
107+
* relative size.
108+
*
109+
* @param borderRadius
110+
*/
111+
public void setBorderRadius(String borderRadius) {
112+
this.borderRadius = borderRadius;
113+
}
114+
96115
/**
97116
* @see #setClassName(String)
98117
*/

0 commit comments

Comments
 (0)