Skip to content

Commit 1d37b21

Browse files
Merge branch 'development' into issue-602-1
2 parents bcc44ac + 89a30cb commit 1d37b21

File tree

11 files changed

+113
-14
lines changed

11 files changed

+113
-14
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11

2+
### v3.3.4 - 2019-11-15
3+
**Changes:**
4+
* Fix issue with table chart not loading in the block editor
5+
6+
### v3.3.3 - 2019-11-12
7+
**Changes:**
8+
* Tested upto WordPress 5.3
9+
210
### v3.3.2 - 2019-10-03
311
**Changes:**
412
* Add support for Dataset schema

classes/Visualizer/Module/Admin.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public function addSplChartSchedules( $feature, $chart_id, $plan ) {
109109

110110
switch ( $feature ) {
111111
case 'json':
112+
case 'csv':
112113
// no more schedules if pro is already active.
113114
if ( Visualizer_Module::is_pro() ) {
114115
return;
@@ -117,11 +118,6 @@ public function addSplChartSchedules( $feature, $chart_id, $plan ) {
117118
case 'wp':
118119
// fall-through.
119120
case 'db':
120-
// fall-through.
121-
break;
122-
case 'csv':
123-
// no support for live.
124-
unset( $hours['0'] );
125121
break;
126122
default:
127123
return;

classes/Visualizer/Module/Chart.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,34 @@ public function __construct( Visualizer_Plugin $plugin ) {
6969

7070
$this->_addAjaxAction( Visualizer_Plugin::ACTION_SAVE_FILTER_QUERY, 'saveFilter' );
7171

72+
$this->_addFilter( 'visualizer_get_sidebar', 'getSidebar', 10, 2 );
73+
74+
}
75+
76+
/**
77+
* Generates the HTML of the sidebar for the chart.
78+
*
79+
* @since ?
80+
*
81+
* @access public
82+
*/
83+
public function getSidebar( $sidebar, $chart_id ) {
84+
$chart = get_post( $chart_id );
85+
$data = $this->_getChartArray( $chart );
86+
$sidebar = '';
87+
$sidebar_class = $this->load_chart_class_name( $chart_id );
88+
if ( class_exists( $sidebar_class, true ) ) {
89+
$sidebar = new $sidebar_class( $data['settings'] );
90+
$sidebar->__series = $data['series'];
91+
$sidebar->__data = $data['data'];
92+
} else {
93+
$sidebar = apply_filters( 'visualizer_pro_chart_type_sidebar', '', $data );
94+
if ( $sidebar !== '' ) {
95+
$sidebar->__series = $data['series'];
96+
$sidebar->__data = $data['data'];
97+
}
98+
}
99+
return str_replace( "'", '"', $sidebar->__toString() );
72100
}
73101

74102
/**

classes/Visualizer/Module/Setup.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,17 @@ public function refresh_db_for_chart( $chart, $chart_id, $force = false ) {
279279
$source = new Visualizer_Source_Json( array( 'url' => $url, 'root' => $root, 'paging' => $paging ) );
280280
$source->refresh( $series );
281281
break;
282+
case 'Visualizer_Source_Csv_Remote':
283+
// check if its a live-data chart or a cached-data chart.
284+
if ( ! $force ) {
285+
$hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_SCHEDULE, true );
286+
if ( ! empty( $hours ) ) {
287+
// cached, bail!
288+
return $chart;
289+
}
290+
}
291+
do_action( 'visualizer_schedule_import' );
292+
return get_post( $chart_id );
282293
default:
283294
return $chart;
284295
}

classes/Visualizer/Render/Page/Update.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ protected function _toHTML() {
5252
echo 'win.visualizer.charts.canvas.settings = ', $this->settings, ';';
5353
}
5454
echo 'win.updateChartPreview();';
55+
56+
echo $this->updateEditorAndSettings();
57+
5558
echo '}';
5659

5760
do_action( 'visualizer_add_update_hook', $this->series, $this->data );
@@ -70,4 +73,21 @@ protected function _toHTML() {
7073
echo '</html>';
7174
}
7275

76+
77+
/**
78+
* Update the hidden content in the LHS and the advanced settings
79+
*/
80+
private function updateEditorAndSettings() {
81+
$editor = '';
82+
if ( Visualizer_Module::can_show_feature( 'simple-editor' ) ) {
83+
ob_start();
84+
Visualizer_Render_Layout::show( 'simple-editor-screen', $this->id );
85+
$editor = ob_get_clean();
86+
}
87+
88+
$sidebar = apply_filters( 'visualizer_get_sidebar', '', $this->id );
89+
90+
return 'win.updateHTML(\'' . json_encode( $editor ) . '\', \'' . json_encode( $sidebar ) . '\');';
91+
}
92+
7393
}

cypress/integration/free-sources.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ describe('Test Free - sources', function() {
140140

141141
cy.wrap($body).find('.json-table tbody tr td select').each( function( el, index ) {
142142
if(index === 0){
143-
cy.wrap(el).select('date');
143+
cy.wrap(el).select('date', {force: true});
144144
}else{
145-
cy.wrap(el).select('number');
145+
cy.wrap(el).select('number', {force: true});
146146
}
147147
});
148148
cy.wrap($body).find('#json-chart-button').click().then( () => {

js/frame.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
});
7070

7171
// collapse other open sections of this group
72-
$('.viz-group-title').click(function () {
72+
$(document).on('click', '.viz-group-title', function () {
7373
var parent = $(this).parent();
7474

7575
if (parent.hasClass('open')) {
@@ -89,7 +89,7 @@
8989
});
9090

9191
// collapse other open subsections of this section
92-
$('.viz-section-title').click(function () {
92+
$(document).on('click', '.viz-section-title', function () {
9393
var grandparent = $(this).parent().parent();
9494
grandparent.find('.viz-section-title.open ~ .viz-section-items').hide();
9595
grandparent.find('.viz-section-title.open').removeClass('open');
@@ -124,11 +124,11 @@
124124
$('#canvas').unlock();
125125
});
126126

127-
$('.viz-section-title').click(function () {
127+
$(document).on('click', '.viz-section-title', function () {
128128
$(this).toggleClass('open').parent().find('.viz-section-items').toggle();
129129
});
130130

131-
$('.more-info').click(function () {
131+
$(document).on('click', '.more-info', function () {
132132
$(this).parent().find('.viz-section-description:first').toggle();
133133
return false;
134134
});

js/preview.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@
44
var timeout;
55

66
$(document).ready(function() {
7+
// when data is impported using csv/url, update the hidden data and the advanced settings sidebar.
8+
window.updateHTML = function( editor, sidebar ) {
9+
$('.viz-simple-editor').remove();
10+
$('#content').append(editor);
11+
$('#settings-form .viz-group').remove();
12+
$('#settings-form').append(sidebar);
13+
14+
$('#settings-form .control-text').change(updateChart).keyup(updateChart);
15+
$('#settings-form .control-select, #settings-form .control-checkbox, #settings-form .control-check').change(updateChart);
16+
$('#settings-form .color-picker-hex').wpColorPicker({
17+
change: updateChart,
18+
clear: updateChart
19+
});
20+
$('#settings-form textarea[name="manual"]').change(validateJSON).keyup(validateJSON);
21+
};
22+
723
$('#settings-button').click(function() {
824
$('#settings-form').submit();
925
});

readme.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,16 @@ Pay attention that to turn your shortcodes into graphs, your theme has to have `
159159
13. Bar chart
160160

161161
## Changelog ##
162+
### 3.3.4 - 2019-11-15 ###
163+
164+
* Fix issue with table chart not loading in the block editor
165+
166+
167+
### 3.3.3 - 2019-11-12 ###
168+
169+
* Tested upto WordPress 5.3
170+
171+
162172
### 3.3.2 - 2019-10-03 ###
163173

164174
* Add support for Dataset schema

readme.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,18 @@ Pay attention that to turn your shortcodes into graphs, your theme has to have `
161161
12. Bar settings, Series settings
162162
13. Bar chart
163163

164-
## Changelog ##
165-
### 3.3.2 - 2019-10-03 ###
164+
== Changelog ==
165+
= 3.3.4 - 2019-11-15 =
166+
167+
* Fix issue with table chart not loading in the block editor
168+
169+
170+
= 3.3.3 - 2019-11-12 =
171+
172+
* Tested upto WordPress 5.3
173+
174+
175+
= 3.3.2 - 2019-10-03 =
166176

167177
* Add support for Dataset schema
168178
* Horizontal Axis formatting should apply to tooltips

0 commit comments

Comments
 (0)