File tree Expand file tree Collapse file tree 5 files changed +13
-25
lines changed
classes/Visualizer/Render/Page Expand file tree Collapse file tree 5 files changed +13
-25
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
echo '} ' ;
56
56
57
57
do_action ( 'visualizer_add_update_hook ' , $ this ->series , $ this ->data );
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 ) ;
408
401
} ) ;
409
402
410
403
$ ( 'body' ) . on ( 'visualizer:render:currentchart:update' , function ( event , v ) {
411
- renderChart ( 'canvas' , v . visualizer ) ;
404
+ var data = v || event . detail ;
405
+ renderChart ( 'canvas' , data . visualizer ) ;
412
406
} ) ;
413
407
414
408
// front end actions
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 ) ;
295
288
} ) ;
296
289
297
290
$ ( 'body' ) . on ( 'visualizer:render:currentchart:update' , function ( event , v ) {
298
- renderSpecificChart ( 'canvas' , all_charts [ 'canvas' ] , v . visualizer ) ;
291
+ var data = v || event . detail ;
292
+ renderSpecificChart ( 'canvas' , all_charts [ 'canvas' ] , data . visualizer ) ;
299
293
} ) ;
300
294
301
295
// front end actions
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,13 +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
322
var resizeTimeout ;
330
323
331
324
$ ( document ) . ready ( function ( ) {
You can’t perform that action at this time.
0 commit comments