Skip to content

Commit 0c3d8cb

Browse files
release: new version
[Feat] Option to download charts as .png images [Fix] Make UI more intuitive when a chart is missing in the editor [Fix] Clicking Copy chart shows the Copied message multiple times [Fix] Conflict with Modern Events Calendar plugin [Fix] Chart size ( width and height ) options not working for ChartJS charts [Fix] Resizing the window causes annotation-based charts to throw an error [Fix] Remove Inside the Chart option as legend position for Google Pie charts [Fix] Clicking Advanced Options panel breaks Bubble chart [Fix] Missing posts revisions on chart update
2 parents 5cf6d21 + a04b6e5 commit 0c3d8cb

38 files changed

+1130
-640
lines changed

bin/wp-init.sh

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,30 @@ echo "Sleeping for $sleep_time..."
1818
sleep $sleep_time
1919

2020
# install WP
21-
docker exec $args visualizer_wordpress wp --quiet core install --url="http://$wp_host:8888/" --admin_user="wordpress" --admin_password="wordpress" --admin_email="[email protected]" --title="test" --skip-email
21+
docker exec $args visualizer_wordpress wp --allow-root core install --url="http://$wp_host:8888/" --admin_user="wordpress" --admin_password="wordpress" --admin_email="[email protected]" --title="test" --skip-email
2222

23-
# install required external plugins
23+
# update core
2424
docker exec $args visualizer_wordpress chown -R www-data:www-data /var/www/html/
25-
docker exec $args visualizer_wordpress wp plugin install classic-editor --activate
26-
27-
# so that debug.log is created
2825
docker exec $args visualizer_wordpress chmod 0777 -R /var/www/html/wp-content
26+
docker exec $args visualizer_wordpress wp --allow-root core update
27+
docker exec $args visualizer_wordpress wp --allow-root core update-db
28+
29+
# install required external plugins
30+
docker exec $args visualizer_wordpress wp plugin install classic-editor --activate
2931

3032
# install visualizer free
3133
docker exec $args visualizer_wordpress git clone https://github.com/Codeinwp/visualizer /var/www/html/wp-content/plugins/visualizer
3234

3335
# activate
34-
docker exec $args visualizer_wordpress wp --quiet plugin activate visualizer
36+
docker exec $args visualizer_wordpress wp --allow-root plugin activate visualizer
3537

3638
# set this constant so that the license is not checked
37-
docker exec $args visualizer_wordpress wp --quiet config set TI_UNIT_TESTING true --raw
39+
docker exec $args visualizer_wordpress wp --allow-root config set TI_UNIT_TESTING true --raw
3840

3941
# set this constant so that the specific hooks are loaded
40-
docker exec $args visualizer_wordpress wp --quiet config set TI_CYPRESS_TESTING true --raw
42+
docker exec $args visualizer_wordpress wp --allow-root config set TI_CYPRESS_TESTING true --raw
4143

4244
# debugging
43-
docker exec $args visualizer_wordpress wp --quiet config set WP_DEBUG true --raw
44-
docker exec $args visualizer_wordpress wp --quiet config set WP_DEBUG_LOG true --raw
45-
docker exec $args visualizer_wordpress wp --quiet config set WP_DEBUG_DISPLAY false --raw
46-
45+
docker exec $args visualizer_wordpress wp --allow-root config set WP_DEBUG true --raw
46+
docker exec $args visualizer_wordpress wp --allow-root config set WP_DEBUG_LOG true --raw
47+
docker exec $args visualizer_wordpress wp --allow-root config set WP_DEBUG_DISPLAY false --raw

classes/Visualizer/Gutenberg/Block.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,9 @@ public function update_chart_data( $data ) {
520520
}
521521

522522
if ( $data['id'] && ! is_wp_error( $data['id'] ) ) {
523-
523+
if ( get_post_type( $data['id'] ) !== Visualizer_Plugin::CPT_VISUALIZER ) {
524+
return new WP_Error( 'invalid_post_type', 'Invalid post type.' );
525+
}
524526
$chart_type = sanitize_text_field( $data['visualizer-chart-type'] );
525527
$source_type = sanitize_text_field( $data['visualizer-source'] );
526528

classes/Visualizer/Gutenberg/build/block.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

classes/Visualizer/Gutenberg/src/Components/ChartSelect.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ class ChartSelect extends Component {
112112

113113
<PanelButton
114114
label={ __( 'Advanced Options' ) }
115+
className="visualizer-advanced-options"
115116
icon="admin-tools"
116117
onClick={ () => this.setState({ route: 'showAdvanced' }) }
117118
/>

classes/Visualizer/Gutenberg/src/Components/Sidebar.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import RowCellSettings from './Sidebar/RowCellSettings.js';
2020
import ComboSettings from './Sidebar/ComboSettings.js';
2121
import SeriesSettings from './Sidebar/SeriesSettings.js';
2222
import SlicesSettings from './Sidebar/SlicesSettings.js';
23+
import BubbleSettings from './Sidebar/BubbleSettings.js';
2324
import ColumnSettings from './Sidebar/ColumnSettings.js';
2425
import LayoutAndChartArea from './Sidebar/LayoutAndChartArea.js';
2526
import FrontendActions from './Sidebar/FrontendActions.js';
@@ -113,10 +114,15 @@ class Sidebar extends Component {
113114
<ComboSettings chart={ this.props.chart } edit={ this.props.edit } />
114115
) }
115116

116-
{ ( -1 >= [ 'timeline', 'gauge', 'geo', 'pie', 'dataTable' ].indexOf( type ) ) && (
117+
{ ( -1 >= [ 'timeline', 'bubble', 'gauge', 'geo', 'pie', 'dataTable' ].indexOf( type ) ) && (
117118
<SeriesSettings chart={ this.props.chart } edit={ this.props.edit } />
118119
) }
119120

121+
{ ( 0 <= [ 'bubble' ].indexOf( type ) ) && (
122+
<BubbleSettings chart={ this.props.chart } edit={ this.props.edit } />
123+
) }
124+
125+
120126
{ ( 0 <= [ 'pie' ].indexOf( type ) ) && (
121127
<SlicesSettings chart={ this.props.chart } edit={ this.props.edit } />
122128
) }
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/**
2+
* WordPress dependencies
3+
*/
4+
const { __ } = wp.i18n;
5+
6+
const { Component } = wp.element;
7+
8+
const { ColorPalette } = wp.blockEditor || wp.editor;
9+
10+
import { isChecked } from '../../utils.js';
11+
12+
const {
13+
CheckboxControl,
14+
BaseControl,
15+
PanelBody,
16+
TextControl
17+
} = wp.components;
18+
19+
class BubbleSettings extends Component {
20+
constructor() {
21+
super( ...arguments );
22+
}
23+
24+
componentDidMount() {
25+
26+
}
27+
28+
render() {
29+
30+
const settings = this.props.chart['visualizer-settings'];
31+
32+
return (
33+
<PanelBody
34+
title={ __( 'Bubble Settings' ) }
35+
initialOpen={ false }
36+
className="visualizer-advanced-panel"
37+
>
38+
39+
<TextControl
40+
label={ __( 'Opacity' ) }
41+
help={ __( 'The default opacity of the bubbles, where 0.0 is fully transparent and 1.0 is fully opaque.' ) }
42+
type="number"
43+
min="0"
44+
max="1"
45+
step="0.1"
46+
value={ settings.bubble.opacity }
47+
onChange={ e => {
48+
if ( ! settings.bubble ) {
49+
settings.bubble = {};
50+
}
51+
settings.bubble.opacity = e;
52+
this.props.edit( settings );
53+
} }
54+
/>
55+
56+
<BaseControl
57+
label={ __( 'Stroke Color' ) }
58+
>
59+
<ColorPalette
60+
value={ settings.bubble.stroke }
61+
onChange={ e => {
62+
if ( ! settings.bubble ) {
63+
settings.bubble = {};
64+
}
65+
settings.bubble.stroke = e;
66+
this.props.edit( settings );
67+
} }
68+
/>
69+
</BaseControl>
70+
71+
<CheckboxControl
72+
label={ __( 'Sort Bubbles by Size' ) }
73+
help={ __( 'If checked, sorts the bubbles by size so the smaller bubbles appear above the larger bubbles. If unchecked, bubbles are sorted according to their order in the table.' ) }
74+
checked={ isChecked( settings, 'sortBubblesBySize' ) }
75+
onChange={ e => {
76+
settings.sortBubblesBySize = e;
77+
this.props.edit( settings );
78+
} }
79+
/>
80+
81+
<TextControl
82+
label={ __( 'Size (max)' ) }
83+
help={ __( 'The size value (as appears in the chart data) to be mapped to sizeAxis.maxSize. Larger values will be cropped to this value.' ) }
84+
type="number"
85+
step="1"
86+
value={ settings.sizeAxis.maxValue }
87+
onChange={ e => {
88+
if ( ! settings.sizeAxis ) {
89+
settings.sizeAxis = {};
90+
}
91+
settings.sizeAxis.maxValue = e;
92+
this.props.edit( settings );
93+
} }
94+
/>
95+
96+
<TextControl
97+
label={ __( 'Size (min)' ) }
98+
help={ __( 'The size value (as appears in the chart data) to be mapped to sizeAxis.minSize. Smaller values will be cropped to this value.' ) }
99+
type="number"
100+
step="1"
101+
value={ settings.sizeAxis.minValue }
102+
onChange={ e => {
103+
if ( ! settings.sizeAxis ) {
104+
settings.sizeAxis = {};
105+
}
106+
settings.sizeAxis.minValue = e;
107+
this.props.edit( settings );
108+
} }
109+
/>
110+
111+
</PanelBody>
112+
);
113+
}
114+
}
115+
116+
export default BubbleSettings;

classes/Visualizer/Gutenberg/src/Components/Sidebar/FrontendActions.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class FrontendActions extends Component {
3131
render() {
3232

3333
const settings = this.props.chart['visualizer-settings'];
34+
const type = this.props.chart['visualizer-chart-type'];
3435

3536
return (
3637
<PanelBody
@@ -111,6 +112,25 @@ class FrontendActions extends Component {
111112
} }
112113
/>
113114

115+
{ ( -1 >= [ 'dataTable', 'tabular', 'gauge', 'table' ].indexOf( type ) ) && (
116+
<CheckboxControl
117+
label={ __( 'Download Image' ) }
118+
help={ __( 'To download the chart as an image.' ) }
119+
checked={ ( 0 <= settings.actions.indexOf( 'image' ) ) }
120+
onChange={ e => {
121+
if ( 0 <= settings.actions.indexOf( 'image' ) ) {
122+
const index = settings.actions.indexOf( 'image' );
123+
if ( -1 !== index ) {
124+
settings.actions.splice( index, 1 );
125+
}
126+
} else {
127+
settings.actions.push( 'image' );
128+
}
129+
this.props.edit( settings );
130+
} }
131+
/>
132+
) }
133+
114134
</Fragment>
115135

116136
) }

classes/Visualizer/Gutenberg/src/Components/Sidebar/GeneralSettings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class GeneralSettings extends Component {
230230
</PanelBody>
231231
) }
232232

233-
{ ( -1 >= [ 'table', 'gauge', 'geo', 'dataTable' ].indexOf( type ) ) && (
233+
{ ( -1 >= [ 'table', 'gauge', 'geo', 'dataTable', 'timeline' ].indexOf( type ) ) && (
234234
<PanelBody
235235
title={ __( 'Tooltip' ) }
236236
className="visualizer-inner-sections"

0 commit comments

Comments
 (0)