Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions classes/Visualizer/Module/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,12 @@ public static function _getChartTypesLocalized( $enabledOnly = false, $get2Darra
'enabled' => true,
'supports' => array( 'Google Charts', 'ChartJS' ),
),
'bubble' => array(
'name' => esc_html__( 'Bubble', 'visualizer' ),
'enabled' => true,
// chartjs' bubble is ugly looking (and it won't work off the default bubble.csv) so it is being excluded for the time being.
'supports' => array( 'Google Charts' ),
),
'scatter' => array(
'name' => esc_html__( 'Scatter', 'visualizer' ),
'enabled' => true,
Expand Down
122 changes: 122 additions & 0 deletions classes/Visualizer/Render/Sidebar/Type/GoogleCharts/Bubble.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?php

// +----------------------------------------------------------------------+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
// +----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License, version 2, as |
// | published by the Free Software Foundation. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
// | MA 02110-1301 USA |
// +----------------------------------------------------------------------+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
// +----------------------------------------------------------------------+
/**
* Class for area chart sidebar settings.
*
* @category Visualizer
* @package Render
* @subpackage Sidebar
*
* @since 1.0.0
*/
class Visualizer_Render_Sidebar_Type_GoogleCharts_Bubble extends Visualizer_Render_Sidebar_Linear {

/**
* Constructor.
*
* @since 1.0.0
*
* @access public
* @param array $data The data what has to be associated with this render.
*/
public function __construct( $data = array() ) {
parent::__construct( $data );
$this->_includeCurveTypes = false;
}

/**
* Renders template.
*
* @since 1.0.0
*
* @access protected
*/
protected function _toHTML() {
$this->_renderGeneralSettings();
$this->_renderAxesSettings();
$this->_renderBubbleSettings();
$this->_renderViewSettings();
$this->_renderAdvancedSettings();
}

/**
* Renders bubble settings items.
*
* @since 3.4.0
*
* @access protected
*/
protected function _renderBubbleSettings() {
self::_renderGroupStart( esc_html__( 'Bubble Settings', 'visualizer' ) );
self::_renderSectionStart();
self::_renderTextItem(
esc_html__( 'Opacity', 'visualizer' ),
'bubble[opacity]',
isset( $this->bubble['opacity'] ) ? $this->bubble['opacity'] : 0.8,
esc_html__( 'The default opacity of the bubbles, where 0.0 is fully transparent and 1.0 is fully opaque.', 'visualizer' ),
0.8,
'number',
array( 'min' => 0.0, 'max' => 1.0, 'step' => 0.1 )
);

self::_renderColorPickerItem(
esc_html__( 'Stroke Color', 'visualizer' ),
'bubble[stroke]',
isset( $this->bubble[ $index ]['stroke'] ) ? $this->bubble[ $index ]['stroke'] : null,
null
);

self::_renderCheckboxItem(
esc_html__( 'Sort Bubbles by Size', 'visualizer' ),
'sortBubblesBySize',
$this->sortBubblesBySize ? 1 : 0,
1,
esc_html__( 'If true, sorts the bubbles by size so the smaller bubbles appear above the larger bubbles. If false, bubbles are sorted according to their order in the DataTable.', 'visualizer' )
);

self::_renderTextItem(
esc_html__( 'Size (max)', 'visualizer' ),
'sizeAxis[maxValue]',
isset( $this->sizeAxis['maxValue'] ) ? $this->sizeAxis['maxValue'] : '',
esc_html__( 'The size value (as appears in the chart data) to be mapped to sizeAxis.maxSize. Larger values will be cropped to this value.', 'visualizer' ),
'',
'number',
array( 'step' => 1 )
);

self::_renderTextItem(
esc_html__( 'Size (min)', 'visualizer' ),
'sizeAxis[minValue]',
isset( $this->sizeAxis['minValue'] ) ? $this->sizeAxis['minValue'] : '',
esc_html__( 'The size value (as appears in the chart data) to be mapped to sizeAxis.minSize. Smaller values will be cropped to this value.', 'visualizer' ),
'',
'number',
array( 'step' => 1 )
);

self::_renderSectionEnd();
self::_renderGroupEnd();

}


}
8 changes: 6 additions & 2 deletions css/frame.css
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,14 @@ div.viz-group-content .viz-group-description {
padding: 15px;
border: 1px solid #e0e0e0;
background-color: white;
background-image: url(../images/chart_types_june2019_g.png);
background-image: url(../images/chart_types_v340_g.png);
background-repeat: no-repeat;
background-position: center center;
}

.type-label-selected,
.type-box > .type-label:hover {
background-image: url(../images/chart_types_june2019.png);
background-image: url(../images/chart_types_v340.png);
}

.type-box-area .type-label {
Expand Down Expand Up @@ -499,6 +499,10 @@ div.viz-group-content .viz-group-description {
background-position: -300px -225px;
}

.type-box-bubble .type-label {
background-position: -600px -906px;
}

.type-box-column .type-label {
background-position: -600px -225px;
}
Expand Down
Binary file removed images/chart_types_june2019.png
Binary file not shown.
Binary file removed images/chart_types_june2019_g.png
Binary file not shown.
Binary file added images/chart_types_v340.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 added images/chart_types_v340_g.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions js/render-google.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ var __visualizer_chart_images = [];
break;
case 'gauge':
break;
case 'bubble':
settings.sortBubblesBySize = settings.sortBubblesBySize ? settings.sortBubblesBySize == 1 : false; // jshint ignore:line
break;
case 'timeline':
settings['timeline'] = [];
settings['timeline']['groupByRowLabel'] = settings['groupByRowLabel'] ? true : false;
Expand Down Expand Up @@ -352,6 +355,7 @@ var __visualizer_chart_images = [];
case 'candlestick':
case 'histogram':
case 'scatter':
case 'bubble':
$type = 'corechart';
break;
case 'geo':
Expand Down
12 changes: 12 additions & 0 deletions samples/bubble.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ID, Life Expectancy, Fertility Rate, Region, Population
string,number,number,string,number
CAN, 80.66, 1.67, North America, 33739900
DEU, 79.84, 1.36, Europe, 81902307
DNK, 78.6, 1.84, Europe, 5523095
RUS, 68.6, 1.54, Europe, 141850000
EGY, 72.73, 2.78, Middle East, 79716203
GBR, 80.05, 2, Europe, 61801570
IRN, 72.49, 1.7, Middle East, 73137148
IRQ, 68.09, 4.77, Middle East, 31090763
ISR, 81.55, 2.96, Middle East, 7485600
USA, 78.09, 2.05, North America, 307007000