makit/Chart.API.js

1       /* ----------------------------------------------------------------------------------
2        * Hint: This is a derived (generated) file. Changes should be done in the underlying 
3        * source files only (*.control, *.js) or they will be lost after the next generation.
4        * ---------------------------------------------------------------------------------- */
5       
6       // Provides control sap.apb.makit.Chart.
7       jQuery.sap.declare("sap.apb.makit.Chart");
8       jQuery.sap.require("sap.apb.makit.library");
9       jQuery.sap.require("sap.ui.core.Control");
10      
11      /**
12       * Constructor for a new Chart.
13       * 
14       * Accepts an object literal <code>mSettings</code> that defines initial 
15       * property values, aggregated and associated objects as well as event handlers. 
16       * 
17       * If the name of a setting is ambiguous (e.g. a property has the same name as an event), 
18       * then the framework assumes property, aggregation, association, event in that order. 
19       * To override this automatic resolution, one of the prefixes "aggregation:", "association:" 
20       * or "event:" can be added to the name of the setting (such a prefixed name must be
21       * enclosed in single or double quotes).
22       *
23       * The supported settings are:
24       * <ul>
25       * <li>Properties
26       * <ul>
27       * <li>{@link #getType type} : sap.apb.makit.ChartType (default: sap.apb.makit.ChartType.Column)</li>
28       * <li>{@link #getCategorySortOrder categorySortOrder} : sap.apb.makit.SortOrder (default: sap.apb.makit.SortOrder.None)</li>
29       * <li>{@link #getDataSource dataSource} : string</li>
30       * <li>height : sap.ui.core.CSSSize (default: '100%')</li>
31       * <li>{@link #getLegendPosition legendPosition} : sap.apb.makit.LegendPosition (default: sap.apb.makit.LegendPosition.None)</li>
32       * <li>{@link #getLineThickness lineThickness} : float (default: 1)</li>
33       * <li>{@link #getMaxSliceCount maxSliceCount} : int (default: 12)</li>
34       * <li>{@link #getMetadataFile metadataFile} : sap.ui.core.URI</li>
35       * <li>{@link #getShowRangeSelector showRangeSelector} : boolean (default: true)</li>
36       * <li>{@link #getShowTableView showTableView} : boolean (default: false)</li>
37       * <li>{@link #getShowTableValue showTableValue} : boolean (default: true)</li>
38       * <li>{@link #getShowToolbar showToolbar} : boolean (default: true)</li>
39       * <li>{@link #getWidth width} : sap.ui.core.CSSSize (default: '100%')</li></ul>
40       * </li>
41       * <li>Aggregations
42       * <ul></ul>
43       * </li>
44       * <li>Associations
45       * <ul></ul>
46       * </li>
47       * <li>Events
48       * <ul>
49       * <li>{@link sap.apb.makit.Chart#event:doubletap doubletap} : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]</li>
50       * <li>{@link sap.apb.makit.Chart#event:tap tap} : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]</li></ul>
51       * </li>
52       * </ul> 
53      
54       *
55       * @param {string} [sId] id for the new control, generated automatically if no id is given 
56       * @param {object} [mSettings] initial settings for the new control
57       *
58       * @class
59       * MAKit Chart
60       * @extends sap.ui.core.Control
61       *
62       * @author SAP AG 
63       * @version 1.0
64       *
65       * @constructor   
66       * @public
67       * @name sap.apb.makit.Chart
68       */
69      sap.ui.core.Control.extend("sap.apb.makit.Chart", { metadata : {
70      
71      	// ---- object ----
72      	publicMethods : [
73      		// methods
74      		"getSelectedCategory", "getSelectedSeries", "getNumberOfCategories", "getSelectedCategoryGroup", "refreshData"
75      	],
76      
77      	// ---- control specific ----
78      	library : "sap.apb.makit",
79      	properties : {
80      		"type" : {type : "sap.apb.makit.ChartType", group : "Appearance", defaultValue : sap.apb.makit.ChartType.Column},
81      		"categorySortOrder" : {type : "sap.apb.makit.SortOrder", group : "Misc", defaultValue : sap.apb.makit.SortOrder.None},
82      		"dataSource" : {type : "string", group : "", defaultValue : null},
83      		"height" : {type : "sap.ui.core.CSSSize", group : "Dimension", defaultValue : '100%'},
84      		"legendPosition" : {type : "sap.apb.makit.LegendPosition", group : "Appearance", defaultValue : sap.apb.makit.LegendPosition.None},
85      		"lineThickness" : {type : "float", group : "Appearance", defaultValue : 1},
86      		"maxSliceCount" : {type : "int", group : "Misc", defaultValue : 12},
87      		"metadataFile" : {type : "sap.ui.core.URI", group : "", defaultValue : null},
88      		"showRangeSelector" : {type : "boolean", group : "Appearance", defaultValue : true},
89      		"showTableView" : {type : "boolean", group : "Appearance", defaultValue : false},
90      		"showTableValue" : {type : "boolean", group : "Appearance", defaultValue : true},
91      		"showToolbar" : {type : "boolean", group : "Appearance", defaultValue : true},
92      		"width" : {type : "sap.ui.core.CSSSize", group : "Dimension", defaultValue : '100%'}
93      	},
94      	events : {
95      		"doubletap" : {}, 
96      		"tap" : {}
97      	}
98      }});
99      
100     
101     /**
102      * Creates a new subclass of class sap.apb.makit.Chart with name <code>sClassName</code> 
103      * and enriches it with the information contained in <code>oClassInfo</code>.
104      * 
105      * <code>oClassInfo</code> might contain the same kind of informations as described in {@link sap.ui.core.Element.extend Element.extend}.
106      *   
107      * @param {string} sClassName name of the class to be created
108      * @param {object} [oClassInfo] object literal with informations about the class  
109      * @param {function} [FNMetaImpl] constructor function for the metadata object. If not given, it defaults to sap.ui.core.ElementMetadata.
110      * @return {function} the created class / constructor function
111      * @public
112      * @static
113      * @name sap.apb.makit.Chart.extend
114      * @function
115      */
116     
117     sap.apb.makit.Chart.M_EVENTS = {'doubletap':'doubletap','tap':'tap'};
118     
119     
120     /**
121      * Getter for property <code>type</code>.
122      * Chart type.
123      *
124      * Default value is <code>Column</code>
125      *
126      * @return {sap.apb.makit.ChartType} the value of property <code>type</code>
127      * @public
128      * @name sap.apb.makit.Chart#getType
129      * @function
130      */
131     
132     /**
133      * Setter for property <code>type</code>.
134      *
135      * Default value is <code>Column</code> 
136      *
137      * @param {sap.apb.makit.ChartType} oType  new value for property <code>type</code>
138      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
139      * @public
140      * @name sap.apb.makit.Chart#setType
141      * @function
142      */
143     
144     
145     /**
146      * Getter for property <code>categorySortOrder</code>.
147      * Sort order for category. If None, the category's column is expected to be pre-sorted.
148      *
149      * Default value is <code>None</code>
150      *
151      * @return {sap.apb.makit.SortOrder} the value of property <code>categorySortOrder</code>
152      * @public
153      * @name sap.apb.makit.Chart#getCategorySortOrder
154      * @function
155      */
156     
157     /**
158      * Setter for property <code>categorySortOrder</code>.
159      *
160      * Default value is <code>None</code> 
161      *
162      * @param {sap.apb.makit.SortOrder} oCategorySortOrder  new value for property <code>categorySortOrder</code>
163      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
164      * @public
165      * @name sap.apb.makit.Chart#setCategorySortOrder
166      * @function
167      */
168     
169     
170     /**
171      * Getter for property <code>dataSource</code>.
172      * dataSource name of the chart.
173      *
174      * Default value is empty/<code>undefined</code>
175      *
176      * @return {string} the value of property <code>dataSource</code>
177      * @public
178      * @name sap.apb.makit.Chart#getDataSource
179      * @function
180      */
181     
182     /**
183      * Setter for property <code>dataSource</code>.
184      *
185      * Default value is empty/<code>undefined</code> 
186      *
187      * @param {string} sDataSource  new value for property <code>dataSource</code>
188      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
189      * @public
190      * @name sap.apb.makit.Chart#setDataSource
191      * @function
192      */
193     
194     
195     /**
196      * Getter for property <code>height</code>.
197      * The height of the Chart.
198      *
199      * Default value is <code>100%</code>
200      *
201      * @return {sap.ui.core.CSSSize} the value of property <code>height</code>
202      * @public
203      * @name sap.apb.makit.Chart#getHeight
204      * @function
205      */
206     
207     /**
208      * Setter for property <code>height</code>.
209      *
210      * Default value is <code>100%</code> 
211      *
212      * @param {sap.ui.core.CSSSize} sHeight  new value for property <code>height</code>
213      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
214      * @public
215      * @name sap.apb.makit.Chart#setHeight
216      * @function
217      */
218     
219     
220     /**
221      * Getter for property <code>legendPosition</code>.
222      * Legend position all chart types except Bar chart. Bar chart only support Bottom position.
223      *
224      * Default value is <code>None</code>
225      *
226      * @return {sap.apb.makit.LegendPosition} the value of property <code>legendPosition</code>
227      * @public
228      * @name sap.apb.makit.Chart#getLegendPosition
229      * @function
230      */
231     
232     /**
233      * Setter for property <code>legendPosition</code>.
234      *
235      * Default value is <code>None</code> 
236      *
237      * @param {sap.apb.makit.LegendPosition} oLegendPosition  new value for property <code>legendPosition</code>
238      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
239      * @public
240      * @name sap.apb.makit.Chart#setLegendPosition
241      * @function
242      */
243     
244     
245     /**
246      * Getter for property <code>lineThickness</code>.
247      * Specify the line thickness of the line graph. Only applies to Line chart type.
248      *
249      * Default value is <code>1</code>
250      *
251      * @return {float} the value of property <code>lineThickness</code>
252      * @public
253      * @name sap.apb.makit.Chart#getLineThickness
254      * @function
255      */
256     
257     /**
258      * Setter for property <code>lineThickness</code>.
259      *
260      * Default value is <code>1</code> 
261      *
262      * @param {float} fLineThickness  new value for property <code>lineThickness</code>
263      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
264      * @public
265      * @name sap.apb.makit.Chart#setLineThickness
266      * @function
267      */
268     
269     
270     /**
271      * Getter for property <code>maxSliceCount</code>.
272      * Set the maximum number of slices in a Pie/Donut chart. If exceeding the specified value, the rest will be categorised into a single slice. Only applies to Pie/Donut.
273      *
274      * Default value is <code>12</code>
275      *
276      * @return {int} the value of property <code>maxSliceCount</code>
277      * @public
278      * @name sap.apb.makit.Chart#getMaxSliceCount
279      * @function
280      */
281     
282     /**
283      * Setter for property <code>maxSliceCount</code>.
284      *
285      * Default value is <code>12</code> 
286      *
287      * @param {int} iMaxSliceCount  new value for property <code>maxSliceCount</code>
288      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
289      * @public
290      * @name sap.apb.makit.Chart#setMaxSliceCount
291      * @function
292      */
293     
294     
295     /**
296      * Getter for property <code>metadataFile</code>.
297      * Metadata file URI that is assigned to this chart. Metadata is mandatory for a chart to be rendered because it contains the chart's details.
298      *
299      * Default value is empty/<code>undefined</code>
300      *
301      * @return {sap.ui.core.URI} the value of property <code>metadataFile</code>
302      * @public
303      * @name sap.apb.makit.Chart#getMetadataFile
304      * @function
305      */
306     
307     /**
308      * Setter for property <code>metadataFile</code>.
309      *
310      * Default value is empty/<code>undefined</code> 
311      *
312      * @param {sap.ui.core.URI} sMetadataFile  new value for property <code>metadataFile</code>
313      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
314      * @public
315      * @name sap.apb.makit.Chart#setMetadataFile
316      * @function
317      */
318     
319     
320     /**
321      * Getter for property <code>showRangeSelector</code>.
322      * Specify whether the range selector should be visible.
323      *
324      * Default value is <code>true</code>
325      *
326      * @return {boolean} the value of property <code>showRangeSelector</code>
327      * @public
328      * @name sap.apb.makit.Chart#getShowRangeSelector
329      * @function
330      */
331     
332     /**
333      * Setter for property <code>showRangeSelector</code>.
334      *
335      * Default value is <code>true</code> 
336      *
337      * @param {boolean} bShowRangeSelector  new value for property <code>showRangeSelector</code>
338      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
339      * @public
340      * @name sap.apb.makit.Chart#setShowRangeSelector
341      * @function
342      */
343     
344     
345     /**
346      * Getter for property <code>showTableView</code>.
347      * Toggle to display table view.
348      *
349      * Default value is <code>false</code>
350      *
351      * @return {boolean} the value of property <code>showTableView</code>
352      * @public
353      * @name sap.apb.makit.Chart#getShowTableView
354      * @function
355      */
356     
357     /**
358      * Setter for property <code>showTableView</code>.
359      *
360      * Default value is <code>false</code> 
361      *
362      * @param {boolean} bShowTableView  new value for property <code>showTableView</code>
363      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
364      * @public
365      * @name sap.apb.makit.Chart#setShowTableView
366      * @function
367      */
368     
369     
370     /**
371      * Getter for property <code>showTableValue</code>.
372      * Toggle to display the table value on a Bar chart. Only applies to Bar chart.
373      *
374      * Default value is <code>true</code>
375      *
376      * @return {boolean} the value of property <code>showTableValue</code>
377      * @public
378      * @name sap.apb.makit.Chart#getShowTableValue
379      * @function
380      */
381     
382     /**
383      * Setter for property <code>showTableValue</code>.
384      *
385      * Default value is <code>true</code> 
386      *
387      * @param {boolean} bShowTableValue  new value for property <code>showTableValue</code>
388      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
389      * @public
390      * @name sap.apb.makit.Chart#setShowTableValue
391      * @function
392      */
393     
394     
395     /**
396      * Getter for property <code>showToolbar</code>.
397      * Show or hide the chart's toolbar.
398      *
399      * Default value is <code>true</code>
400      *
401      * @return {boolean} the value of property <code>showToolbar</code>
402      * @public
403      * @name sap.apb.makit.Chart#getShowToolbar
404      * @function
405      */
406     
407     /**
408      * Setter for property <code>showToolbar</code>.
409      *
410      * Default value is <code>true</code> 
411      *
412      * @param {boolean} bShowToolbar  new value for property <code>showToolbar</code>
413      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
414      * @public
415      * @name sap.apb.makit.Chart#setShowToolbar
416      * @function
417      */
418     
419     
420     /**
421      * Getter for property <code>width</code>.
422      * The width of the Chart.
423      *
424      * Default value is <code>100%</code>
425      *
426      * @return {sap.ui.core.CSSSize} the value of property <code>width</code>
427      * @public
428      * @name sap.apb.makit.Chart#getWidth
429      * @function
430      */
431     
432     /**
433      * Setter for property <code>width</code>.
434      *
435      * Default value is <code>100%</code> 
436      *
437      * @param {sap.ui.core.CSSSize} sWidth  new value for property <code>width</code>
438      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
439      * @public
440      * @name sap.apb.makit.Chart#setWidth
441      * @function
442      */
443     
444     
445     /**
446      * Double tap event on chart. 
447      *
448      * @name sap.apb.makit.Chart#doubletap
449      * @event
450      * @param {sap.ui.base.Event} oControlEvent
451      * @param {sap.ui.base.EventProvider} oControlEvent.getSource
452      * @param {object} oControlEvent.getParameters
453     
454      * @public
455      */
456      
457     /**
458      * Attach event handler <code>fnFunction</code> to the 'doubletap' event of this <code>sap.apb.makit.Chart</code>.<br/>.
459      * When called, the context of the event handler (its <code>this</code>) will be bound to <code>oListener<code> if specified
460      * otherwise to this <code>sap.apb.makit.Chart</code>.<br/> itself. 
461      *  
462      * Double tap event on chart. 
463      *
464      * @param {object}
465      *            [oData] An application specific payload object, that will be passed to the event handler along with the event object when firing the event.
466      * @param {function}
467      *            fnFunction The function to call, when the event occurs.  
468      * @param {object}
469      *            [oListener=this] Context object to call the event handler with. Defaults to this <code>sap.apb.makit.Chart</code>.<br/> itself.
470      *
471      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
472      * @public
473      * @name sap.apb.makit.Chart#attachDoubletap
474      * @function
475      */
476     
477     /**
478      * Detach event handler <code>fnFunction</code> from the 'doubletap' event of this <code>sap.apb.makit.Chart</code>.<br/>
479      *
480      * The passed function and listener object must match the ones used for event registration.
481      *
482      * @param {function}
483      *            fnFunction The function to call, when the event occurs.
484      * @param {object}
485      *            oListener Context object on which the given function had to be called.
486      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
487      * @public
488      * @name sap.apb.makit.Chart#detachDoubletap
489      * @function
490      */
491     
492     /**
493      * Fire event doubletap to attached listeners.
494     
495      * @param {Map} [mArguments] the arguments to pass along with the event.
496      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
497      * @protected
498      * @name sap.apb.makit.Chart#fireDoubletap
499      * @function
500      */
501     
502     
503     /**
504      * Single tap event on the chart. 
505      *
506      * @name sap.apb.makit.Chart#tap
507      * @event
508      * @param {sap.ui.base.Event} oControlEvent
509      * @param {sap.ui.base.EventProvider} oControlEvent.getSource
510      * @param {object} oControlEvent.getParameters
511     
512      * @public
513      */
514      
515     /**
516      * Attach event handler <code>fnFunction</code> to the 'tap' event of this <code>sap.apb.makit.Chart</code>.<br/>.
517      * When called, the context of the event handler (its <code>this</code>) will be bound to <code>oListener<code> if specified
518      * otherwise to this <code>sap.apb.makit.Chart</code>.<br/> itself. 
519      *  
520      * Single tap event on the chart. 
521      *
522      * @param {object}
523      *            [oData] An application specific payload object, that will be passed to the event handler along with the event object when firing the event.
524      * @param {function}
525      *            fnFunction The function to call, when the event occurs.  
526      * @param {object}
527      *            [oListener=this] Context object to call the event handler with. Defaults to this <code>sap.apb.makit.Chart</code>.<br/> itself.
528      *
529      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
530      * @public
531      * @name sap.apb.makit.Chart#attachTap
532      * @function
533      */
534     
535     /**
536      * Detach event handler <code>fnFunction</code> from the 'tap' event of this <code>sap.apb.makit.Chart</code>.<br/>
537      *
538      * The passed function and listener object must match the ones used for event registration.
539      *
540      * @param {function}
541      *            fnFunction The function to call, when the event occurs.
542      * @param {object}
543      *            oListener Context object on which the given function had to be called.
544      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
545      * @public
546      * @name sap.apb.makit.Chart#detachTap
547      * @function
548      */
549     
550     /**
551      * Fire event tap to attached listeners.
552     
553      * @param {Map} [mArguments] the arguments to pass along with the event.
554      * @return {sap.apb.makit.Chart} <code>this</code> to allow method chaining
555      * @protected
556      * @name sap.apb.makit.Chart#fireTap
557      * @function
558      */
559     
560     
561     /**
562      * Get the value of the currently highlighted category.
563      *
564      * @name sap.apb.makit.Chart.prototype.getSelectedCategory
565      * @function
566     
567      * @type string
568      * @public
569      */
570     
571     
572     /**
573      * Get the value of the currently highlighted series.
574      *
575      * @name sap.apb.makit.Chart.prototype.getSelectedSeries
576      * @function
577     
578      * @type string
579      * @public
580      */
581     
582     
583     /**
584      * Get the number of distinct category values.
585      *
586      * @name sap.apb.makit.Chart.prototype.getNumberOfCategories
587      * @function
588     
589      * @type int
590      * @public
591      */
592     
593     
594     /**
595      * Re-retrieve data from the datasource and re-render chart.
596      *
597      * @name sap.apb.makit.Chart.prototype.refreshData
598      * @function
599     
600      * @type void
601      * @public
602      */
603     
604