Skip to content

Commit 07b2bd8

Browse files
astappievAB-xdev
authored andcommitted
feat: add Zoom Plugin options
Co-Authored-By: Oleh Astappiev <[email protected]>
1 parent 013e781 commit 07b2bd8

File tree

9 files changed

+560
-1
lines changed

9 files changed

+560
-1
lines changed

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

+22-1
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
*/
1616
package software.xdev.chartjs.model.options;
1717

18+
import software.xdev.chartjs.model.options.plugins.zoom.Zoom;
19+
1820
public class Plugins
1921
{
2022
protected Title title;
2123
protected Legend legend;
2224
protected Tooltip tooltip;
23-
25+
protected Zoom zoom;
26+
2427
/**
2528
* @see #setTitle(Title)
2629
*/
@@ -80,4 +83,22 @@ public Plugins setTooltip(final Tooltip tooltip)
8083
this.tooltip = tooltip;
8184
return this;
8285
}
86+
87+
/**
88+
* @see #setZoom(Zoom)
89+
*/
90+
public Zoom getZoom()
91+
{
92+
return this.zoom;
93+
}
94+
95+
/**
96+
* A zoom and pan plugin for Chart.js. Panning can be done via the mouse or with a finger. Zooming is done via the
97+
* mouse wheel or via a pinch gesture.
98+
*/
99+
public Plugins setZoom(final Zoom zoom)
100+
{
101+
this.zoom = zoom;
102+
return this;
103+
}
83104
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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.plugins.zoom;
17+
18+
import software.xdev.chartjs.model.color.Color;
19+
20+
21+
public class DragOptions
22+
{
23+
protected Boolean enabled;
24+
protected Color backgroundColor;
25+
protected Color borderColor;
26+
protected Integer borderWidth;
27+
protected String drawTime;
28+
protected Integer threshold;
29+
protected String modifierKey;
30+
31+
public Boolean getEnabled()
32+
{
33+
return enabled;
34+
}
35+
36+
public DragOptions setEnabled(final Boolean enabled)
37+
{
38+
this.enabled = enabled;
39+
return this;
40+
}
41+
42+
public Color getBackgroundColor()
43+
{
44+
return backgroundColor;
45+
}
46+
47+
public DragOptions setBackgroundColor(final Color backgroundColor)
48+
{
49+
this.backgroundColor = backgroundColor;
50+
return this;
51+
}
52+
53+
public Color getBorderColor()
54+
{
55+
return borderColor;
56+
}
57+
58+
public DragOptions setBorderColor(final Color borderColor)
59+
{
60+
this.borderColor = borderColor;
61+
return this;
62+
}
63+
64+
public Integer getBorderWidth()
65+
{
66+
return borderWidth;
67+
}
68+
69+
public DragOptions setBorderWidth(final Integer borderWidth)
70+
{
71+
this.borderWidth = borderWidth;
72+
return this;
73+
}
74+
75+
public String getDrawTime()
76+
{
77+
return drawTime;
78+
}
79+
80+
public DragOptions setDrawTime(final String drawTime)
81+
{
82+
this.drawTime = drawTime;
83+
return this;
84+
}
85+
86+
public Integer getThreshold()
87+
{
88+
return threshold;
89+
}
90+
91+
public DragOptions setThreshold(final Integer threshold)
92+
{
93+
this.threshold = threshold;
94+
return this;
95+
}
96+
97+
public String getModifierKey()
98+
{
99+
return modifierKey;
100+
}
101+
102+
public DragOptions setModifierKey(final String modifierKey)
103+
{
104+
this.modifierKey = modifierKey;
105+
return this;
106+
}
107+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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.plugins.zoom;
17+
18+
public class LimitOptions
19+
{
20+
protected ScaleLimits x;
21+
protected ScaleLimits y;
22+
23+
public ScaleLimits getX()
24+
{
25+
return x;
26+
}
27+
28+
public LimitOptions setX(final ScaleLimits x)
29+
{
30+
this.x = x;
31+
return this;
32+
}
33+
34+
public ScaleLimits getY()
35+
{
36+
return y;
37+
}
38+
39+
public LimitOptions setY(final ScaleLimits y)
40+
{
41+
this.y = y;
42+
return this;
43+
}
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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.plugins.zoom;
17+
18+
public class PanOptions
19+
{
20+
protected Boolean enabled;
21+
protected String mode;
22+
protected String modifierKey;
23+
protected String scaleMode;
24+
protected String overScaleMode;
25+
protected Integer threshold;
26+
27+
public Boolean getEnabled()
28+
{
29+
return enabled;
30+
}
31+
32+
public PanOptions setEnabled(final Boolean enabled)
33+
{
34+
this.enabled = enabled;
35+
return this;
36+
}
37+
38+
public String getMode()
39+
{
40+
return mode;
41+
}
42+
43+
public PanOptions setMode(final String mode)
44+
{
45+
this.mode = mode;
46+
return this;
47+
}
48+
49+
public String getModifierKey()
50+
{
51+
return modifierKey;
52+
}
53+
54+
public PanOptions setModifierKey(final String modifierKey)
55+
{
56+
this.modifierKey = modifierKey;
57+
return this;
58+
}
59+
60+
public String getScaleMode()
61+
{
62+
return scaleMode;
63+
}
64+
65+
public PanOptions setScaleMode(final String scaleMode)
66+
{
67+
this.scaleMode = scaleMode;
68+
return this;
69+
}
70+
71+
public String getOverScaleMode()
72+
{
73+
return overScaleMode;
74+
}
75+
76+
public PanOptions setOverScaleMode(final String overScaleMode)
77+
{
78+
this.overScaleMode = overScaleMode;
79+
return this;
80+
}
81+
82+
public Integer getThreshold()
83+
{
84+
return threshold;
85+
}
86+
87+
public PanOptions setThreshold(final Integer threshold)
88+
{
89+
this.threshold = threshold;
90+
return this;
91+
}
92+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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.plugins.zoom;
17+
18+
public class PinchOptions
19+
{
20+
protected Boolean enabled;
21+
22+
public Boolean getEnabled()
23+
{
24+
return enabled;
25+
}
26+
27+
public PinchOptions setEnabled(final Boolean enabled)
28+
{
29+
this.enabled = enabled;
30+
return this;
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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.plugins.zoom;
17+
18+
import java.math.BigDecimal;
19+
20+
21+
public class ScaleLimits
22+
{
23+
protected Object min;
24+
protected Object max;
25+
protected BigDecimal minRange;
26+
27+
public Object getMin()
28+
{
29+
return min;
30+
}
31+
32+
public ScaleLimits setMin(final Object min)
33+
{
34+
this.min = min;
35+
return this;
36+
}
37+
38+
public Object getMax()
39+
{
40+
return max;
41+
}
42+
43+
public ScaleLimits setMax(final Object max)
44+
{
45+
this.max = max;
46+
return this;
47+
}
48+
49+
public BigDecimal getMinRange()
50+
{
51+
return minRange;
52+
}
53+
54+
public ScaleLimits setMinRange(final BigDecimal minRange)
55+
{
56+
this.minRange = minRange;
57+
return this;
58+
}
59+
}

0 commit comments

Comments
 (0)