Skip to content

Commit

Permalink
StockChart misses some attributes jmix-framework#1512
Browse files Browse the repository at this point in the history
  • Loading branch information
KremnevDmitry authored Mar 24, 2023
1 parent 1b83173 commit 907acbd
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1691,6 +1691,16 @@ protected void loadStockPanel(StockPanel chart, Element element) {
if (StringUtils.isNotEmpty(trendLineThickness)) {
chart.setTrendLineThickness(Integer.valueOf(trendLineThickness));
}

String bezierX = element.attributeValue("bezierX");
if (StringUtils.isNotEmpty(bezierX)) {
chart.setBezierX(Integer.valueOf(bezierX));
}

String bezierY = element.attributeValue("bezierY");
if (StringUtils.isNotEmpty(bezierY)) {
chart.setBezierY(Integer.valueOf(bezierY));
}
}

protected void loadStockLegend(StockPanel chart, Element element) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public class StockPanel extends AbstractSerialChart<StockPanel> implements Serie

private Integer trendLineThickness;

private Integer bezierX;

private Integer bezierY;

public StockPanel() {
super(null);
this.id = UUID.randomUUID().toString();
Expand Down Expand Up @@ -449,6 +453,48 @@ public StockPanel setTrendLineThickness(Integer trendLineThickness) {
return this;
}

/**
* @return horizontal tension of bezier
*/
public Integer getBezierX() {
return bezierX;
}

/**
* Sets horizontal tension of bezier (used by smoothed line). If not set, chart adjust tension by itself,
* taking into account if chart is rotated or not. Allowed values 1 - Infinity.
*
* @param bezierX horizontal tension
* @return stock panel
*/
@StudioProperty
@Min(1)
public StockPanel setBezierX(Integer bezierX) {
this.bezierX = bezierX;
return this;
}

/**
* @return vertical tension of bezier
*/
public Integer getBezierY() {
return bezierY;
}

/**
* Sets vertical tension of bezier (used by smoothed line). If not set, chart adjust tension by itself,
* taking into account if chart is rotated or not. Allowed values 1 - Infinity.
*
* @param bezierY vertical tension
* @return stock panel
*/
@StudioProperty
@Min(1)
public StockPanel setBezierY(Integer bezierY) {
this.bezierY = bezierY;
return this;
}

@Override
public List<String> getWiredFields() {
List<String> wiredFields = new ArrayList<>(super.getWiredFields());
Expand Down
2 changes: 2 additions & 0 deletions jmix-ui/charts/src/main/resources/io/jmix/charts/charts.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -2268,6 +2268,8 @@
<xs:attribute name="trendLineColor" type="color"/>
<xs:attribute name="trendLineDashLength" type="xs:integer"/>
<xs:attribute name="trendLineThickness" type="xs:integer"/>
<xs:attribute name="bezierX" type="xs:integer"/>
<xs:attribute name="bezierY" type="xs:integer"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
Expand Down

0 comments on commit 907acbd

Please sign in to comment.