Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release #932

Merged
merged 23 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a140c2d
Sync branch [skip ci]
pirate-bot Jul 5, 2022
5425d59
Sync branch [skip ci]
pirate-bot Jul 5, 2022
3f35dac
Create unique chart title #915
girishpanchal30 Aug 1, 2022
ac521a4
Fix redirect issue when edit clone chart #915
girishpanchal30 Aug 1, 2022
11a9780
Userguide broken documentation link #918
girishpanchal30 Aug 4, 2022
ccecd30
Fix wrong date format #920
girishpanchal30 Aug 8, 2022
5bbb35d
Add new filter for container attributes #922
girishpanchal30 Aug 16, 2022
93958c4
Remove unwanted code #922
girishpanchal30 Aug 16, 2022
26f8cc7
Fix update minor grid line value #924
girishpanchal30 Aug 23, 2022
08572f0
Update more features images #926
girishpanchal30 Aug 23, 2022
aed1bf9
Fix update axis baseline color #925
girishpanchal30 Aug 23, 2022
5d15462
Fix select color from neve color palette #925
girishpanchal30 Aug 23, 2022
6e422fd
Fix block back button issue #930
girishpanchal30 Aug 24, 2022
3a139b6
Merge pull request #929 from Codeinwp/bugfix/925
vytisbulkevicius Aug 29, 2022
211cbdc
Merge pull request #928 from Codeinwp/bugfix/926
vytisbulkevicius Aug 29, 2022
9bdac9f
Merge pull request #927 from Codeinwp/bugfix/924
vytisbulkevicius Aug 29, 2022
a5af309
Merge pull request #923 from Codeinwp/enhancement/922
vytisbulkevicius Aug 29, 2022
e6945aa
Merge pull request #921 from Codeinwp/bugfix/920
vytisbulkevicius Aug 29, 2022
1aa78e3
Merge pull request #916 from Codeinwp/enhancement/915
vytisbulkevicius Aug 29, 2022
ee1b239
Fix file conflict #918
girishpanchal30 Aug 30, 2022
ce3119f
Fix file conflict #930
girishpanchal30 Aug 30, 2022
42e3371
Merge pull request #931 from Codeinwp/bugfix/930
vytisbulkevicius Aug 30, 2022
905f7a1
Merge pull request #919 from Codeinwp/bugfix/918
vytisbulkevicius Aug 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
290 changes: 9 additions & 281 deletions classes/Visualizer/Gutenberg/build/block.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion classes/Visualizer/Gutenberg/build/handsontable.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions classes/Visualizer/Gutenberg/build/handsontable.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const {
TextControl
} = wp.components;

import { getColorCode } from '../../utils.js';

class HorizontalAxisSettings extends Component {
constructor() {
super( ...arguments );
Expand Down Expand Up @@ -85,9 +87,9 @@ class HorizontalAxisSettings extends Component {
label={ __( 'Base Line Color' ) }
>
<ColorPalette
value={ settings.hAxis.baselineColor }
value={ settings.vAxis.baselineColor }
onChange={ e => {
settings.hAxis.baselineColor = e;
settings.vAxis.baselineColor = getColorCode( e );
this.props.edit( settings );
} }
/>
Expand All @@ -100,7 +102,7 @@ class HorizontalAxisSettings extends Component {
value={ settings.hAxis.textStyle.color || settings.hAxis.textStyle }
onChange={ e => {
settings.hAxis.textStyle = {};
settings.hAxis.textStyle.color = e;
settings.hAxis.textStyle.color = getColorCode( e );
this.props.edit( settings );
} }
/>
Expand Down Expand Up @@ -128,7 +130,7 @@ class HorizontalAxisSettings extends Component {

<p>
{ __( 'For date axis labels, this is a subset of the date formatting ' ) }
<ExternalLink href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax">
<ExternalLink href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax">
{ __( 'ICU date and time format.' ) }
</ExternalLink>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class PieSettings extends Component {

<p>
{ __( 'For date axis labels, this is a subset of the date formatting ' ) }
<ExternalLink href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax">
<ExternalLink href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax">
{ __( 'ICU date and time format.' ) }
</ExternalLink>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class SeriesSettings extends Component {

<p>
{ __( 'This is a subset of the date formatting ' ) }
<ExternalLink href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax">
<ExternalLink href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax">
{ __( 'ICU date and time format.' ) }
</ExternalLink>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const {
TextControl
} = wp.components;

import { getColorCode } from '../../utils.js';

class VerticalAxisSettings extends Component {
constructor() {
super( ...arguments );
Expand Down Expand Up @@ -85,9 +87,9 @@ class VerticalAxisSettings extends Component {
label={ __( 'Base Line Color' ) }
>
<ColorPalette
value={ settings.vAxis.baselineColor }
value={ settings.hAxis.baselineColor }
onChange={ e => {
settings.vAxis.baselineColor = e;
settings.hAxis.baselineColor = getColorCode( e );
this.props.edit( settings );
} }
/>
Expand All @@ -100,7 +102,7 @@ class VerticalAxisSettings extends Component {
value={ settings.vAxis.textStyle.color || settings.vAxis.textStyle }
onChange={ e => {
settings.vAxis.textStyle = {};
settings.vAxis.textStyle.color = e;
settings.vAxis.textStyle.color = getColorCode( e );
this.props.edit( settings );
} }
/>
Expand Down Expand Up @@ -129,7 +131,7 @@ class VerticalAxisSettings extends Component {

<p>
{ __( 'For date axis labels, this is a subset of the date formatting ' ) }
<ExternalLink href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax">
<ExternalLink href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax">
{ __( 'ICU date and time format.' ) }
</ExternalLink>
</p>
Expand Down
2 changes: 1 addition & 1 deletion classes/Visualizer/Gutenberg/src/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ class Editor extends Component {
} else if ( 'chartSelect' === this.state.route ) {
route = 'showCharts';
}
this.setState({ route });
this.setState({ route, isLoading: false });
this.props.setAttributes({ route });
} }
>
Expand Down
11 changes: 11 additions & 0 deletions classes/Visualizer/Gutenberg/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,14 @@ export const getFormatterForGoogle = ( dataType ) => {
}
return null;
};

export const getColorCode = ( color ) => {
if ( -1 === color.indexOf( '#' ) ) {
let getCssVar = color.match( /\((.*)\)/ ).pop();
if ( getCssVar ) {
let style = getComputedStyle( document.body );
return style.getPropertyValue( getCssVar );
}
}
return color;
};
18 changes: 18 additions & 0 deletions classes/Visualizer/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function __construct( Visualizer_Plugin $plugin ) {
$this->_addFilter( Visualizer_Plugin::FILTER_UNDO_REVISIONS, 'undoRevisions', 10, 2 );
$this->_addFilter( Visualizer_Plugin::FILTER_HANDLE_REVISIONS, 'handleExistingRevisions', 10, 2 );
$this->_addFilter( Visualizer_Plugin::FILTER_GET_CHART_DATA_AS, 'getDataAs', 10, 3 );
$this->_addFilter( Visualizer_Plugin::FILTER_CHART_TITLE, 'filterChartTitle', 10, 2 );
register_shutdown_function( array($this, 'onShutdown') );

}
Expand Down Expand Up @@ -791,4 +792,21 @@ public function _getImage( $chart = null ) {
'csv' => $image,
);
}

/**
* Filter chart title.
*
* @access public
* @param string $post_title Post title.
* @param int $post_id Post ID.
* @return string
*/
public function filterChartTitle( $post_title, $post_id ) {
$post_type = get_post_type( $post_id );
$post_title = trim( $post_title );
if ( 'visualizer' === $post_type && 'Visualization' === $post_title ) {
return sprintf( '%s #%d', $post_title, $post_id );
}
return $post_title;
}
}
5 changes: 3 additions & 2 deletions classes/Visualizer/Module/Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -1245,15 +1245,16 @@ public function cloneChart() {
'vaction' => false,
),
admin_url( 'admin.php' )
)
),
null,
'db'
);
}
}

if ( defined( 'WP_TESTS_DOMAIN' ) ) {
wp_die();
}

wp_redirect( $redirect );
exit;
}
Expand Down
2 changes: 2 additions & 0 deletions classes/Visualizer/Module/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ public function renderChart( $atts ) {
$attributes['data-lazy-limit'] = $atts['lazy'];
}

$attributes = apply_filters( 'visualizer_container_attributes', $attributes, $chart->ID );

$chart = apply_filters( 'visualizer_schedule_refresh_chart', $chart, $chart->ID, false );

// Get and update settings.
Expand Down
1 change: 1 addition & 0 deletions classes/Visualizer/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class Visualizer_Plugin {
const FILTER_HANDLE_REVISIONS = 'visualizer-handle-revisions';
const FILTER_GET_CHART_DATA_AS = 'visualizer-get-chart-data-as';
const FILTER_HANDLE_CACHE_EXPIRATION_TIME = 'visualizer-handle-expiration-time';
const FILTER_CHART_TITLE = 'the_title';

const CF_DB_SCHEDULE = 'visualizer-db-schedule';
const CF_DB_QUERY = 'visualizer-db-query';
Expand Down
2 changes: 1 addition & 1 deletion classes/Visualizer/Render/Sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ protected function _renderFormatField( $index = 0 ) {
esc_html__( 'Date Format', 'visualizer' ),
'series[' . $index . '][format]',
isset( $this->series[ $index ]['format'] ) ? $this->series[ $index ]['format'] : '',
sprintf( esc_html__( 'Enter custom format pattern to apply to this series value, similar to the %1$sICU date and time format%2$s.', 'visualizer' ), '<a href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax" target="_blank">', '</a>' ),
sprintf( esc_html__( 'Enter custom format pattern to apply to this series value, similar to the %1$sICU date and time format%2$s.', 'visualizer' ), '<a href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax" target="_blank">', '</a>' ),
'eeee, dd LLLL yyyy'
);
break;
Expand Down
8 changes: 4 additions & 4 deletions classes/Visualizer/Render/Sidebar/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ protected function _renderHorizontalAxisSettings() {
esc_html__( 'Specify 0 to disable the minor gridlines.', 'visualizer' ),
0,
'number',
array( 'min' => 0, 'max' => 1, 'step' => 1 )
array( 'min' => 0, 'step' => 1 )
);

self::_renderColorPickerItem(
Expand Down Expand Up @@ -358,7 +358,7 @@ protected function _renderVerticalAxisSettings() {
esc_html__( 'Specify 0 to disable the minor gridlines.', 'visualizer' ),
0,
'number',
array( 'min' => 0, 'max' => 1, 'step' => 1 )
array( 'min' => 0, 'step' => 1 )
);

self::_renderColorPickerItem(
Expand Down Expand Up @@ -481,7 +481,7 @@ protected function _renderHorizontalAxisFormatField() {
),
sprintf(
esc_html__( 'For date axis labels, this is a subset of the date formatting %1$sICU date and time format%2$s.', 'visualizer' ),
'<a href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax" target="_blank">',
'<a href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax" target="_blank">',
'</a>'
)
)
Expand Down Expand Up @@ -510,7 +510,7 @@ protected function _renderVerticalAxisFormatField() {
),
sprintf(
esc_html__( 'For date axis labels, this is a subset of the date formatting %1$sICU date and time format%2$s.', 'visualizer' ),
'<a href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax" target="_blank">',
'<a href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax" target="_blank">',
'</a>'
)
)
Expand Down
4 changes: 2 additions & 2 deletions classes/Visualizer/Render/Sidebar/Type/ChartJS/Linear.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ protected function _renderHorizontalAxisGeneralSettings() {
),
sprintf(
esc_html__( 'For date axis labels, this is a subset of the date formatting %1$sICU date and time format%2$s.', 'visualizer' ),
'<a href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax" target="_blank">',
'<a href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax" target="_blank">',
'</a>'
)
)
Expand Down Expand Up @@ -307,7 +307,7 @@ protected function _renderVerticalAxisGeneralSettings() {
),
sprintf(
esc_html__( 'For date axis labels, this is a subset of the date formatting %1$sICU date and time format%2$s.', 'visualizer' ),
'<a href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax" target="_blank">',
'<a href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax" target="_blank">',
'</a>'
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function _renderPieSettings() {
),
sprintf(
esc_html__( 'For date axis labels, this is a subset of the date formatting %1$sICU date and time format%2$s.', 'visualizer' ),
'<a href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax" target="_blank">',
'<a href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax" target="_blank">',
'</a>'
)
)
Expand Down
Binary file modified images/pro/excel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/pro/import.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/pro/more_charts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/pro/support.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 22 additions & 14 deletions js/render-chartjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
for (i = 0; i < data.length; i++) {
row = [];
for (j = 0; j < series.length; j++) {
if (series[j].type === 'date' || series[j].type === 'datetime') {
if (series[j].type === 'date' || series[j].type === 'datetime') {
date = new Date(data[i][j]);
data[i][j] = null;
if (Object.prototype.toString.call(date) === "[object Date]") {
Expand Down Expand Up @@ -349,19 +349,22 @@
// format the axes labels.
if(typeof settings[axis + '_format'] !== 'undefined' && settings[axis + '_format'] !== ''){
var format = settings[axis + '_format'];
switch(axis){
case 'xAxes':
settings.scales.x.ticks.callback = function(value, index, values){
return format_datum(value, format);
};
break;
case 'yAxes':
settings.scales.y.ticks.callback = function(value, index, values){
return format_datum(value, format);
};
break;
}
delete settings[axis + '_format'];
var isDateFormat = moment( moment().format( format ),format, true ).isValid();
if ( ! isDateFormat ) {
switch(axis){
case 'xAxes':
settings.scales.x.ticks.callback = function(value, index, values){
return format_datum(value, format);
};
break;
case 'yAxes':
settings.scales.y.ticks.callback = function(value, index, values){
return format_datum(value, format);
};
break;
}
delete settings[axis + '_format'];
}
}
delete settings[axis];
}
Expand Down Expand Up @@ -445,6 +448,11 @@
function format_data(datum, j, settings, series){
j = j - 1;
var format = typeof settings.series !== 'undefined' && typeof settings.series[j] !== 'undefined' ? settings.series[j].format : '';
if ( '' === format && typeof settings.yAxes_format !== 'undefined' ) {
format = settings.yAxes_format;
} else if ( '' === format && typeof settings.xAxes_format !== 'undefined' ) {
format = settings.xAxes_format;
}
return format_datum(datum, format, series[j + 1].type);
}

Expand Down