Skip to content

Commit aed0478

Browse files
authored
Merge pull request #441 from xdev-software/fix-line-options
Synced `LineOptions` from ChartJS source code
2 parents 0826410 + 277b67a commit aed0478

File tree

9 files changed

+104
-62
lines changed

9 files changed

+104
-62
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 2.9.0
2+
* Synced `LineOptions` from ChartJS source code #439
3+
* Updated dependencies
4+
15
# 2.8.1
26
* Migrated deployment to _Sonatype Maven Central Portal_ [#155](https://github.com/xdev-software/standard-maven-template/issues/155)
37

chartjs-java-model-demo/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
<parent>
88
<groupId>software.xdev</groupId>
99
<artifactId>chartjs-java-model-root</artifactId>
10-
<version>2.8.2-SNAPSHOT</version>
10+
<version>2.9.0-SNAPSHOT</version>
1111
</parent>
1212

1313
<artifactId>chartjs-java-model-demo</artifactId>
14-
<version>2.8.2-SNAPSHOT</version>
14+
<version>2.9.0-SNAPSHOT</version>
1515
<packaging>jar</packaging>
1616

1717
<organization>

chartjs-java-model/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>software.xdev</groupId>
88
<artifactId>chartjs-java-model</artifactId>
9-
<version>2.8.2-SNAPSHOT</version>
9+
<version>2.9.0-SNAPSHOT</version>
1010
<packaging>jar</packaging>
1111

1212
<name>chartjs-java-model</name>

chartjs-java-model/src/main/java/software/xdev/chartjs/model/dataset/PointDataset.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@
2121
import software.xdev.chartjs.model.enums.BorderCapStyle;
2222
import software.xdev.chartjs.model.enums.BorderJoinStyle;
2323
import software.xdev.chartjs.model.objects.OptionalArray;
24-
import software.xdev.chartjs.model.options.elements.Fill;
2524

2625

2726
public abstract class PointDataset<T extends Dataset<T, O>, O> extends Dataset<T, O>
2827
{
29-
private Fill<?> fill;
28+
private Object fill;
3029

3130
private Float lineTension;
3231

@@ -64,18 +63,12 @@ public abstract class PointDataset<T extends Dataset<T, O>, O> extends Dataset<T
6463

6564
private final List<Object> pointStyle = new OptionalArray<>();
6665

67-
/**
68-
* @see #setFill(Fill)
69-
*/
70-
public Fill getFill()
66+
public Object getFill()
7167
{
7268
return this.fill;
7369
}
7470

75-
/**
76-
* If true, fill the area under the line
77-
*/
78-
public T setFill(final Fill<?> fill)
71+
public T setFill(final Object fill)
7972
{
8073
this.fill = fill;
8174
return this.self();

chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/LineOptions.java

Lines changed: 87 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,85 @@
2424
*/
2525
public class LineOptions extends Options<LineOptions, DefaultAnimation>
2626
{
27+
protected Object borderCapStyle;
28+
protected Number[] borderDash;
29+
protected Number borderDashOffset;
30+
protected Object borderJoinStyle;
31+
protected Boolean capBezierPoints;
32+
protected String cubicInterpolationMode;
2733
protected Number tension;
2834
protected Object stepped;
29-
30-
/**
31-
* @see #setShowLine(Boolean)
32-
*/
3335
protected Boolean showLine;
34-
/**
35-
* @see #setSpanGaps(Boolean)
36-
*/
37-
protected Boolean spanGaps;
36+
protected Object fill;
37+
protected Object spanGaps;
3838
protected LineElements elements;
3939

40+
public Object getBorderCapStyle()
41+
{
42+
return this.borderCapStyle;
43+
}
44+
45+
public LineOptions setBorderCapStyle(final Object borderCapStyle)
46+
{
47+
this.borderCapStyle = borderCapStyle;
48+
return this;
49+
}
50+
51+
public Number[] getBorderDash()
52+
{
53+
return this.borderDash;
54+
}
55+
56+
public LineOptions setBorderDash(final Number[] borderDash)
57+
{
58+
this.borderDash = borderDash;
59+
return this;
60+
}
61+
62+
public Number getBorderDashOffset()
63+
{
64+
return this.borderDashOffset;
65+
}
66+
67+
public LineOptions setBorderDashOffset(final Number borderDashOffset)
68+
{
69+
this.borderDashOffset = borderDashOffset;
70+
return this;
71+
}
72+
73+
public Object getBorderJoinStyle()
74+
{
75+
return this.borderJoinStyle;
76+
}
77+
78+
public LineOptions setBorderJoinStyle(final Object borderJoinStyle)
79+
{
80+
this.borderJoinStyle = borderJoinStyle;
81+
return this;
82+
}
83+
84+
public Boolean getCapBezierPoints()
85+
{
86+
return this.capBezierPoints;
87+
}
88+
89+
public LineOptions setCapBezierPoints(final Boolean capBezierPoints)
90+
{
91+
this.capBezierPoints = capBezierPoints;
92+
return this;
93+
}
94+
95+
public String getCubicInterpolationMode()
96+
{
97+
return this.cubicInterpolationMode;
98+
}
99+
100+
public LineOptions setCubicInterpolationMode(final String cubicInterpolationMode)
101+
{
102+
this.cubicInterpolationMode = cubicInterpolationMode;
103+
return this;
104+
}
105+
40106
public Number getTension()
41107
{
42108
return this.tension;
@@ -59,64 +125,44 @@ public LineOptions setStepped(final Object stepped)
59125
return this;
60126
}
61127

62-
/**
63-
* @see #setShowLine(Boolean)
64-
*/
65128
public Boolean getShowLine()
66129
{
67130
return this.showLine;
68131
}
69132

70-
/**
71-
* <p>
72-
* If false, the lines between points are not drawn
73-
* </p>
74-
*
75-
* <p>
76-
* Default {@code true}
77-
* </p>
78-
*/
79133
public LineOptions setShowLine(final Boolean showLine)
80134
{
81135
this.showLine = showLine;
82136
return this;
83137
}
84138

85-
/**
86-
* @see #setSpanGaps(Boolean)
87-
*/
88-
public Boolean getSpanGaps()
139+
public Object getFill()
140+
{
141+
return this.fill;
142+
}
143+
144+
public LineOptions setFill(final Object fill)
145+
{
146+
this.fill = fill;
147+
return this;
148+
}
149+
150+
public Object getSpanGaps()
89151
{
90152
return this.spanGaps;
91153
}
92154

93-
/**
94-
* <p>
95-
* If true, NaN data does not break the line
96-
* </p>
97-
*
98-
* <p>
99-
* Default {@code false}
100-
* </p>
101-
*/
102-
public LineOptions setSpanGaps(final Boolean spanGaps)
155+
public LineOptions setSpanGaps(final Object spanGaps)
103156
{
104157
this.spanGaps = spanGaps;
105158
return this;
106159
}
107160

108-
/**
109-
* @return {@link LineElements} instance, or {@code null} if not set
110-
*/
111161
public LineElements getElements()
112162
{
113163
return this.elements;
114164
}
115165

116-
/**
117-
* @param elements an {@link LineElements} instance, or {@code null}
118-
* @return this instance for method chaining
119-
*/
120166
public LineOptions setElements(final LineElements elements)
121167
{
122168
this.elements = elements;

chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/elements/Fill.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
* <p>
2525
* Option on the dataset object which can be used to create area between two datasets or a dataset and a boundary.
2626
* </p>
27+
* @deprecated Use corresponding data type like <code>Boolean</code> or <code>String</code> directly.
28+
* All internal usages have been replaced by <code>Object</code>.
2729
*/
30+
@Deprecated
2831
public class Fill<T>
2932
{
3033
@SuppressWarnings("java:S1700") // Used inside JSON model

chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/elements/Line.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class Line
4141
protected Float borderDashOffset;
4242
protected BorderJoinStyle borderJoinStyle;
4343
protected Boolean capBezierPoints;
44-
protected Fill<?> fill;
44+
protected Object fill;
4545
protected Boolean stepped;
4646

4747
/**
@@ -277,10 +277,7 @@ public Line setCapBezierPoints(final Boolean capBezierPoints)
277277
return this;
278278
}
279279

280-
/**
281-
* @see #setFill(Fill)
282-
*/
283-
public Fill getFill()
280+
public Object getFill()
284281
{
285282
return this.fill;
286283
}
@@ -294,7 +291,7 @@ public Fill getFill()
294291
* Default {@code true}
295292
* </p>
296293
*/
297-
public Line setFill(final Fill<?> fill)
294+
public Line setFill(final Object fill)
298295
{
299296
this.fill = fill;
300297
return this;

chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/elements/LineElements.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
*/
2121
public class LineElements
2222
{
23-
2423
protected Line line;
2524
protected Point point;
2625

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>software.xdev</groupId>
88
<artifactId>chartjs-java-model-root</artifactId>
9-
<version>2.8.2-SNAPSHOT</version>
9+
<version>2.9.0-SNAPSHOT</version>
1010
<packaging>pom</packaging>
1111

1212
<organization>

0 commit comments

Comments
 (0)