PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.8.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.8.0
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
← All changes | js/preview.js +53 -3 3.0.73.8.0 View file →
@@ -1,15 +1,64 @@
1 1 /* global visualizer */
2 2 /* global console */
3 +/* global vizSettingsHaveChanged */
4 +/* global vizHaveSettingsChanged */
5 +
3 6 (function($, v) {
4 7 var timeout;
5 8
6 9 $(document).ready(function() {
10 + // when data is impported using csv/url, update the hidden data and the advanced settings sidebar.
11 + // editor and sidebar are both JSON objects
12 + window.vizUpdateHTML = function( editor, sidebar ) {
13 + $('.viz-simple-editor').remove();
14 + $('#content').append(editor.html);
15 + $('#settings-form .viz-group').remove();
16 + $('#settings-form').append(sidebar.html);
17 +
18 + $('#settings-form .control-text').change(updateChart).keyup(updateChart);
19 + $('#settings-form .control-select, #settings-form .control-checkbox, #settings-form .control-check').change(updateChart);
20 + $('#settings-form .color-picker-hex').wpColorPicker({
21 + change: updateChart,
22 + clear: updateChart
23 + });
24 + $('#settings-form textarea[name="manual"]').change(validateJSON).keyup(validateJSON);
25 + vizSettingsHaveChanged(false);
26 + };
27 +
28 + // Update google chart filter control.
29 + window.vizUpdateFilterControl = function() {
30 + $( '#control_wrapper_canvas' ).removeClass( 'no-filter' );
31 + var controlsOpt = $( '.vz-controls-opt' ).map(
32 + function() {
33 + var val = $(this).val();
34 + return '' !== val && 'false' !== val ? val : false ;
35 + }
36 + ).get();
37 + controlsOpt = controlsOpt.filter( function(el) { return el; } );
38 + if ( controlsOpt.length === 0 ) {
39 + $( '#control_wrapper_canvas' ).addClass( 'no-filter' ).html('');
40 + }
41 + }
42 +
7 43 $('#settings-button').click(function() {
8 44 $('#settings-form').submit();
9 45 });
10 46
47 + // this portion captures if the settings have changed so that tabs can handle that information.
48 + var viz_settings_have_changed = false;
49 +
50 + window.vizHaveSettingsChanged = function(){
51 + return viz_settings_have_changed;
52 + };
53 +
54 + window.vizSettingsHaveChanged = function(value){
55 + viz_settings_have_changed = value;
56 + };
57 + // this portion captures if the settings have changed so that tabs can handle that information.
58 +
11 59 function updateChart() {
60 + vizUpdateFilterControl();
12 61 clearTimeout(timeout);
13 62 timeout = setTimeout(function() {
14 63 var settings = $('#settings-form').serializeObject();
15 64
@@ -16,10 +65,11 @@
16 65 delete settings['width'];
17 66 delete settings['height'];
18 67
19 68 v.charts.canvas.settings = settings;
20 - v.render();
21 - }, 1000);
69 + $('body').trigger('visualizer:render:currentchart:update', {visualizer: v});
70 + vizSettingsHaveChanged(true);
71 + }, 1500);
22 72 }
23 73
24 74 function validateJSON() {
25 75 $('#visualizer-error-manual').remove();
@@ -30,9 +80,9 @@
30 80 }
31 81 }
32 82
33 83 $('.control-text').change(updateChart).keyup(updateChart);
34 - $('.control-select, .control-checkbox').change(updateChart);
84 + $('.control-select, .control-checkbox, .control-check').change(updateChart);
35 85 $('.color-picker-hex').wpColorPicker({
36 86 change: updateChart,
37 87 clear: updateChart
38 88 });