Skip to content

Commit 7584e7d

Browse files
release: fixes
- Fix update axis baseline color #925 - Update more features images #926 - Fix update minor grid line field #924 - Add new filter for container attributes #922 - Fix axis data format issue #920 - Chart unique title #915 - Fix block back button issue #930 - Userguide broken documentation link #918
2 parents 6fa01e7 + 905f7a1 commit 7584e7d

File tree

22 files changed

+92
-319
lines changed

22 files changed

+92
-319
lines changed

classes/Visualizer/Gutenberg/build/block.js

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

classes/Visualizer/Gutenberg/build/handsontable.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

classes/Visualizer/Gutenberg/build/handsontable.js

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

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const {
1818
TextControl
1919
} = wp.components;
2020

21+
import { getColorCode } from '../../utils.js';
22+
2123
class HorizontalAxisSettings extends Component {
2224
constructor() {
2325
super( ...arguments );
@@ -85,9 +87,9 @@ class HorizontalAxisSettings extends Component {
8587
label={ __( 'Base Line Color' ) }
8688
>
8789
<ColorPalette
88-
value={ settings.hAxis.baselineColor }
90+
value={ settings.vAxis.baselineColor }
8991
onChange={ e => {
90-
settings.hAxis.baselineColor = e;
92+
settings.vAxis.baselineColor = getColorCode( e );
9193
this.props.edit( settings );
9294
} }
9395
/>
@@ -100,7 +102,7 @@ class HorizontalAxisSettings extends Component {
100102
value={ settings.hAxis.textStyle.color || settings.hAxis.textStyle }
101103
onChange={ e => {
102104
settings.hAxis.textStyle = {};
103-
settings.hAxis.textStyle.color = e;
105+
settings.hAxis.textStyle.color = getColorCode( e );
104106
this.props.edit( settings );
105107
} }
106108
/>
@@ -128,7 +130,7 @@ class HorizontalAxisSettings extends Component {
128130

129131
<p>
130132
{ __( 'For date axis labels, this is a subset of the date formatting ' ) }
131-
<ExternalLink href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax">
133+
<ExternalLink href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax">
132134
{ __( 'ICU date and time format.' ) }
133135
</ExternalLink>
134136
</p>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class PieSettings extends Component {
5656

5757
<p>
5858
{ __( 'For date axis labels, this is a subset of the date formatting ' ) }
59-
<ExternalLink href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax">
59+
<ExternalLink href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax">
6060
{ __( 'ICU date and time format.' ) }
6161
</ExternalLink>
6262
</p>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class SeriesSettings extends Component {
175175

176176
<p>
177177
{ __( 'This is a subset of the date formatting ' ) }
178-
<ExternalLink href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax">
178+
<ExternalLink href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax">
179179
{ __( 'ICU date and time format.' ) }
180180
</ExternalLink>
181181
</p>

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const {
1818
TextControl
1919
} = wp.components;
2020

21+
import { getColorCode } from '../../utils.js';
22+
2123
class VerticalAxisSettings extends Component {
2224
constructor() {
2325
super( ...arguments );
@@ -85,9 +87,9 @@ class VerticalAxisSettings extends Component {
8587
label={ __( 'Base Line Color' ) }
8688
>
8789
<ColorPalette
88-
value={ settings.vAxis.baselineColor }
90+
value={ settings.hAxis.baselineColor }
8991
onChange={ e => {
90-
settings.vAxis.baselineColor = e;
92+
settings.hAxis.baselineColor = getColorCode( e );
9193
this.props.edit( settings );
9294
} }
9395
/>
@@ -100,7 +102,7 @@ class VerticalAxisSettings extends Component {
100102
value={ settings.vAxis.textStyle.color || settings.vAxis.textStyle }
101103
onChange={ e => {
102104
settings.vAxis.textStyle = {};
103-
settings.vAxis.textStyle.color = e;
105+
settings.vAxis.textStyle.color = getColorCode( e );
104106
this.props.edit( settings );
105107
} }
106108
/>
@@ -129,7 +131,7 @@ class VerticalAxisSettings extends Component {
129131

130132
<p>
131133
{ __( 'For date axis labels, this is a subset of the date formatting ' ) }
132-
<ExternalLink href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax">
134+
<ExternalLink href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax">
133135
{ __( 'ICU date and time format.' ) }
134136
</ExternalLink>
135137
</p>

classes/Visualizer/Gutenberg/src/Editor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ class Editor extends Component {
581581
} else if ( 'chartSelect' === this.state.route ) {
582582
route = 'showCharts';
583583
}
584-
this.setState({ route });
584+
this.setState({ route, isLoading: false });
585585
this.props.setAttributes({ route });
586586
} }
587587
>

classes/Visualizer/Gutenberg/src/utils.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,14 @@ export const getFormatterForGoogle = ( dataType ) => {
178178
}
179179
return null;
180180
};
181+
182+
export const getColorCode = ( color ) => {
183+
if ( -1 === color.indexOf( '#' ) ) {
184+
let getCssVar = color.match( /\((.*)\)/ ).pop();
185+
if ( getCssVar ) {
186+
let style = getComputedStyle( document.body );
187+
return style.getPropertyValue( getCssVar );
188+
}
189+
}
190+
return color;
191+
};

classes/Visualizer/Module.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public function __construct( Visualizer_Plugin $plugin ) {
6767
$this->_addFilter( Visualizer_Plugin::FILTER_UNDO_REVISIONS, 'undoRevisions', 10, 2 );
6868
$this->_addFilter( Visualizer_Plugin::FILTER_HANDLE_REVISIONS, 'handleExistingRevisions', 10, 2 );
6969
$this->_addFilter( Visualizer_Plugin::FILTER_GET_CHART_DATA_AS, 'getDataAs', 10, 3 );
70+
$this->_addFilter( Visualizer_Plugin::FILTER_CHART_TITLE, 'filterChartTitle', 10, 2 );
7071
register_shutdown_function( array($this, 'onShutdown') );
7172

7273
}
@@ -791,4 +792,21 @@ public function _getImage( $chart = null ) {
791792
'csv' => $image,
792793
);
793794
}
795+
796+
/**
797+
* Filter chart title.
798+
*
799+
* @access public
800+
* @param string $post_title Post title.
801+
* @param int $post_id Post ID.
802+
* @return string
803+
*/
804+
public function filterChartTitle( $post_title, $post_id ) {
805+
$post_type = get_post_type( $post_id );
806+
$post_title = trim( $post_title );
807+
if ( 'visualizer' === $post_type && 'Visualization' === $post_title ) {
808+
return sprintf( '%s #%d', $post_title, $post_id );
809+
}
810+
return $post_title;
811+
}
794812
}

0 commit comments

Comments
 (0)