Skip to content

Commit 9c9f41f

Browse files
committed
Use CoreInteractionOptions for Options#interaction and Options#hover
Fix #281
1 parent 3c796fb commit 9c9f41f

File tree

4 files changed

+88
-83
lines changed

4 files changed

+88
-83
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## 2.4.0
22
* PointStyle can also contain non-string constants #280
3+
* Use ``CoreInteractionOptions`` for ``Options#interaction`` and ``Options#hover`` #281
4+
* Updated dependencies
35

46
## 2.3.1
57
* Synced ``LineOptions/DataSet`` ``stepped`` and ``tension`` with ChartJS source #262
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* Copyright © 2023 XDEV Software (https://xdev.software)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package software.xdev.chartjs.model.options;
17+
18+
/**
19+
* @see <a href="https://github.com/chartjs/Chart.js/blob/v4.4.6/src/types/index.d.ts#L1564">ChartJS Source</a>
20+
*/
21+
public class CoreInteractionOptions
22+
{
23+
protected String mode;
24+
protected Boolean intersect;
25+
protected String axis;
26+
protected Boolean includeInvisible;
27+
28+
public String getMode()
29+
{
30+
return this.mode;
31+
}
32+
33+
public CoreInteractionOptions setMode(final String mode)
34+
{
35+
this.mode = mode;
36+
return this;
37+
}
38+
39+
public Boolean getIntersect()
40+
{
41+
return this.intersect;
42+
}
43+
44+
public CoreInteractionOptions setIntersect(final Boolean intersect)
45+
{
46+
this.intersect = intersect;
47+
return this;
48+
}
49+
50+
public String getAxis()
51+
{
52+
return this.axis;
53+
}
54+
55+
public CoreInteractionOptions setAxis(final String axis)
56+
{
57+
this.axis = axis;
58+
return this;
59+
}
60+
61+
public Boolean getIncludeInvisible()
62+
{
63+
return this.includeInvisible;
64+
}
65+
66+
public CoreInteractionOptions setIncludeInvisible(final Boolean includeInvisible)
67+
{
68+
this.includeInvisible = includeInvisible;
69+
return this;
70+
}
71+
}

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

Lines changed: 0 additions & 77 deletions
This file was deleted.

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

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ public class Options<T extends Options<T, A>, A extends Animation<A>>
4040
protected JavaScriptFunction onClick;
4141
protected JavaScriptFunction legendCallback;
4242
protected JavaScriptFunction onResize;
43-
protected Hover hover;
43+
protected CoreInteractionOptions interaction;
44+
protected CoreInteractionOptions hover;
4445
protected Animations<A> animations;
4546
protected Boolean animation = true;
4647
protected Layout layout;
@@ -215,10 +216,18 @@ public T setOnResize(final JavaScriptFunction onResize)
215216
return this.self();
216217
}
217218

218-
/**
219-
* @see #setHover(Hover)
220-
*/
221-
public Hover getHover()
219+
public CoreInteractionOptions getInteraction()
220+
{
221+
return this.interaction;
222+
}
223+
224+
public T setInteraction(final CoreInteractionOptions interaction)
225+
{
226+
this.interaction = interaction;
227+
return this.self();
228+
}
229+
230+
public CoreInteractionOptions getHover()
222231
{
223232
return this.hover;
224233
}
@@ -227,7 +236,7 @@ public Hover getHover()
227236
* The hover configuration is passed into the options.hover namespace. The global hover configuration is at
228237
* Chart.defaults.global.hover.
229238
*/
230-
public T setHover(final Hover hover)
239+
public T setHover(final CoreInteractionOptions hover)
231240
{
232241
this.hover = hover;
233242
return this.self();

0 commit comments

Comments
 (0)