@@ -26,9 +26,18 @@ public class Legend
26
26
{
27
27
protected Boolean display ;
28
28
protected Position position ;
29
- protected Boolean fullWidth ;
29
+ protected String align ;
30
+ protected Integer maxHeight ;
31
+ protected Integer maxWidth ;
32
+ protected Boolean fullSize ;
30
33
protected JavaScriptFunction onClick ;
34
+ protected JavaScriptFunction onHover ;
35
+ protected JavaScriptFunction onLeave ;
36
+ protected Boolean reverse ;
31
37
protected LegendLabels labels ;
38
+ protected Boolean rtl ;
39
+ protected String textDirection ;
40
+ protected LegendTitle title ;
32
41
33
42
/**
34
43
* @see #setDisplay(Boolean)
@@ -69,21 +78,74 @@ public Legend setPosition(final Legend.Position position)
69
78
}
70
79
71
80
/**
72
- * @see #setFullWidth(Boolean )
81
+ * @see #setAlign(String )
73
82
*/
74
- public Boolean getFullWidth ()
83
+ public String getAlign ()
75
84
{
76
- return this .fullWidth ;
85
+ return this .align ;
86
+ }
87
+
88
+ /**
89
+ * Default 'center'.
90
+ * <p>
91
+ * Alignment of the legend
92
+ */
93
+ public Legend setAlign (final String align )
94
+ {
95
+ this .align = align ;
96
+ return this ;
97
+ }
98
+
99
+ /**
100
+ * @see #setMaxHeight(Integer)
101
+ */
102
+ public Integer getMaxHeight ()
103
+ {
104
+ return this .maxHeight ;
105
+ }
106
+
107
+ /**
108
+ * Maximum height of the legend, in pixels
109
+ */
110
+ public Legend setMaxHeight (final Integer maxHeight )
111
+ {
112
+ this .maxHeight = maxHeight ;
113
+ return this ;
114
+ }
115
+
116
+ /**
117
+ * @see #setMaxWidth(Integer)
118
+ */
119
+ public Integer getMaxWidth ()
120
+ {
121
+ return this .maxWidth ;
122
+ }
123
+
124
+ /**
125
+ * Maximum width of the legend, in pixels
126
+ */
127
+ public Legend setMaxWidth (final Integer maxWidth )
128
+ {
129
+ this .maxWidth = maxWidth ;
130
+ return this ;
131
+ }
132
+
133
+ /**
134
+ * @see #setFullSize(Boolean)
135
+ */
136
+ public Boolean getFullSize ()
137
+ {
138
+ return this .fullSize ;
77
139
}
78
140
79
141
/**
80
142
* Default {@code true}
81
143
* <p>
82
144
* Marks that this box should take the full width of the canvas (pushing down other boxes)
83
145
*/
84
- public Legend setFullWidth (final Boolean fullWidth )
146
+ public Legend setFullSize (final Boolean fullSize )
85
147
{
86
- this .fullWidth = fullWidth ;
148
+ this .fullSize = fullSize ;
87
149
return this ;
88
150
}
89
151
@@ -96,8 +158,6 @@ public JavaScriptFunction getOnClick()
96
158
}
97
159
98
160
/**
99
- * Default {@code function(event, legendItem) {}}
100
- * <p>
101
161
* A callback that is called when a click is registered on top of a label item
102
162
*/
103
163
public Legend setOnClick (final JavaScriptFunction onClick )
@@ -106,6 +166,59 @@ public Legend setOnClick(final JavaScriptFunction onClick)
106
166
return this ;
107
167
}
108
168
169
+ /**
170
+ * @see #setOnHover(JavaScriptFunction)
171
+ */
172
+ public JavaScriptFunction getOnHover ()
173
+ {
174
+ return this .onHover ;
175
+ }
176
+
177
+ /**
178
+ * A callback that is called when a 'mousemove' event is registered on top of a label item
179
+ */
180
+ public Legend setOnHover (final JavaScriptFunction onHover )
181
+ {
182
+ this .onHover = onHover ;
183
+ return this ;
184
+ }
185
+
186
+ /**
187
+ * @see #setOnLeave(JavaScriptFunction)
188
+ */
189
+ public JavaScriptFunction getOnLeave ()
190
+ {
191
+ return this .onLeave ;
192
+ }
193
+
194
+ /**
195
+ * A callback that is called when a 'mousemove' event is registered outside of a previously hovered label item
196
+ */
197
+ public Legend setOnLeave (final JavaScriptFunction onLeave )
198
+ {
199
+ this .onLeave = onLeave ;
200
+ return this ;
201
+ }
202
+
203
+ /**
204
+ * @see #setReverse(Boolean)
205
+ */
206
+ public Boolean getReverse ()
207
+ {
208
+ return this .reverse ;
209
+ }
210
+
211
+ /**
212
+ * Default <code>false</code>
213
+ * <p>
214
+ * Legend will show datasets in reverse order
215
+ */
216
+ public Legend setReverse (final Boolean reverse )
217
+ {
218
+ this .reverse = reverse ;
219
+ return this ;
220
+ }
221
+
109
222
/**
110
223
* @see #setLabels(LegendLabels)
111
224
*/
@@ -125,6 +238,58 @@ public Legend setLabels(final LegendLabels labels)
125
238
return this ;
126
239
}
127
240
241
+ /**
242
+ * @see #setRtl(Boolean)
243
+ */
244
+ public Boolean getRtl ()
245
+ {
246
+ return this .rtl ;
247
+ }
248
+
249
+ /**
250
+ * <code>true</code> for rendering the legends from right to left
251
+ */
252
+ public Legend setRtl (final Boolean rtl )
253
+ {
254
+ this .rtl = rtl ;
255
+ return this ;
256
+ }
257
+
258
+ /**
259
+ * @see #setTextDirection(String)
260
+ */
261
+ public String getTextDirection ()
262
+ {
263
+ return this .textDirection ;
264
+ }
265
+
266
+ /**
267
+ * This will force the text direction 'rtl' or 'ltr' on the canvas for rendering the legend, regardless of the css
268
+ * specified on the canvas
269
+ */
270
+ public Legend setTextDirection (final String textDirection )
271
+ {
272
+ this .textDirection = textDirection ;
273
+ return this ;
274
+ }
275
+
276
+ /**
277
+ * @see #setTitle(LegendTitle)
278
+ */
279
+ public LegendTitle getTitle ()
280
+ {
281
+ return this .title ;
282
+ }
283
+
284
+ /**
285
+ * @see LegendTitle
286
+ */
287
+ public Legend setTitle (final LegendTitle title )
288
+ {
289
+ this .title = title ;
290
+ return this ;
291
+ }
292
+
128
293
public enum Position
129
294
{
130
295
TOP ,
0 commit comments