Skip to content

Commit 84e88fc

Browse files
Merge pull request #338 from Codeinwp/development
Fix issue with Gutenberg support Fix issue with loading new Table chart Fix options that don't work correctly with some charts
2 parents 33ee9a2 + 3922677 commit 84e88fc

File tree

10 files changed

+58
-40
lines changed

10 files changed

+58
-40
lines changed

classes/Visualizer/Gutenberg/Block.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,20 @@ private function __construct() {
6666
* Enqueue front end and editor JavaScript and CSS
6767
*/
6868
public function enqueue_gutenberg_scripts() {
69-
$blockPath = VISUALIZER_ABSURL . '/classes/Visualizer/Gutenberg/build/block.js';
70-
$handsontableJS = VISUALIZER_ABSURL . '/classes/Visualizer/Gutenberg/build/handsontable.js';
71-
$stylePath = VISUALIZER_ABSURL . '/classes/Visualizer/Gutenberg/build/block.css';
72-
$handsontableCSS = VISUALIZER_ABSURL . '/classes/Visualizer/Gutenberg/build/handsontable.css';
69+
$blockPath = VISUALIZER_ABSURL . 'classes/Visualizer/Gutenberg/build/block.js';
70+
$handsontableJS = VISUALIZER_ABSURL . 'classes/Visualizer/Gutenberg/build/handsontable.js';
71+
$stylePath = VISUALIZER_ABSURL . 'classes/Visualizer/Gutenberg/build/block.css';
72+
$handsontableCSS = VISUALIZER_ABSURL . 'classes/Visualizer/Gutenberg/build/handsontable.css';
7373

7474
if ( VISUALIZER_TEST_JS_CUSTOMIZATION ) {
75-
$version = filemtime( VISUALIZER_ABSPATH . '/classes/Visualizer/Gutenberg/build/block.js' );
75+
$version = filemtime( VISUALIZER_ABSPATH . 'classes/Visualizer/Gutenberg/build/block.js' );
7676
} else {
7777
$version = $this->version;
7878
}
7979

8080
// Enqueue the bundled block JS file
8181
wp_enqueue_script( 'handsontable', $handsontableJS );
82-
wp_enqueue_script( 'visualizer-gutenberg-block', $blockPath, array( 'wp-api', 'handsontable' ), $version );
82+
wp_enqueue_script( 'visualizer-gutenberg-block', $blockPath, array( 'wp-api', 'handsontable' ), $version, true );
8383

8484
$type = 'community';
8585

classes/Visualizer/Module/Admin.php

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,14 @@ public static function _getChartTypesLocalized( $enabledOnly = false, $get2Darra
321321
'name' => esc_html__( 'Column', 'visualizer' ),
322322
'enabled' => true,
323323
),
324-
'gauge' => array(
325-
'name' => esc_html__( 'Gauge', 'visualizer' ),
326-
'enabled' => true,
327-
),
328324
'scatter' => array(
329325
'name' => esc_html__( 'Scatter', 'visualizer' ),
330326
'enabled' => true,
331327
),
328+
'gauge' => array(
329+
'name' => esc_html__( 'Gauge', 'visualizer' ),
330+
'enabled' => true,
331+
),
332332
'candlestick' => array(
333333
'name' => esc_html__( 'Candlestick', 'visualizer' ),
334334
'enabled' => true,
@@ -399,10 +399,18 @@ private static function handleDeprecatedCharts( $types, $enabledOnly, $get2Darra
399399
// if a user has a Gauge/Candlestick chart, then let them keep using it.
400400
if ( ! VISUALIZER_PRO ) {
401401
if ( ! self::hasChartType( 'gauge' ) ) {
402-
$deprecated[] = 'gauge';
402+
if ( $get2Darray ) {
403+
$deprecated[] = 'gauge';
404+
} else {
405+
$types['gauge']['enabled'] = false;
406+
}
403407
}
404408
if ( ! self::hasChartType( 'candlestick' ) ) {
405-
$deprecated[] = 'candlestick';
409+
if ( $get2Darray ) {
410+
$deprecated[] = 'candlestick';
411+
} else {
412+
$types['candlestick']['enabled'] = false;
413+
}
406414
}
407415
}
408416
break;
@@ -411,21 +419,27 @@ private static function handleDeprecatedCharts( $types, $enabledOnly, $get2Darra
411419
$deprecated[] = 'table';
412420

413421
// rename the new table chart type.
414-
if ( self::hasChartType( 'table' ) ) {
415-
if ( $get2Darray ) {
416-
$types['dataTable'] = esc_html__( 'Table', 'visualizer' );
417-
} else {
418-
$types['dataTable']['name'] = esc_html__( 'Table', 'visualizer' );
419-
}
422+
if ( $get2Darray ) {
423+
$types['dataTable'] = esc_html__( 'Table', 'visualizer' );
424+
} else {
425+
$types['dataTable']['name'] = esc_html__( 'Table', 'visualizer' );
420426
}
421427

422428
// if a user has a Gauge/Candlestick chart, then let them keep using it.
423429
if ( ! VISUALIZER_PRO ) {
424430
if ( ! self::hasChartType( 'gauge' ) ) {
425-
$deprecated[] = 'gauge';
431+
if ( $get2Darray ) {
432+
$deprecated[] = 'gauge';
433+
} else {
434+
$types['gauge']['enabled'] = false;
435+
}
426436
}
427437
if ( ! self::hasChartType( 'candlestick' ) ) {
428-
$deprecated[] = 'candlestick';
438+
if ( $get2Darray ) {
439+
$deprecated[] = 'candlestick';
440+
} else {
441+
$types['candlestick']['enabled'] = false;
442+
}
429443
}
430444
}
431445
}

classes/Visualizer/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
class Visualizer_Plugin {
2929

3030
const NAME = 'visualizer';
31-
const VERSION = '3.1.0';
31+
const VERSION = '3.1.1';
3232

3333
// custom post types
3434
const CPT_VISUALIZER = 'visualizer';

classes/Visualizer/Render/Sidebar/Graph.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ protected function _renderHorizontalAxisGeneralSettings() {
141141

142142
self::_renderSelectItem(
143143
esc_html__( 'Text Position', 'visualizer' ),
144-
'vAxis[textPosition]',
145-
isset( $this->vAxis['textPosition'] ) ? $this->vAxis['textPosition'] : '',
144+
'hAxis[textPosition]',
145+
isset( $this->hAxis['textPosition'] ) ? $this->hAxis['textPosition'] : '',
146146
$this->_positions,
147147
esc_html__( 'Position of the horizontal axis text, relative to the chart area.', 'visualizer' )
148148
);
@@ -184,16 +184,16 @@ protected function _renderHorizontalAxisSettings() {
184184
self::_renderSectionStart( esc_html__( 'Grid Lines', 'visualizer' ), false );
185185
self::_renderTextItem(
186186
esc_html__( 'Count', 'visualizer' ),
187-
'vAxis[gridlines][count]',
188-
isset( $this->vAxis['gridlines']['count'] ) ? $this->vAxis['gridlines']['count'] : '',
189-
esc_html__( 'The number of horizontal gridlines inside the chart area. Minimum value is 2. Specify -1 to automatically compute the number of gridlines.', 'visualizer' ),
187+
'hAxis[gridlines][count]',
188+
isset( $this->hAxis['gridlines']['count'] ) ? $this->hAxis['gridlines']['count'] : '',
189+
esc_html__( 'The number of vertical gridlines inside the chart area. Minimum value is 2. Specify -1 to automatically compute the number of gridlines.', 'visualizer' ),
190190
5
191191
);
192192

193193
self::_renderColorPickerItem(
194194
esc_html__( 'Color', 'visualizer' ),
195-
'vAxis[gridlines][color]',
196-
isset( $this->vAxis['gridlines']['color'] ) ? $this->vAxis['gridlines']['color'] : null,
195+
'hAxis[gridlines][color]',
196+
isset( $this->hAxis['gridlines']['color'] ) ? $this->hAxis['gridlines']['color'] : null,
197197
'#ccc'
198198
);
199199
self::_renderSectionEnd();
@@ -253,8 +253,8 @@ protected function _renderVerticalAxisGeneralSettings() {
253253

254254
self::_renderSelectItem(
255255
esc_html__( 'Text Position', 'visualizer' ),
256-
'hAxis[textPosition]',
257-
isset( $this->hAxis['textPosition'] ) ? $this->hAxis['textPosition'] : '',
256+
'vAxis[textPosition]',
257+
isset( $this->vAxis['textPosition'] ) ? $this->vAxis['textPosition'] : '',
258258
$this->_positions,
259259
esc_html__( 'Position of the vertical axis text, relative to the chart area.', 'visualizer' )
260260
);
@@ -296,16 +296,16 @@ protected function _renderVerticalAxisSettings() {
296296
self::_renderSectionStart( esc_html__( 'Grid Lines', 'visualizer' ), false );
297297
self::_renderTextItem(
298298
esc_html__( 'Count', 'visualizer' ),
299-
'hAxis[gridlines][count]',
300-
isset( $this->hAxis['gridlines']['count'] ) ? $this->hAxis['gridlines']['count'] : '',
301-
esc_html__( 'The number of vertical gridlines inside the chart area. Minimum value is 2. Specify -1 to automatically compute the number of gridlines.', 'visualizer' ),
299+
'vAxis[gridlines][count]',
300+
isset( $this->vAxis['gridlines']['count'] ) ? $this->vAxis['gridlines']['count'] : '',
301+
esc_html__( 'The number of horizontal gridlines inside the chart area. Minimum value is 2. Specify -1 to automatically compute the number of gridlines.', 'visualizer' ),
302302
5
303303
);
304304

305305
self::_renderColorPickerItem(
306306
esc_html__( 'Color', 'visualizer' ),
307-
'hAxis[gridlines][color]',
308-
isset( $this->hAxis['gridlines']['color'] ) ? $this->hAxis['gridlines']['color'] : null,
307+
'vAxis[gridlines][color]',
308+
isset( $this->vAxis['gridlines']['color'] ) ? $this->vAxis['gridlines']['color'] : null,
309309
'#ccc'
310310
);
311311
self::_renderSectionEnd();

classes/Visualizer/Render/Sidebar/Type/DataTable.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ protected function hooks() {
7575
* @access public
7676
*/
7777
function load_assets( $deps, $is_frontend ) {
78+
if ( ! wp_script_is( 'moment', 'registered' ) ) {
79+
wp_register_script( 'moment', '//cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js', array(), Visualizer_Plugin::VERSION );
80+
}
81+
7882
wp_register_script( 'visualizer-datatables', self::$_js, array( 'jquery-ui-core', 'moment' ), Visualizer_Plugin::VERSION );
7983
wp_enqueue_style( 'visualizer-datatables', self::$_css, array(), Visualizer_Plugin::VERSION );
8084

classes/Visualizer/Render/Sidebar/Type/Gauge.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ protected function _renderGeneralSettings() {
8080
);
8181
self::_renderSectionEnd();
8282

83-
self::_renderSectionStart( esc_html__( 'Gauge Settings', 'visualizer' ), false );
83+
self::_renderGroupEnd();
8484
}
8585

8686
/**

classes/Visualizer/Render/Sidebar/Type/Pie.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ protected function _renderSlicesSettings() {
186186
self::_renderTextItem(
187187
esc_html__( 'Slice Offset', 'visualizer' ),
188188
'slices[' . $i . '][offset]',
189-
isset( $this->slices[ $i ]['color'] ) ? $this->slices[ $i ]['color'] : null,
189+
isset( $this->slices[ $i ]['offset'] ) ? $this->slices[ $i ]['offset'] : null,
190190
esc_html__( "How far to separate the slice from the rest of the pie, from 0.0 (not at all) to 1.0 (the pie's radius).", 'visualizer' ),
191191
'0.0'
192192
);

css/media.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Version: 3.1.0
2+
Version: 3.1.1
33
*/
44
#visualizer-library-view {
55
padding: 30px 10px 10px 30px;

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Plugin Name: Visualizer: Tables and Charts Manager for WordPress (Lite)
55
Plugin URI: https://themeisle.com/plugins/visualizer-charts-and-graphs-lite/
66
Description: A simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages. The plugin uses Google Visualization API to render charts, which supports cross-browser compatibility (adopting VML for older IE versions) and cross-platform portability to iOS and new Android releases.
7-
Version: 3.1.0
7+
Version: 3.1.1
88
Author: Themeisle
99
Author URI: http://themeisle.com
1010
License: GPL v2.0 or later

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "visualizer",
3-
"version": "3.1.0",
3+
"version": "3.1.1",
44
"description": "Visualizer Lite",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)