Skip to content

Commit

Permalink
Merge pull request #96 from Codeinwp/development
Browse files Browse the repository at this point in the history
Fixed responsive issue 
Fixed no axis color for line and bar charts
  • Loading branch information
selul authored Sep 9, 2016
2 parents b29b407 + b993e33 commit 1ce8ba3
Show file tree
Hide file tree
Showing 11 changed files with 113 additions and 15 deletions.
4 changes: 3 additions & 1 deletion classes/Visualizer/Module/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ public function renderChart( $atts ) {
}

$id = 'visualizer-' . $atts['id'];
$defaultClass = "visualizer-front";
$class = apply_filters( Visualizer_Plugin::FILTER_CHART_WRAPPER_CLASS, $atts['class'], $atts['id'] );
$class = !empty( $class ) ? ' class="' . $class . '"' : '';
$class = $defaultClass . " " . $class;
$class = !empty( $class ) ? ' class="' . trim($class) . '"' : '';

$type = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );

Expand Down
2 changes: 1 addition & 1 deletion classes/Visualizer/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class Visualizer_Plugin {

const NAME = 'visualizer';
const VERSION = '1.6.0';
const VERSION = '1.6.5';

// custom post types
const CPT_VISUALIZER = 'visualizer';
Expand Down
35 changes: 35 additions & 0 deletions classes/Visualizer/Render/Sidebar/Columnar.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,39 @@ protected function _renderColumnarSettings() {
self::_renderGroupEnd();
}


/**
* Renders general settings block for vertical axis settings.
*
* @since 1.4.0
*
* @access protected
*/
protected function _renderVerticalAxisGeneralSettings() {
parent::_renderVerticalAxisGeneralSettings();
self::_renderColorPickerItem(
esc_html__( 'Axis Text Color', Visualizer_Plugin::NAME ),
'hAxis[textStyle]',
isset( $this->hAxis['textStyle'] ) ? $this->hAxis['textStyle'] : null,
'#000'
);
}

/**
* Renders general settings block for vertical axis settings.
*
* @since 1.4.0
*
* @access protected
*/
protected function _renderHorizontalAxisGeneralSettings() {
parent::_renderHorizontalAxisGeneralSettings();
self::_renderColorPickerItem(
esc_html__( 'Axis Text Color', Visualizer_Plugin::NAME ),
'vAxis[textStyle]',
isset( $this->vAxis['textStyle'] ) ? $this->vAxis['textStyle'] : null,
'#000'
);
}

}
4 changes: 2 additions & 2 deletions classes/Visualizer/Render/Sidebar/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ protected function _renderChartTitleSettings() {
*
* @access protected
*/
protected function _renderHorizontalAxisGeneratSettings() {
protected function _renderHorizontalAxisGeneralSettings() {
self::_renderTextItem(
esc_html__( 'Axis Title', Visualizer_Plugin::NAME ),
'hAxis[title]',
Expand Down Expand Up @@ -179,7 +179,7 @@ protected function _renderHorizontalAxisGeneratSettings() {
protected function _renderHorizontalAxisSettings() {
self::_renderGroupStart( esc_html__( 'Horizontal Axis Settings', Visualizer_Plugin::NAME ) );
self::_renderSectionStart( esc_html__( 'General Settings', Visualizer_Plugin::NAME ), false );
$this->_renderHorizontalAxisGeneratSettings();
$this->_renderHorizontalAxisGeneralSettings();
self::_renderSectionEnd();

if ( $this->_horizontalGridLines ) {
Expand Down
20 changes: 18 additions & 2 deletions classes/Visualizer/Render/Sidebar/Linear.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,16 @@ public function __construct( $data = array() ) {
*
* @access protected
*/
protected function _renderHorizontalAxisGeneratSettings() {
parent::_renderHorizontalAxisGeneratSettings();
protected function _renderHorizontalAxisGeneralSettings() {
parent::_renderHorizontalAxisGeneralSettings();

self::_renderColorPickerItem(
esc_html__( 'Axis Text Color', Visualizer_Plugin::NAME ),
'vAxis[textStyle]',
isset( $this->vAxis['textStyle'] ) ? $this->vAxis['textStyle'] : null,
'#000'
);

$this->_renderHorizontalAxisFormatField();
}

Expand All @@ -105,6 +113,14 @@ protected function _renderHorizontalAxisGeneratSettings() {
*/
protected function _renderVerticalAxisGeneralSettings() {
parent::_renderVerticalAxisGeneralSettings();

self::_renderColorPickerItem(
esc_html__( 'Axis Text Color', Visualizer_Plugin::NAME ),
'hAxis[textStyle]',
isset( $this->hAxis['textStyle'] ) ? $this->hAxis['textStyle'] : null,
'#000'
);

$this->_renderVerticalAxisFormatField();
}

Expand Down
4 changes: 2 additions & 2 deletions classes/Visualizer/Render/Sidebar/Type/Bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public function __construct( $data = array( ) ) {
*
* @access protected
*/
protected function _renderHorizontalAxisGeneratSettings() {
parent::_renderHorizontalAxisGeneratSettings();
protected function _renderHorizontalAxisGeneralSettings() {
parent::_renderHorizontalAxisGeneralSettings();
$this->_renderHorizontalAxisFormatField();
}

Expand Down
2 changes: 1 addition & 1 deletion css/media.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Version: 1.5.6
Version: 1.6.5
*/
#visualizer-library-view {
padding: 30px 10px 10px 30px;
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Visualizer: Charts and Graphs Lite
Plugin URI: https://themeisle.com/plugins/visualizer-charts-and-graphs-lite/
Description: A simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages. The plugin uses Google Visualization API to render charts, which supports cross-browser compatibility (adopting VML for older IE versions) and cross-platform portability to iOS and new Android releases.
Version: 1.6.0
Version: 1.6.5
Author: Themeisle
Author URI: http://themeisle.com
License: GPL v2.0 or later
Expand Down
4 changes: 3 additions & 1 deletion js/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@
a.href = url;
a.download = data.data.name;
a.click();
window.URL.revokeObjectURL(url);
setTimeout(function(){
window.URL.revokeObjectURL(url);
}, 100);
}
});
return false;
Expand Down
40 changes: 39 additions & 1 deletion js/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@
}
}

if(settings.hAxis){
if(settings.hAxis.textStyle && settings.hAxis.textStyle != ''){
settings.hAxis.textStyle = {color: settings.hAxis.textStyle};
}
}

if(settings.vAxis){
if(settings.vAxis.textStyle && settings.vAxis.textStyle != ''){
settings.vAxis.textStyle = {color: settings.vAxis.textStyle};
}
}

for (i = 0; i < data.length; i++) {
row = [];
for (j = 0; j < series.length; j++) {
Expand Down Expand Up @@ -198,5 +210,31 @@
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(v.render, 100);
});
});

resizeHiddenContainers();
});

function resizeHiddenContainers(){
$(".visualizer-front").parents().each(function(){
if(!$(this).is(":visible")){
$(this).addClass("visualizer-hidden-container");
}
});

var mutateObserver = new MutationObserver(function(records) {
records.forEach(function(record) {
if(record.attributeName == "style"){
var element = $(record.target);
var displayStyle = window.getComputedStyle(element[0]).getPropertyValue("display");
if(element.hasClass("visualizer-hidden-container-resized") || displayStyle == "none") return;
element.addClass("visualizer-hidden-container-resized").find(".visualizer-front").resize();
}
});
});

$('.visualizer-hidden-container').each(function(){
mutateObserver.observe($(this)[0], {attributes: true});
});
}

})(jQuery, visualizer);
11 changes: 8 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: codeinwp,marius2012,marius_codeinwp,hardeepasrani,themeisle,Madalin_ThemeIsle
Tags: chart, charts, charting, graph, graphs, graphing, visualisation, visualise data, visualization, visualize data, HTML5, canvas, pie chart, line chart, bar chart, column chart, gauge chart, area chart, scatter chart, candlestick chart, geo chart, google visualization api
Requires at least: 3.5
Tested up to: 4.6
Tested up to: 4.6.1
Stable tag: trunk
License: GPL v2.0 or later
License URI: http://www.opensource.org/licenses/gpl-license.php
Expand All @@ -11,7 +11,7 @@ A simple and quite powerful WordPress chart plugin to create, manage and embed i

== Description ==

<a href="http://themeisle.com/plugins/visualizer-charts-and-graphs-lite/" rel="friend">WordPress Visualizer plugin</a> is a simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages.
<a href="http://themeisle.com/plugins/visualizer-charts-and-graphs-lite/" rel="nofollow">WordPress Visualizer plugin</a> is a simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages.

The plugin uses Google Visualization API to add charts, which support cross-browser compatibility (adopting VML for older IE versions) and cross-platform portability to iOS and new Android releases.

Expand All @@ -37,7 +37,7 @@ Charts are rendered using HTML5/SVG technology to provide cross-browser compatib

*above descriptions were partially taken from Google Visualization API site*

The plugins works perfectly with the all <a href="http://justfreethemes.com" rel="friend">free</a> or <a href="http://www.codeinwp.com/blog/best-wordpress-themes/" rel="friend">premium WordPress themes</a>
The plugins works perfectly with the all <a href="http://justfreethemes.com" rel="nofollow">free</a> or <a href="http://www.codeinwp.com/blog/best-wordpress-themes/" rel="nofollow">premium WordPress themes</a>

### Knowledge Base ###

Expand Down Expand Up @@ -70,6 +70,11 @@ Pay attention that to turn your shortcodes into graphs, your theme has to have `

== Changelog ==

= 1.6.5=
* Fixed responsive issue
* Fixed no axis text color for line and bar charts


= 1.6.0 =
* Fixed security issue when importing charts
* Removed pointer for the pro version
Expand Down

0 comments on commit 1ce8ba3

Please sign in to comment.