Skip to content

Commit 2ade407

Browse files
committed
Provide default implementations for auto detection
1 parent 8d6e711 commit 2ade407

19 files changed

+992
-949
lines changed
Lines changed: 367 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,367 @@
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.scale;
17+
18+
import software.xdev.chartjs.model.javascript.JavaScriptFunction;
19+
20+
21+
/**
22+
* Common options to all axes
23+
* @see <a href="https://www.chartjs.org/docs/latest/axes/#common-options-to-all-axes">ChartJS Docs</a>
24+
* @see <a href="https://github.com/chartjs/Chart.js/blob/v4.4.3/src/types/index.d.ts#L1159">ChartJS source</a>
25+
*/
26+
public abstract class AbstractCoreScaleOptions<S extends AbstractCoreScaleOptions<S, T>,
27+
T extends AbstractTickOptions<?>>
28+
{
29+
protected String type;
30+
31+
protected Object display;
32+
protected Boolean alignToPixels;
33+
protected String backgroundColor;
34+
protected Boolean reverse;
35+
protected Boolean clip;
36+
protected Number weight;
37+
protected Object min;
38+
protected Object max;
39+
protected Object stacked;
40+
protected Object suggestedMax;
41+
protected Object suggestedMin;
42+
43+
protected T ticks;
44+
45+
protected JavaScriptFunction beforeUpdate;
46+
protected JavaScriptFunction beforeSetDimensions;
47+
protected JavaScriptFunction afterSetDimensions;
48+
protected JavaScriptFunction beforeDataLimits;
49+
protected JavaScriptFunction afterDataLimits;
50+
protected JavaScriptFunction beforeBuildTicks;
51+
protected JavaScriptFunction afterBuildTicks;
52+
protected JavaScriptFunction beforeTickToLabelConversion;
53+
protected JavaScriptFunction afterTickToLabelConversion;
54+
protected JavaScriptFunction beforeCalculateLabelRotation;
55+
protected JavaScriptFunction afterCalculateLabelRotation;
56+
protected JavaScriptFunction beforeFit;
57+
protected JavaScriptFunction afterFit;
58+
protected JavaScriptFunction afterUpdate;
59+
60+
protected AbstractCoreScaleOptions(final String type)
61+
{
62+
this.type = type;
63+
}
64+
65+
@SuppressWarnings("unchecked")
66+
protected S self()
67+
{
68+
return (S)this;
69+
}
70+
71+
public String getType()
72+
{
73+
return this.type;
74+
}
75+
76+
public S setType(final String type)
77+
{
78+
this.type = type;
79+
return this.self();
80+
}
81+
82+
public Object getDisplay()
83+
{
84+
return this.display;
85+
}
86+
87+
public S setDisplay(final Object display)
88+
{
89+
this.display = display;
90+
return this.self();
91+
}
92+
93+
public Boolean getAlignToPixels()
94+
{
95+
return this.alignToPixels;
96+
}
97+
98+
public S setAlignToPixels(final Boolean alignToPixels)
99+
{
100+
this.alignToPixels = alignToPixels;
101+
return this.self();
102+
}
103+
104+
public String getBackgroundColor()
105+
{
106+
return this.backgroundColor;
107+
}
108+
109+
public S setBackgroundColor(final String backgroundColor)
110+
{
111+
this.backgroundColor = backgroundColor;
112+
return this.self();
113+
}
114+
115+
public Boolean getReverse()
116+
{
117+
return this.reverse;
118+
}
119+
120+
public S setReverse(final Boolean reverse)
121+
{
122+
this.reverse = reverse;
123+
return this.self();
124+
}
125+
126+
public Boolean getClip()
127+
{
128+
return this.clip;
129+
}
130+
131+
public S setClip(final Boolean clip)
132+
{
133+
this.clip = clip;
134+
return this.self();
135+
}
136+
137+
public Number getWeight()
138+
{
139+
return this.weight;
140+
}
141+
142+
public S setWeight(final Number weight)
143+
{
144+
this.weight = weight;
145+
return this.self();
146+
}
147+
148+
public Object getMin()
149+
{
150+
return this.min;
151+
}
152+
153+
public S setMin(final Number min)
154+
{
155+
this.min = min;
156+
return this.self();
157+
}
158+
159+
public Object getMax()
160+
{
161+
return this.max;
162+
}
163+
164+
public S setMax(final Number max)
165+
{
166+
this.max = max;
167+
return this.self();
168+
}
169+
170+
public Object getStacked()
171+
{
172+
return this.stacked;
173+
}
174+
175+
public S setStacked(final Object stacked)
176+
{
177+
this.stacked = stacked;
178+
return this.self();
179+
}
180+
181+
public Object getSuggestedMax()
182+
{
183+
return this.suggestedMax;
184+
}
185+
186+
public S setSuggestedMax(final Number suggestedMax)
187+
{
188+
this.suggestedMax = suggestedMax;
189+
return this.self();
190+
}
191+
192+
public Object getSuggestedMin()
193+
{
194+
return this.suggestedMin;
195+
}
196+
197+
public S setSuggestedMin(final Number suggestedMin)
198+
{
199+
this.suggestedMin = suggestedMin;
200+
return this.self();
201+
}
202+
203+
public T getTicks()
204+
{
205+
return this.ticks;
206+
}
207+
208+
public S setTicks(final T ticks)
209+
{
210+
this.ticks = ticks;
211+
return this.self();
212+
}
213+
214+
public JavaScriptFunction getBeforeUpdate()
215+
{
216+
return this.beforeUpdate;
217+
}
218+
219+
public S setBeforeUpdate(final JavaScriptFunction beforeUpdate)
220+
{
221+
this.beforeUpdate = beforeUpdate;
222+
return this.self();
223+
}
224+
225+
public JavaScriptFunction getBeforeSetDimensions()
226+
{
227+
return this.beforeSetDimensions;
228+
}
229+
230+
public S setBeforeSetDimensions(final JavaScriptFunction beforeSetDimensions)
231+
{
232+
this.beforeSetDimensions = beforeSetDimensions;
233+
return this.self();
234+
}
235+
236+
public JavaScriptFunction getAfterSetDimensions()
237+
{
238+
return this.afterSetDimensions;
239+
}
240+
241+
public S setAfterSetDimensions(final JavaScriptFunction afterSetDimensions)
242+
{
243+
this.afterSetDimensions = afterSetDimensions;
244+
return this.self();
245+
}
246+
247+
public JavaScriptFunction getBeforeDataLimits()
248+
{
249+
return this.beforeDataLimits;
250+
}
251+
252+
public S setBeforeDataLimits(final JavaScriptFunction beforeDataLimits)
253+
{
254+
this.beforeDataLimits = beforeDataLimits;
255+
return this.self();
256+
}
257+
258+
public JavaScriptFunction getAfterDataLimits()
259+
{
260+
return this.afterDataLimits;
261+
}
262+
263+
public S setAfterDataLimits(final JavaScriptFunction afterDataLimits)
264+
{
265+
this.afterDataLimits = afterDataLimits;
266+
return this.self();
267+
}
268+
269+
public JavaScriptFunction getBeforeBuildTicks()
270+
{
271+
return this.beforeBuildTicks;
272+
}
273+
274+
public S setBeforeBuildTicks(final JavaScriptFunction beforeBuildTicks)
275+
{
276+
this.beforeBuildTicks = beforeBuildTicks;
277+
return this.self();
278+
}
279+
280+
public JavaScriptFunction getAfterBuildTicks()
281+
{
282+
return this.afterBuildTicks;
283+
}
284+
285+
public S setAfterBuildTicks(final JavaScriptFunction afterBuildTicks)
286+
{
287+
this.afterBuildTicks = afterBuildTicks;
288+
return this.self();
289+
}
290+
291+
public JavaScriptFunction getBeforeTickToLabelConversion()
292+
{
293+
return this.beforeTickToLabelConversion;
294+
}
295+
296+
public S setBeforeTickToLabelConversion(final JavaScriptFunction beforeTickToLabelConversion)
297+
{
298+
this.beforeTickToLabelConversion = beforeTickToLabelConversion;
299+
return this.self();
300+
}
301+
302+
public JavaScriptFunction getAfterTickToLabelConversion()
303+
{
304+
return this.afterTickToLabelConversion;
305+
}
306+
307+
public S setAfterTickToLabelConversion(final JavaScriptFunction afterTickToLabelConversion)
308+
{
309+
this.afterTickToLabelConversion = afterTickToLabelConversion;
310+
return this.self();
311+
}
312+
313+
public JavaScriptFunction getBeforeCalculateLabelRotation()
314+
{
315+
return this.beforeCalculateLabelRotation;
316+
}
317+
318+
public S setBeforeCalculateLabelRotation(final JavaScriptFunction beforeCalculateLabelRotation)
319+
{
320+
this.beforeCalculateLabelRotation = beforeCalculateLabelRotation;
321+
return this.self();
322+
}
323+
324+
public JavaScriptFunction getAfterCalculateLabelRotation()
325+
{
326+
return this.afterCalculateLabelRotation;
327+
}
328+
329+
public S setAfterCalculateLabelRotation(final JavaScriptFunction afterCalculateLabelRotation)
330+
{
331+
this.afterCalculateLabelRotation = afterCalculateLabelRotation;
332+
return this.self();
333+
}
334+
335+
public JavaScriptFunction getBeforeFit()
336+
{
337+
return this.beforeFit;
338+
}
339+
340+
public S setBeforeFit(final JavaScriptFunction beforeFit)
341+
{
342+
this.beforeFit = beforeFit;
343+
return this.self();
344+
}
345+
346+
public JavaScriptFunction getAfterFit()
347+
{
348+
return this.afterFit;
349+
}
350+
351+
public S setAfterFit(final JavaScriptFunction afterFit)
352+
{
353+
this.afterFit = afterFit;
354+
return this.self();
355+
}
356+
357+
public JavaScriptFunction getAfterUpdate()
358+
{
359+
return this.afterUpdate;
360+
}
361+
362+
public S setAfterUpdate(final JavaScriptFunction afterUpdate)
363+
{
364+
this.afterUpdate = afterUpdate;
365+
return this.self();
366+
}
367+
}

0 commit comments

Comments
 (0)