Skip to content

Commit 1ce8ba3

Browse files
authored
Merge pull request #96 from Codeinwp/development
Fixed responsive issue Fixed no axis color for line and bar charts
2 parents b29b407 + b993e33 commit 1ce8ba3

File tree

11 files changed

+113
-15
lines changed

11 files changed

+113
-15
lines changed

classes/Visualizer/Module/Frontend.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ public function renderChart( $atts ) {
110110
}
111111

112112
$id = 'visualizer-' . $atts['id'];
113+
$defaultClass = "visualizer-front";
113114
$class = apply_filters( Visualizer_Plugin::FILTER_CHART_WRAPPER_CLASS, $atts['class'], $atts['id'] );
114-
$class = !empty( $class ) ? ' class="' . $class . '"' : '';
115+
$class = $defaultClass . " " . $class;
116+
$class = !empty( $class ) ? ' class="' . trim($class) . '"' : '';
115117

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

classes/Visualizer/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
class Visualizer_Plugin {
3131

3232
const NAME = 'visualizer';
33-
const VERSION = '1.6.0';
33+
const VERSION = '1.6.5';
3434

3535
// custom post types
3636
const CPT_VISUALIZER = 'visualizer';

classes/Visualizer/Render/Sidebar/Columnar.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,39 @@ protected function _renderColumnarSettings() {
7878
self::_renderGroupEnd();
7979
}
8080

81+
82+
/**
83+
* Renders general settings block for vertical axis settings.
84+
*
85+
* @since 1.4.0
86+
*
87+
* @access protected
88+
*/
89+
protected function _renderVerticalAxisGeneralSettings() {
90+
parent::_renderVerticalAxisGeneralSettings();
91+
self::_renderColorPickerItem(
92+
esc_html__( 'Axis Text Color', Visualizer_Plugin::NAME ),
93+
'hAxis[textStyle]',
94+
isset( $this->hAxis['textStyle'] ) ? $this->hAxis['textStyle'] : null,
95+
'#000'
96+
);
97+
}
98+
99+
/**
100+
* Renders general settings block for vertical axis settings.
101+
*
102+
* @since 1.4.0
103+
*
104+
* @access protected
105+
*/
106+
protected function _renderHorizontalAxisGeneralSettings() {
107+
parent::_renderHorizontalAxisGeneralSettings();
108+
self::_renderColorPickerItem(
109+
esc_html__( 'Axis Text Color', Visualizer_Plugin::NAME ),
110+
'vAxis[textStyle]',
111+
isset( $this->vAxis['textStyle'] ) ? $this->vAxis['textStyle'] : null,
112+
'#000'
113+
);
114+
}
115+
81116
}

classes/Visualizer/Render/Sidebar/Graph.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ protected function _renderChartTitleSettings() {
133133
*
134134
* @access protected
135135
*/
136-
protected function _renderHorizontalAxisGeneratSettings() {
136+
protected function _renderHorizontalAxisGeneralSettings() {
137137
self::_renderTextItem(
138138
esc_html__( 'Axis Title', Visualizer_Plugin::NAME ),
139139
'hAxis[title]',
@@ -179,7 +179,7 @@ protected function _renderHorizontalAxisGeneratSettings() {
179179
protected function _renderHorizontalAxisSettings() {
180180
self::_renderGroupStart( esc_html__( 'Horizontal Axis Settings', Visualizer_Plugin::NAME ) );
181181
self::_renderSectionStart( esc_html__( 'General Settings', Visualizer_Plugin::NAME ), false );
182-
$this->_renderHorizontalAxisGeneratSettings();
182+
$this->_renderHorizontalAxisGeneralSettings();
183183
self::_renderSectionEnd();
184184

185185
if ( $this->_horizontalGridLines ) {

classes/Visualizer/Render/Sidebar/Linear.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,16 @@ public function __construct( $data = array() ) {
9191
*
9292
* @access protected
9393
*/
94-
protected function _renderHorizontalAxisGeneratSettings() {
95-
parent::_renderHorizontalAxisGeneratSettings();
94+
protected function _renderHorizontalAxisGeneralSettings() {
95+
parent::_renderHorizontalAxisGeneralSettings();
96+
97+
self::_renderColorPickerItem(
98+
esc_html__( 'Axis Text Color', Visualizer_Plugin::NAME ),
99+
'vAxis[textStyle]',
100+
isset( $this->vAxis['textStyle'] ) ? $this->vAxis['textStyle'] : null,
101+
'#000'
102+
);
103+
96104
$this->_renderHorizontalAxisFormatField();
97105
}
98106

@@ -105,6 +113,14 @@ protected function _renderHorizontalAxisGeneratSettings() {
105113
*/
106114
protected function _renderVerticalAxisGeneralSettings() {
107115
parent::_renderVerticalAxisGeneralSettings();
116+
117+
self::_renderColorPickerItem(
118+
esc_html__( 'Axis Text Color', Visualizer_Plugin::NAME ),
119+
'hAxis[textStyle]',
120+
isset( $this->hAxis['textStyle'] ) ? $this->hAxis['textStyle'] : null,
121+
'#000'
122+
);
123+
108124
$this->_renderVerticalAxisFormatField();
109125
}
110126

classes/Visualizer/Render/Sidebar/Type/Bar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public function __construct( $data = array( ) ) {
5454
*
5555
* @access protected
5656
*/
57-
protected function _renderHorizontalAxisGeneratSettings() {
58-
parent::_renderHorizontalAxisGeneratSettings();
57+
protected function _renderHorizontalAxisGeneralSettings() {
58+
parent::_renderHorizontalAxisGeneralSettings();
5959
$this->_renderHorizontalAxisFormatField();
6060
}
6161

css/media.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Version: 1.5.6
2+
Version: 1.6.5
33
*/
44
#visualizer-library-view {
55
padding: 30px 10px 10px 30px;

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Plugin Name: Visualizer: Charts and Graphs Lite
44
Plugin URI: https://themeisle.com/plugins/visualizer-charts-and-graphs-lite/
55
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.
6-
Version: 1.6.0
6+
Version: 1.6.5
77
Author: Themeisle
88
Author URI: http://themeisle.com
99
License: GPL v2.0 or later

js/library.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@
9898
a.href = url;
9999
a.download = data.data.name;
100100
a.click();
101-
window.URL.revokeObjectURL(url);
101+
setTimeout(function(){
102+
window.URL.revokeObjectURL(url);
103+
}, 100);
102104
}
103105
});
104106
return false;

js/render.js

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,18 @@
132132
}
133133
}
134134

135+
if(settings.hAxis){
136+
if(settings.hAxis.textStyle && settings.hAxis.textStyle != ''){
137+
settings.hAxis.textStyle = {color: settings.hAxis.textStyle};
138+
}
139+
}
140+
141+
if(settings.vAxis){
142+
if(settings.vAxis.textStyle && settings.vAxis.textStyle != ''){
143+
settings.vAxis.textStyle = {color: settings.vAxis.textStyle};
144+
}
145+
}
146+
135147
for (i = 0; i < data.length; i++) {
136148
row = [];
137149
for (j = 0; j < series.length; j++) {
@@ -198,5 +210,31 @@
198210
clearTimeout(resizeTimeout);
199211
resizeTimeout = setTimeout(v.render, 100);
200212
});
201-
});
213+
214+
resizeHiddenContainers();
215+
});
216+
217+
function resizeHiddenContainers(){
218+
$(".visualizer-front").parents().each(function(){
219+
if(!$(this).is(":visible")){
220+
$(this).addClass("visualizer-hidden-container");
221+
}
222+
});
223+
224+
var mutateObserver = new MutationObserver(function(records) {
225+
records.forEach(function(record) {
226+
if(record.attributeName == "style"){
227+
var element = $(record.target);
228+
var displayStyle = window.getComputedStyle(element[0]).getPropertyValue("display");
229+
if(element.hasClass("visualizer-hidden-container-resized") || displayStyle == "none") return;
230+
element.addClass("visualizer-hidden-container-resized").find(".visualizer-front").resize();
231+
}
232+
});
233+
});
234+
235+
$('.visualizer-hidden-container').each(function(){
236+
mutateObserver.observe($(this)[0], {attributes: true});
237+
});
238+
}
239+
202240
})(jQuery, visualizer);

0 commit comments

Comments
 (0)