File tree Expand file tree Collapse file tree 7 files changed +1769
-725
lines changed
classes/Visualizer/Render/Page Expand file tree Collapse file tree 7 files changed +1769
-725
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ protected function _toHTML() {
51
51
if ( $ this ->settings ) {
52
52
echo 'win.visualizer.charts.canvas.settings = ' , $ this ->settings , '; ' ;
53
53
}
54
- echo 'win.visualizer.update (); ' ;
54
+ echo 'win.updateChartPreview (); ' ;
55
55
56
56
echo $ this ->updateEditorAndSettings ();
57
57
Original file line number Diff line number Diff line change 33
33
delete settings [ 'height' ] ;
34
34
35
35
v . charts . canvas . settings = settings ;
36
- v . update ( ) ;
36
+ $ ( 'body' ) . trigger ( 'visualizer:render:currentchart:update' , { visualizer : v } ) ;
37
37
} , 1000 ) ;
38
38
}
39
39
Original file line number Diff line number Diff line change 385
385
}
386
386
}
387
387
388
- if ( typeof visualizer !== 'undefined' ) {
389
- // called while updating the chart.
390
- visualizer . update = function ( ) {
391
- renderChart ( 'canvas' , visualizer ) ;
392
- } ;
393
- }
394
-
395
388
$ ( 'body' ) . on ( 'visualizer:render:chart:start' , function ( event , v ) {
396
389
all_charts = v . charts ;
397
390
render ( v ) ;
407
400
renderSpecificChart ( v . id , v . chart , v . v ) ;
408
401
} ) ;
409
402
403
+ $ ( 'body' ) . on ( 'visualizer:render:currentchart:update' , function ( event , v ) {
404
+ var data = v || event . detail ;
405
+ renderChart ( 'canvas' , data . visualizer ) ;
406
+ } ) ;
407
+
410
408
// front end actions
411
409
$ ( 'body' ) . on ( 'visualizer:action:specificchart' , function ( event , v ) {
412
410
switch ( v . action ) {
Original file line number Diff line number Diff line change 278
278
}
279
279
}
280
280
281
- if ( typeof visualizer !== 'undefined' ) {
282
- // called while updating the chart.
283
- visualizer . update = function ( ) {
284
- renderSpecificChart ( 'canvas' , all_charts [ 'canvas' ] , visualizer ) ;
285
- } ;
286
- }
287
-
288
281
$ ( 'body' ) . on ( 'visualizer:render:chart:start' , function ( event , v ) {
289
282
all_charts = v . charts ;
290
283
render ( v ) ;
294
287
renderSpecificChart ( v . id , v . chart , v . v ) ;
295
288
} ) ;
296
289
290
+ $ ( 'body' ) . on ( 'visualizer:render:currentchart:update' , function ( event , v ) {
291
+ var data = v || event . detail ;
292
+ renderSpecificChart ( 'canvas' , all_charts [ 'canvas' ] , data . visualizer ) ;
293
+ } ) ;
294
+
297
295
// front end actions
298
296
$ ( 'body' ) . on ( 'visualizer:action:specificchart' , function ( event , v ) {
299
297
switch ( v . action ) {
Original file line number Diff line number Diff line change 81
81
}
82
82
83
83
$ ( document ) . ready ( function ( ) {
84
+
85
+ // for updating the currently displayed chart (preview mode)
86
+ window . updateChartPreview = function ( ) {
87
+ var event = new CustomEvent ( 'visualizer:render:currentchart:update' , { detail : { visualizer : visualizer } } ) ;
88
+ document . body . dispatchEvent ( event ) ;
89
+ } ;
90
+
84
91
// facade loads N times in the library (where N = the number of different chart libraries supported)
85
92
// so all charts are also loaded N times
86
93
// this will ensure that no matter how many times facade is loaded, it initializes all charts only once.
168
175
169
176
return $ ( this ) ;
170
177
} ;
171
- } ) ( jQuery ) ;
178
+ } ) ( jQuery ) ;
Original file line number Diff line number Diff line change @@ -319,14 +319,6 @@ var __visualizer_chart_images = [];
319
319
}
320
320
}
321
321
322
- if ( typeof visualizer !== 'undefined' ) {
323
- // called while updating the chart.
324
- visualizer . update = function ( ) {
325
- renderChart ( 'canvas' ) ;
326
- } ;
327
- }
328
-
329
-
330
322
var resizeTimeout ;
331
323
332
324
$ ( document ) . ready ( function ( ) {
@@ -421,6 +413,10 @@ var __visualizer_chart_images = [];
421
413
renderSpecificChart ( v . id , v . chart ) ;
422
414
} ) ;
423
415
416
+ $ ( 'body' ) . on ( 'visualizer:render:currentchart:update' , function ( event , v ) {
417
+ renderChart ( 'canvas' ) ;
418
+ } ) ;
419
+
424
420
// front end actions
425
421
$ ( 'body' ) . on ( 'visualizer:action:specificchart' , function ( event , v ) {
426
422
switch ( v . action ) {
You can’t perform that action at this time.
0 commit comments