@@ -31,6 +31,7 @@ window.ColumnType = ColumnType;
3131 */
3232var ChartFactory = function ( ) {
3333} ;
34+
3435ChartFactory . prototype = {
3536 createChart : function ( ) {
3637 throw new Error ( 'createChart must be implemented by a subclass' ) ;
@@ -46,6 +47,7 @@ ChartFactory.prototype = {
4647var Chart = function ( elementId ) {
4748 this . elementId = elementId ;
4849} ;
50+
4951Chart . prototype = {
5052 draw : function ( ) {
5153 throw new Error ( 'draw must be implemented by a subclass' ) ;
@@ -76,18 +78,21 @@ Chart.prototype = {
7678var BaseChart = function ( elementId ) {
7779 Chart . call ( this , elementId ) ;
7880} ;
81+
7982BaseChart . prototype = new Chart ( ) ;
8083BaseChart . prototype . constructor = BaseChart ;
8184BaseChart . prototype . validateColumns = function ( dataTable ) {
8285 var columns = dataTable . getColumns ( ) ;
8386 if ( columns . length < 2 ) {
8487 throw new Error ( 'Minimum of two columns are required for this chart' ) ;
8588 }
89+
8690 for ( var i = 1 ; i < columns . length ; i ++ ) {
8791 if ( columns [ i ] . type !== ColumnType . NUMBER ) {
8892 throw new Error ( 'Column ' + ( i + 1 ) + ' should be of type \'Number\'' ) ;
8993 }
9094 }
95+
9196 return true ;
9297} ;
9398
@@ -100,13 +105,15 @@ BaseChart.prototype.validateColumns = function (dataTable) {
100105var PieChart = function ( elementId ) {
101106 BaseChart . call ( this , elementId ) ;
102107} ;
108+
103109PieChart . prototype = new BaseChart ( ) ;
104110PieChart . prototype . constructor = PieChart ;
105111PieChart . prototype . validateColumns = function ( dataTable ) {
106112 var columns = dataTable . getColumns ( ) ;
107113 if ( columns . length > 2 ) {
108114 throw new Error ( 'Pie charts can draw only one series' ) ;
109115 }
116+
110117 return BaseChart . prototype . validateColumns . call ( this , dataTable ) ;
111118} ;
112119
@@ -119,6 +126,7 @@ PieChart.prototype.validateColumns = function (dataTable) {
119126var TimelineChart = function ( elementId ) {
120127 BaseChart . call ( this , elementId ) ;
121128} ;
129+
122130TimelineChart . prototype = new BaseChart ( ) ;
123131TimelineChart . prototype . constructor = TimelineChart ;
124132TimelineChart . prototype . validateColumns = function ( dataTable ) {
@@ -129,6 +137,7 @@ TimelineChart.prototype.validateColumns = function (dataTable) {
129137 throw new Error ( 'First column of timeline chart need to be a date column' ) ;
130138 }
131139 }
140+
132141 return result ;
133142} ;
134143
@@ -141,6 +150,7 @@ TimelineChart.prototype.validateColumns = function (dataTable) {
141150var ScatterChart = function ( elementId ) {
142151 BaseChart . call ( this , elementId ) ;
143152} ;
153+
144154ScatterChart . prototype = new BaseChart ( ) ;
145155ScatterChart . prototype . constructor = ScatterChart ;
146156ScatterChart . prototype . validateColumns = function ( dataTable ) {
@@ -151,6 +161,7 @@ ScatterChart.prototype.validateColumns = function (dataTable) {
151161 throw new Error ( 'First column of scatter chart need to be a numeric column' ) ;
152162 }
153163 }
164+
154165 return result ;
155166} ;
156167
@@ -185,6 +196,7 @@ var DataTable = function () {
185196 if ( columns . length === 0 ) {
186197 throw new Error ( 'Set columns first' ) ;
187198 }
199+
188200 var row ;
189201 for ( var i = 0 ; i < data . length ; i ++ ) {
190202 row = data [ i ] ;
@@ -198,6 +210,7 @@ var DataTable = function () {
198210 }
199211 } ;
200212} ;
213+
201214window . DataTable = DataTable ;
202215
203216/** *****************************************************************************
@@ -215,6 +228,7 @@ var JQPlotChart = function (elementId) {
215228 this . plot = null ;
216229 this . validator = null ;
217230} ;
231+
218232JQPlotChart . prototype = new Chart ( ) ;
219233JQPlotChart . prototype . constructor = JQPlotChart ;
220234JQPlotChart . prototype . draw = function ( data , options ) {
@@ -223,24 +237,29 @@ JQPlotChart.prototype.draw = function (data, options) {
223237 . populateOptions ( data , options ) ) ;
224238 }
225239} ;
240+
226241JQPlotChart . prototype . destroy = function ( ) {
227242 if ( this . plot !== null ) {
228243 this . plot . destroy ( ) ;
229244 }
230245} ;
246+
231247JQPlotChart . prototype . redraw = function ( options ) {
232248 if ( this . plot !== null ) {
233249 this . plot . replot ( options ) ;
234250 }
235251} ;
252+
236253JQPlotChart . prototype . toImageString = function ( ) {
237254 if ( this . plot !== null ) {
238255 return $ ( '#' + this . elementId ) . jqplotToImageStr ( { } ) ;
239256 }
240257} ;
258+
241259JQPlotChart . prototype . populateOptions = function ( ) {
242260 throw new Error ( 'populateOptions must be implemented by a subclass' ) ;
243261} ;
262+
244263JQPlotChart . prototype . prepareData = function ( ) {
245264 throw new Error ( 'prepareData must be implemented by a subclass' ) ;
246265} ;
@@ -255,6 +274,7 @@ var JQPlotLineChart = function (elementId) {
255274 JQPlotChart . call ( this , elementId ) ;
256275 this . validator = BaseChart . prototype ;
257276} ;
277+
258278JQPlotLineChart . prototype = new JQPlotChart ( ) ;
259279JQPlotLineChart . prototype . constructor = JQPlotLineChart ;
260280
@@ -288,12 +308,14 @@ JQPlotLineChart.prototype.populateOptions = function (dataTable, options) {
288308 } ) ;
289309 }
290310 }
311+
291312 if ( optional . axes . xaxis . ticks . length === 0 ) {
292313 var data = dataTable . getData ( ) ;
293314 for ( var j = 0 ; j < data . length ; j ++ ) {
294315 optional . axes . xaxis . ticks . push ( data [ j ] [ 0 ] . toString ( ) ) ;
295316 }
296317 }
318+
297319 return optional ;
298320} ;
299321
@@ -310,9 +332,11 @@ JQPlotLineChart.prototype.prepareData = function (dataTable) {
310332 retRow = [ ] ;
311333 retData [ j - 1 ] = retRow ;
312334 }
335+
313336 retRow . push ( row [ j ] ) ;
314337 }
315338 }
339+
316340 return retData ;
317341} ;
318342
@@ -325,6 +349,7 @@ JQPlotLineChart.prototype.prepareData = function (dataTable) {
325349var JQPlotSplineChart = function ( elementId ) {
326350 JQPlotLineChart . call ( this , elementId ) ;
327351} ;
352+
328353JQPlotSplineChart . prototype = new JQPlotLineChart ( ) ;
329354JQPlotSplineChart . prototype . constructor = JQPlotSplineChart ;
330355
@@ -340,6 +365,7 @@ JQPlotSplineChart.prototype.populateOptions = function (dataTable, options) {
340365 }
341366 } ;
342367 $ . extend ( true , optional , opt , compulsory ) ;
368+
343369 return optional ;
344370} ;
345371
@@ -353,6 +379,7 @@ var JQPlotScatterChart = function (elementId) {
353379 JQPlotChart . call ( this , elementId ) ;
354380 this . validator = ScatterChart . prototype ;
355381} ;
382+
356383JQPlotScatterChart . prototype = new JQPlotChart ( ) ;
357384JQPlotScatterChart . prototype . constructor = JQPlotScatterChart ;
358385
@@ -392,6 +419,7 @@ JQPlotScatterChart.prototype.populateOptions = function (dataTable, options) {
392419 } ;
393420
394421 $ . extend ( true , optional , options , compulsory ) ;
422+
395423 return optional ;
396424} ;
397425
@@ -409,10 +437,12 @@ JQPlotScatterChart.prototype.prepareData = function (dataTable) {
409437 retRow = [ ] ;
410438 retData [ j - 1 ] = retRow ;
411439 }
440+
412441 retRow . push ( [ row [ 0 ] , row [ j ] ] ) ;
413442 }
414443 }
415444 }
445+
416446 return retData ;
417447} ;
418448
@@ -426,6 +456,7 @@ var JQPlotTimelineChart = function (elementId) {
426456 JQPlotLineChart . call ( this , elementId ) ;
427457 this . validator = TimelineChart . prototype ;
428458} ;
459+
429460JQPlotTimelineChart . prototype = new JQPlotLineChart ( ) ;
430461JQPlotTimelineChart . prototype . constructor = JQPlotTimelineChart ;
431462
@@ -448,6 +479,7 @@ JQPlotTimelineChart.prototype.populateOptions = function (dataTable, options) {
448479 }
449480 } ;
450481 $ . extend ( true , optional , opt , compulsory ) ;
482+
451483 return optional ;
452484} ;
453485
@@ -466,6 +498,7 @@ JQPlotTimelineChart.prototype.prepareData = function (dataTable) {
466498 retRow = [ ] ;
467499 retData [ j - 1 ] = retRow ;
468500 }
501+
469502 // See https://github.com/phpmyadmin/phpmyadmin/issues/14395 for the block
470503 if ( d !== null && typeof d === 'object' ) {
471504 retRow . push ( [ d . getTime ( ) , row [ j ] ] ) ;
@@ -475,6 +508,7 @@ JQPlotTimelineChart.prototype.prepareData = function (dataTable) {
475508 }
476509 }
477510 }
511+
478512 return retData ;
479513} ;
480514
@@ -487,6 +521,7 @@ JQPlotTimelineChart.prototype.prepareData = function (dataTable) {
487521var JQPlotAreaChart = function ( elementId ) {
488522 JQPlotLineChart . call ( this , elementId ) ;
489523} ;
524+
490525JQPlotAreaChart . prototype = new JQPlotLineChart ( ) ;
491526JQPlotAreaChart . prototype . constructor = JQPlotAreaChart ;
492527
@@ -504,6 +539,7 @@ JQPlotAreaChart.prototype.populateOptions = function (dataTable, options) {
504539 }
505540 } ;
506541 $ . extend ( true , optional , opt , compulsory ) ;
542+
507543 return optional ;
508544} ;
509545
@@ -516,6 +552,7 @@ JQPlotAreaChart.prototype.populateOptions = function (dataTable, options) {
516552var JQPlotColumnChart = function ( elementId ) {
517553 JQPlotLineChart . call ( this , elementId ) ;
518554} ;
555+
519556JQPlotColumnChart . prototype = new JQPlotLineChart ( ) ;
520557JQPlotColumnChart . prototype . constructor = JQPlotColumnChart ;
521558
@@ -533,6 +570,7 @@ JQPlotColumnChart.prototype.populateOptions = function (dataTable, options) {
533570 }
534571 } ;
535572 $ . extend ( true , optional , opt , compulsory ) ;
573+
536574 return optional ;
537575} ;
538576
@@ -545,6 +583,7 @@ JQPlotColumnChart.prototype.populateOptions = function (dataTable, options) {
545583var JQPlotBarChart = function ( elementId ) {
546584 JQPlotLineChart . call ( this , elementId ) ;
547585} ;
586+
548587JQPlotBarChart . prototype = new JQPlotLineChart ( ) ;
549588JQPlotBarChart . prototype . constructor = JQPlotBarChart ;
550589
@@ -589,13 +628,15 @@ JQPlotBarChart.prototype.populateOptions = function (dataTable, options) {
589628 optional . axes . yaxis . ticks . push ( data [ i ] [ 0 ] . toString ( ) ) ;
590629 }
591630 }
631+
592632 if ( optional . series . length === 0 ) {
593633 for ( var j = 1 ; j < columns . length ; j ++ ) {
594634 optional . series . push ( {
595635 label : columns [ j ] . name . toString ( )
596636 } ) ;
597637 }
598638 }
639+
599640 return optional ;
600641} ;
601642
@@ -609,6 +650,7 @@ var JQPlotPieChart = function (elementId) {
609650 JQPlotChart . call ( this , elementId ) ;
610651 this . validator = PieChart . prototype ;
611652} ;
653+
612654JQPlotPieChart . prototype = new JQPlotChart ( ) ;
613655JQPlotPieChart . prototype . constructor = JQPlotPieChart ;
614656
@@ -632,6 +674,7 @@ JQPlotPieChart.prototype.populateOptions = function (dataTable, options) {
632674 }
633675 } ;
634676 $ . extend ( true , optional , options , compulsory ) ;
677+
635678 return optional ;
636679} ;
637680
@@ -643,6 +686,7 @@ JQPlotPieChart.prototype.prepareData = function (dataTable) {
643686 row = data [ i ] ;
644687 retData . push ( [ row [ 0 ] , row [ 1 ] ] ) ;
645688 }
689+
646690 return [ retData ] ;
647691} ;
648692
@@ -651,6 +695,7 @@ JQPlotPieChart.prototype.prepareData = function (dataTable) {
651695 */
652696var JQPlotChartFactory = function ( ) {
653697} ;
698+
654699JQPlotChartFactory . prototype = new ChartFactory ( ) ;
655700JQPlotChartFactory . prototype . createChart = function ( type , elementId ) {
656701 var chart = null ;
@@ -683,4 +728,5 @@ JQPlotChartFactory.prototype.createChart = function (type, elementId) {
683728
684729 return chart ;
685730} ;
731+
686732window . JQPlotChartFactory = JQPlotChartFactory ;
0 commit comments