Version Description
- The first version of the plugin was implemented.
=
Download this release
Release Info
Developer | madpixels |
Plugin | WordPress Charts and Graphs Lite |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- classes/Visualizer/Module.php +145 -0
- classes/Visualizer/Module/Admin.php +355 -0
- classes/Visualizer/Module/Chart.php +470 -0
- classes/Visualizer/Module/Frontend.php +118 -0
- classes/Visualizer/Module/Setup.php +76 -0
- classes/Visualizer/Plugin.php +159 -0
- classes/Visualizer/Render.php +155 -0
- classes/Visualizer/Render/Library.php +153 -0
- classes/Visualizer/Render/Page.php +93 -0
- classes/Visualizer/Render/Page/Data.php +97 -0
- classes/Visualizer/Render/Page/Send.php +58 -0
- classes/Visualizer/Render/Page/Settings.php +85 -0
- classes/Visualizer/Render/Page/Types.php +87 -0
- classes/Visualizer/Render/Page/Update.php +65 -0
- classes/Visualizer/Render/Sidebar.php +455 -0
- classes/Visualizer/Render/Sidebar/Columnar.php +57 -0
- classes/Visualizer/Render/Sidebar/Graph.php +280 -0
- classes/Visualizer/Render/Sidebar/Linear.php +206 -0
- classes/Visualizer/Render/Sidebar/Type/Area.php +82 -0
- classes/Visualizer/Render/Sidebar/Type/Bar.php +65 -0
- classes/Visualizer/Render/Sidebar/Type/Candlestick.php +152 -0
- classes/Visualizer/Render/Sidebar/Type/Column.php +65 -0
- classes/Visualizer/Render/Sidebar/Type/Gauge.php +254 -0
- classes/Visualizer/Render/Sidebar/Type/Geo.php +360 -0
- classes/Visualizer/Render/Sidebar/Type/Line.php +50 -0
- classes/Visualizer/Render/Sidebar/Type/Pie.php +158 -0
- classes/Visualizer/Render/Sidebar/Type/Scatter.php +65 -0
- classes/Visualizer/Render/Templates.php +113 -0
- classes/Visualizer/Security.php +81 -0
- classes/Visualizer/Source.php +146 -0
- classes/Visualizer/Source/Csv.php +128 -0
- css/frame.css +394 -0
- css/library.css +140 -0
- css/media.css +152 -0
- humans.txt +12 -0
- images/ajax-loader.gif +0 -0
- images/chart_types.png +0 -0
- images/chart_types_g.png +0 -0
- images/icon.png +0 -0
- images/notfound.png +0 -0
- images/ui-icons.png +0 -0
- index.php +105 -0
- js/frame.js +88 -0
- js/library.js +91 -0
- js/media.js +58 -0
- js/media/collection.js +19 -0
- js/media/controller.js +19 -0
- js/media/model.js +20 -0
- js/media/toolbar.js +36 -0
- js/media/view.js +433 -0
- js/preview.js +84 -0
- js/render.js +103 -0
- languages/visualizer-en_US.mo +0 -0
- languages/visualizer-en_US.po +878 -0
- readme.txt +62 -0
- samples/area.csv +7 -0
- samples/bar.csv +8 -0
- samples/candlestick.csv +7 -0
- samples/column.csv +9 -0
- samples/gauge.csv +5 -0
- samples/geo.csv +8 -0
- samples/line.csv +16 -0
- samples/pie.csv +7 -0
- samples/scatter.csv +8 -0
classes/Visualizer/Module.php
ADDED
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Base class for all modules. Implements routine methods required by all modules.
|
25 |
+
*
|
26 |
+
* @category Visualizer
|
27 |
+
* @package Module
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
*/
|
31 |
+
class Visualizer_Module {
|
32 |
+
|
33 |
+
/**
|
34 |
+
* The instance of wpdb class.
|
35 |
+
*
|
36 |
+
* @since 1.0.0
|
37 |
+
*
|
38 |
+
* @access protected
|
39 |
+
* @var wpdb
|
40 |
+
*/
|
41 |
+
protected $_wpdb = null;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* The plugin instance.
|
45 |
+
*
|
46 |
+
* @since 1.0.0
|
47 |
+
*
|
48 |
+
* @access protected
|
49 |
+
* @var Visualizer_Plugin
|
50 |
+
*/
|
51 |
+
protected $_plugin = null;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Constructor.
|
55 |
+
*
|
56 |
+
* @since 1.0.0
|
57 |
+
* @global wpdb $wpdb Current database connection.
|
58 |
+
*
|
59 |
+
* @access public
|
60 |
+
* @param Visualizer_Plugin $plugin The instance of the plugin.
|
61 |
+
*/
|
62 |
+
public function __construct( Visualizer_Plugin $plugin ) {
|
63 |
+
global $wpdb;
|
64 |
+
|
65 |
+
$this->_wpdb = $wpdb;
|
66 |
+
$this->_plugin = $plugin;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Registers an action hook.
|
71 |
+
*
|
72 |
+
* @since 1.0.0
|
73 |
+
* @uses add_action() To register action hook.
|
74 |
+
*
|
75 |
+
* @access protected
|
76 |
+
* @param string $tag The name of the action to which the $method is hooked.
|
77 |
+
* @param string $method The name of the method to be called.
|
78 |
+
* @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
|
79 |
+
* @param int $accepted_args optional. The number of arguments the function accept (default 1).
|
80 |
+
* @return Visualizer_Module
|
81 |
+
*/
|
82 |
+
protected function _addAction( $tag, $method, $priority = 10, $accepted_args = 1 ) {
|
83 |
+
add_action( $tag, array( $this, $method ), $priority, $accepted_args );
|
84 |
+
return $this;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Registers AJAX action hook.
|
89 |
+
*
|
90 |
+
* @since 1.0.0
|
91 |
+
*
|
92 |
+
* @access public
|
93 |
+
* @param string $tag The name of the AJAX action to which the $method is hooked.
|
94 |
+
* @param string $method Optional. The name of the method to be called. If the name of the method is not provided, tag name will be used as method name.
|
95 |
+
* @param boolean $private Optional. Determines if we should register hook for logged in users.
|
96 |
+
* @param boolean $public Optional. Determines if we should register hook for not logged in users.
|
97 |
+
* @return Visualizer_Module
|
98 |
+
*/
|
99 |
+
protected function _addAjaxAction( $tag, $method = '', $private = true, $public = false ) {
|
100 |
+
if ( $private ) {
|
101 |
+
$this->_addAction( 'wp_ajax_' . $tag, $method );
|
102 |
+
}
|
103 |
+
|
104 |
+
if ( $public ) {
|
105 |
+
$this->_addAction( 'wp_ajax_nopriv_' . $tag, $method );
|
106 |
+
}
|
107 |
+
|
108 |
+
return $this;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Registers a filter hook.
|
113 |
+
*
|
114 |
+
* @since 1.0.0
|
115 |
+
* @uses add_filter() To register filter hook.
|
116 |
+
*
|
117 |
+
* @access protected
|
118 |
+
* @param string $tag The name of the filter to hook the $method to.
|
119 |
+
* @param type $method The name of the method to be called when the filter is applied.
|
120 |
+
* @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
|
121 |
+
* @param int $accepted_args optional. The number of arguments the function accept (default 1).
|
122 |
+
* @return Visualizer_Module
|
123 |
+
*/
|
124 |
+
protected function _addFilter( $tag, $method, $priority = 10, $accepted_args = 1 ) {
|
125 |
+
add_filter( $tag, array( $this, $method ), $priority, $accepted_args );
|
126 |
+
return $this;
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Registers a hook for shortcode tag.
|
131 |
+
*
|
132 |
+
* @since 1.0.0
|
133 |
+
* @uses add_shortcode() To register shortcode hook.
|
134 |
+
*
|
135 |
+
* @access protected
|
136 |
+
* @param string $tag Shortcode tag to be searched in post content.
|
137 |
+
* @param string $method Hook to run when shortcode is found.
|
138 |
+
* @return Visualizer_Module
|
139 |
+
*/
|
140 |
+
protected function _addShortcode( $tag, $method ) {
|
141 |
+
add_shortcode( $tag, array( $this, $method ) );
|
142 |
+
return $this;
|
143 |
+
}
|
144 |
+
|
145 |
+
}
|
classes/Visualizer/Module/Admin.php
ADDED
@@ -0,0 +1,355 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* The module for all admin stuff.
|
25 |
+
*
|
26 |
+
* @category Visualizer
|
27 |
+
* @package Module
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
*/
|
31 |
+
class Visualizer_Module_Admin extends Visualizer_Module {
|
32 |
+
|
33 |
+
const NAME = __CLASS__;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Library page suffix.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
*
|
40 |
+
* @access private
|
41 |
+
* @var string
|
42 |
+
*/
|
43 |
+
private $_libraryPage;
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Constructor.
|
47 |
+
*
|
48 |
+
* @since 1.0.0
|
49 |
+
*
|
50 |
+
* @access public
|
51 |
+
* @param Visualizer_Plugin $plugin The instance of the plugin.
|
52 |
+
*/
|
53 |
+
public function __construct( Visualizer_Plugin $plugin ) {
|
54 |
+
parent::__construct( $plugin );
|
55 |
+
|
56 |
+
$this->_addAction( 'load-post.php', 'enqueueMediaScripts' );
|
57 |
+
$this->_addAction( 'load-post-new.php', 'enqueueMediaScripts' );
|
58 |
+
$this->_addAction( 'admin_footer', 'renderTempaltes' );
|
59 |
+
$this->_addAction( 'admin_enqueue_scripts', 'enqueueLibraryScripts' );
|
60 |
+
$this->_addAction( 'admin_menu', 'registerAdminMenu' );
|
61 |
+
|
62 |
+
$this->_addFilter( 'media_view_strings', 'setupMediaViewStrings' );
|
63 |
+
$this->_addFilter( 'plugin_action_links', 'getPluginActionLinks', 10, 2 );
|
64 |
+
$this->_addFilter( 'plugin_row_meta', 'getPluginMetaLinks', 10, 2 );
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Returns associated array of chart types and localized names.
|
69 |
+
*
|
70 |
+
* @since 1.0.0
|
71 |
+
*
|
72 |
+
* @static
|
73 |
+
* @access private
|
74 |
+
* @return array The associated array of chart types with localized names.
|
75 |
+
*/
|
76 |
+
private static function _getChartTypesLocalized() {
|
77 |
+
return array(
|
78 |
+
'all' => esc_html__( 'All', Visualizer_Plugin::NAME ),
|
79 |
+
'pie' => esc_html__( 'Pie', Visualizer_Plugin::NAME ),
|
80 |
+
'line' => esc_html__( 'Line', Visualizer_Plugin::NAME ),
|
81 |
+
'area' => esc_html__( 'Area', Visualizer_Plugin::NAME ),
|
82 |
+
'geo' => esc_html__( 'Geo', Visualizer_Plugin::NAME ),
|
83 |
+
'bar' => esc_html__( 'Bar', Visualizer_Plugin::NAME ),
|
84 |
+
'column' => esc_html__( 'Column', Visualizer_Plugin::NAME ),
|
85 |
+
'gauge' => esc_html__( 'Gauge', Visualizer_Plugin::NAME ),
|
86 |
+
'scatter' => esc_html__( 'Scatter', Visualizer_Plugin::NAME ),
|
87 |
+
'candlestick' => esc_html__( 'Candelstick', Visualizer_Plugin::NAME ),
|
88 |
+
);
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Enqueues media scripts and styles.
|
93 |
+
*
|
94 |
+
* @since 1.0.0
|
95 |
+
* @uses wp_enqueue_style To enqueue style file.
|
96 |
+
* @uses wp_enqueue_script To enqueue script file.
|
97 |
+
*
|
98 |
+
* @access public
|
99 |
+
*/
|
100 |
+
public function enqueueMediaScripts() {
|
101 |
+
wp_enqueue_style( 'visualizer-media', VISUALIZER_ABSURL . 'css/media.css', array( 'media-views' ), Visualizer_Plugin::VERSION );
|
102 |
+
|
103 |
+
wp_enqueue_script( 'google-jsapi', '//www.google.com/jsapi', array( 'media-editor' ), null );
|
104 |
+
wp_enqueue_script( 'visualizer-media-model', VISUALIZER_ABSURL . 'js/media/model.js', array( 'google-jsapi' ), Visualizer_Plugin::VERSION );
|
105 |
+
wp_enqueue_script( 'visualizer-media-collection', VISUALIZER_ABSURL . 'js/media/collection.js', array( 'visualizer-media-model' ), Visualizer_Plugin::VERSION );
|
106 |
+
wp_enqueue_script( 'visualizer-media-controller', VISUALIZER_ABSURL . 'js/media/controller.js', array( 'visualizer-media-collection' ), Visualizer_Plugin::VERSION );
|
107 |
+
wp_enqueue_script( 'visualizer-media-view', VISUALIZER_ABSURL . 'js/media/view.js', array( 'visualizer-media-controller' ), Visualizer_Plugin::VERSION );
|
108 |
+
wp_enqueue_script( 'visualizer-media-toolbar', VISUALIZER_ABSURL . 'js/media/toolbar.js', array( 'visualizer-media-view' ), Visualizer_Plugin::VERSION );
|
109 |
+
wp_enqueue_script( 'visualizer-media', VISUALIZER_ABSURL . 'js/media.js', array( 'visualizer-media-toolbar' ), Visualizer_Plugin::VERSION );
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Extends media view strings with visualizer strings.
|
114 |
+
*
|
115 |
+
* @since 1.0.0
|
116 |
+
*
|
117 |
+
* @access public
|
118 |
+
* @param array $strings The array of media view strings.
|
119 |
+
* @return array The extended array of media view strings.
|
120 |
+
*/
|
121 |
+
public function setupMediaViewStrings( $strings ) {
|
122 |
+
$strings['visualizer'] = array(
|
123 |
+
'actions' => array(
|
124 |
+
'get_charts' => Visualizer_Plugin::ACTION_GET_CHARTS,
|
125 |
+
'delete_chart' => Visualizer_Plugin::ACTION_DELETE_CHART,
|
126 |
+
),
|
127 |
+
'controller' => array(
|
128 |
+
'title' => esc_html__( 'Visualizations', Visualizer_Plugin::NAME ),
|
129 |
+
),
|
130 |
+
'routers' => array(
|
131 |
+
'library' => esc_html__( 'From Library', Visualizer_Plugin::NAME ),
|
132 |
+
'create' => esc_html__( 'Create New', Visualizer_Plugin::NAME ),
|
133 |
+
),
|
134 |
+
'library' => array(
|
135 |
+
'filters' => self::_getChartTypesLocalized(),
|
136 |
+
),
|
137 |
+
'nonce' => Visualizer_Security::createNonce(),
|
138 |
+
'buildurl' => add_query_arg( 'action', Visualizer_Plugin::ACTION_CREATE_CHART, admin_url( 'admin-ajax.php' ) ),
|
139 |
+
);
|
140 |
+
|
141 |
+
return $strings;
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Renders templates to use in media popup.
|
146 |
+
*
|
147 |
+
* @since 1.0.0
|
148 |
+
* @global string $pagenow The name of the current page.
|
149 |
+
*
|
150 |
+
* @access public
|
151 |
+
*/
|
152 |
+
public function renderTempaltes() {
|
153 |
+
global $pagenow;
|
154 |
+
|
155 |
+
if ( 'post.php' != $pagenow && 'post-new.php' != $pagenow ) {
|
156 |
+
return;
|
157 |
+
}
|
158 |
+
|
159 |
+
$render = new Visualizer_Render_Templates();
|
160 |
+
$render->render();
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Enqueues library scripts and styles.
|
165 |
+
*
|
166 |
+
* @since 1.0.0
|
167 |
+
* @uses wp_enqueue_style() To enqueue library stylesheet.
|
168 |
+
* @uses wp_enqueue_script() To enqueue javascript file.
|
169 |
+
* @uses wp_enqueue_media() To enqueue media stuff.
|
170 |
+
*
|
171 |
+
* @access public
|
172 |
+
* @param string $suffix The current page suffix.
|
173 |
+
*/
|
174 |
+
public function enqueueLibraryScripts( $suffix ) {
|
175 |
+
if ( $suffix == $this->_libraryPage ) {
|
176 |
+
wp_enqueue_style( 'visualizer-library', VISUALIZER_ABSURL . 'css/library.css', array(), Visualizer_Plugin::VERSION );
|
177 |
+
|
178 |
+
$this->_addFilter( 'media_upload_tabs', 'setupVisualizerTab' );
|
179 |
+
|
180 |
+
wp_enqueue_media();
|
181 |
+
wp_enqueue_script( 'visualizer-library', VISUALIZER_ABSURL . 'js/library.js', array( 'jquery', 'media-views' ), Visualizer_Plugin::VERSION, true );
|
182 |
+
wp_enqueue_script( 'google-jsapi', '//www.google.com/jsapi', array(), null, true );
|
183 |
+
wp_enqueue_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( 'google-jsapi', 'visualizer-library' ), Visualizer_Plugin::VERSION, true );
|
184 |
+
}
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Adds visualizer tab for media upload tabs array.
|
189 |
+
*
|
190 |
+
* @since 1.0.0
|
191 |
+
*
|
192 |
+
* @access public
|
193 |
+
* @param array $tabs The array of media upload tabs.
|
194 |
+
* @return array Extended array of media upload tabs.
|
195 |
+
*/
|
196 |
+
public function setupVisualizerTab( $tabs ) {
|
197 |
+
$tabs['visualizer'] = 'Visualizer';
|
198 |
+
return $tabs;
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Registers admin menu for visualizer library.
|
203 |
+
*
|
204 |
+
* @since 1.0.0
|
205 |
+
*
|
206 |
+
* @access public
|
207 |
+
*/
|
208 |
+
public function registerAdminMenu() {
|
209 |
+
$title = esc_html__( 'Visualizer Library', Visualizer_Plugin::NAME );
|
210 |
+
$callback = array( $this, 'renderLibraryPage' );
|
211 |
+
$this->_libraryPage = add_submenu_page( 'upload.php', $title, $title, 'edit_posts', Visualizer_Plugin::NAME, $callback );
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Renders visualizer library page.
|
216 |
+
*
|
217 |
+
* @since 1.0.0
|
218 |
+
*
|
219 |
+
* @access public
|
220 |
+
*/
|
221 |
+
public function renderLibraryPage() {
|
222 |
+
// get current page
|
223 |
+
$page = filter_input( INPUT_GET, 'vpage', FILTER_VALIDATE_INT, array(
|
224 |
+
'options' => array(
|
225 |
+
'min_range' => 1,
|
226 |
+
'default' => 1,
|
227 |
+
)
|
228 |
+
) );
|
229 |
+
|
230 |
+
// the initial query arguments to fetch charts
|
231 |
+
$query_args = array(
|
232 |
+
'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
|
233 |
+
'posts_per_page' => 6,
|
234 |
+
'paged' => $page,
|
235 |
+
);
|
236 |
+
|
237 |
+
// add chart type filter to the query arguments
|
238 |
+
$type = filter_input( INPUT_GET, 'type' );
|
239 |
+
if ( $type && in_array( $type, Visualizer_Plugin::getChartTypes() ) ) {
|
240 |
+
$query_args['meta_query'] = array(
|
241 |
+
array(
|
242 |
+
'key' => Visualizer_Plugin::CF_CHART_TYPE,
|
243 |
+
'value' => $type,
|
244 |
+
'compare' => '=',
|
245 |
+
),
|
246 |
+
);
|
247 |
+
} else {
|
248 |
+
$type = 'all';
|
249 |
+
}
|
250 |
+
|
251 |
+
// fetch charts
|
252 |
+
$charts = array();
|
253 |
+
$query = new WP_Query( $query_args );
|
254 |
+
while( $query->have_posts() ) {
|
255 |
+
$chart = $query->next_post();
|
256 |
+
|
257 |
+
// faetch and update settings
|
258 |
+
$settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true );
|
259 |
+
unset( $settings['height'], $settings['width'] );
|
260 |
+
|
261 |
+
// add chart to the array
|
262 |
+
$charts['visualizer-' . $chart->ID] = array(
|
263 |
+
'id' => $chart->ID,
|
264 |
+
'type' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ),
|
265 |
+
'series' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ),
|
266 |
+
'settings' => $settings,
|
267 |
+
'data' => unserialize( $chart->post_content ),
|
268 |
+
);
|
269 |
+
}
|
270 |
+
|
271 |
+
// enqueue charts array
|
272 |
+
$ajaxurl = admin_url( 'admin-ajax.php' );
|
273 |
+
wp_localize_script( 'visualizer-library', 'visualizer', array(
|
274 |
+
'charts' => $charts,
|
275 |
+
'urls' => array(
|
276 |
+
'base' => add_query_arg( 'vpage', false ),
|
277 |
+
'create' => add_query_arg( array( 'action' => Visualizer_Plugin::ACTION_CREATE_CHART, 'library' => 'yes' ), $ajaxurl ),
|
278 |
+
'edit' => add_query_arg( array( 'action' => Visualizer_Plugin::ACTION_EDIT_CHART, 'library' => 'yes' ), $ajaxurl ),
|
279 |
+
),
|
280 |
+
) );
|
281 |
+
|
282 |
+
// render library page
|
283 |
+
$render = new Visualizer_Render_Library();
|
284 |
+
|
285 |
+
$render->charts = $charts;
|
286 |
+
$render->type = $type;
|
287 |
+
$render->types = self::_getChartTypesLocalized();
|
288 |
+
$render->pagination = paginate_links( array(
|
289 |
+
'base' => add_query_arg( 'vpage', '%#%' ),
|
290 |
+
'format' => '',
|
291 |
+
'current' => $page,
|
292 |
+
'total' => $query->max_num_pages,
|
293 |
+
'type' => 'array',
|
294 |
+
) );
|
295 |
+
|
296 |
+
$render->render();
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Updates the plugin's action links, which will be rendered at the plugins table.
|
301 |
+
*
|
302 |
+
* @since 1.0.0
|
303 |
+
*
|
304 |
+
* @access public
|
305 |
+
* @param array $links The array of original action links.
|
306 |
+
* @param string $file The plugin basename.
|
307 |
+
* @return array Updated array of action links.
|
308 |
+
*/
|
309 |
+
public function getPluginActionLinks( $links, $file ) {
|
310 |
+
if ( $file == plugin_basename( VISUALIZER_BASEFILE ) ) {
|
311 |
+
array_unshift(
|
312 |
+
$links,
|
313 |
+
sprintf(
|
314 |
+
'<a href="%s">%s</a>',
|
315 |
+
admin_url( 'upload.php?page=' . Visualizer_Plugin::NAME ),
|
316 |
+
esc_html__( 'Library', Visualizer_Plugin::NAME )
|
317 |
+
)
|
318 |
+
);
|
319 |
+
}
|
320 |
+
|
321 |
+
return $links;
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* Updates the plugin's meta links, which will be rendered at the plugins table.
|
326 |
+
*
|
327 |
+
* @since 1.0.0
|
328 |
+
*
|
329 |
+
* @access public
|
330 |
+
* @param array $plugin_meta The array of a plugin meta links.
|
331 |
+
* @param string $plugin_file The plugin's basename.
|
332 |
+
* @return array Updated array of plugin meta links.
|
333 |
+
*/
|
334 |
+
public function getPluginMetaLinks( $plugin_meta, $plugin_file ) {
|
335 |
+
if ( $plugin_file == plugin_basename( VISUALIZER_BASEFILE ) ) {
|
336 |
+
// knowledge base link
|
337 |
+
$plugin_meta[] = sprintf(
|
338 |
+
'<a href="http://visualizer.madpixels.net/knowledgebase/">%s</a>',
|
339 |
+
esc_html__( 'Knowledge Base' )
|
340 |
+
);
|
341 |
+
|
342 |
+
// community link
|
343 |
+
$plugin_meta[] = sprintf(
|
344 |
+
'<a href="http://visualizer.madpixels.net/forums/">%s</a>',
|
345 |
+
esc_html__( 'Community', Visualizer_Plugin::NAME )
|
346 |
+
);
|
347 |
+
|
348 |
+
// github link
|
349 |
+
$plugin_meta[] = '<a href="https://github.com/madpixelslabs/visualizer">GitHub Repository</a>';
|
350 |
+
}
|
351 |
+
|
352 |
+
return $plugin_meta;
|
353 |
+
}
|
354 |
+
|
355 |
+
}
|
classes/Visualizer/Module/Chart.php
ADDED
@@ -0,0 +1,470 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* The module for all stuff related to getting, editing, creating and deleting charts.
|
25 |
+
*
|
26 |
+
* @category Visualizer
|
27 |
+
* @package Module
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
*/
|
31 |
+
class Visualizer_Module_Chart extends Visualizer_Module {
|
32 |
+
|
33 |
+
const NAME = __CLASS__;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* The chart object.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
*
|
40 |
+
* @access private
|
41 |
+
* @var WP_Post
|
42 |
+
*/
|
43 |
+
private $_chart;
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Constructor.
|
47 |
+
*
|
48 |
+
* @since 1.0.0
|
49 |
+
*
|
50 |
+
* @access public
|
51 |
+
* @param Visualizer_Plugin $plugin The instance of the plugin.
|
52 |
+
*/
|
53 |
+
public function __construct( Visualizer_Plugin $plugin ) {
|
54 |
+
parent::__construct( $plugin );
|
55 |
+
|
56 |
+
$this->_addAjaxAction( Visualizer_Plugin::ACTION_GET_CHARTS, 'getCharts' );
|
57 |
+
$this->_addAjaxAction( Visualizer_Plugin::ACTION_DELETE_CHART, 'deleteChart' );
|
58 |
+
$this->_addAjaxAction( Visualizer_Plugin::ACTION_CREATE_CHART, 'renderChartPages' );
|
59 |
+
$this->_addAjaxAction( Visualizer_Plugin::ACTION_EDIT_CHART, 'renderChartPages' );
|
60 |
+
$this->_addAjaxAction( Visualizer_Plugin::ACTION_UPLOAD_DATA, 'uploadData' );
|
61 |
+
$this->_addAjaxAction( Visualizer_Plugin::ACTION_CLONE_CHART, 'cloneChart' );
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Sends json response.
|
66 |
+
*
|
67 |
+
* @since 1.0.0
|
68 |
+
*
|
69 |
+
* @access private
|
70 |
+
* @param array $results The response array.
|
71 |
+
*/
|
72 |
+
private function _sendResponse( $results ) {
|
73 |
+
header( 'Content-type: application/json' );
|
74 |
+
nocache_headers();
|
75 |
+
|
76 |
+
echo json_encode( $results );
|
77 |
+
exit;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Returns chart data required for rendering.
|
82 |
+
*
|
83 |
+
* @since 1.0.0
|
84 |
+
*
|
85 |
+
* @access private
|
86 |
+
* @param WP_Post $chart The chart object.
|
87 |
+
* @return array The array of chart data.
|
88 |
+
*/
|
89 |
+
private function _getChartArray( WP_Post $chart = null ) {
|
90 |
+
if ( is_null( $chart ) ) {
|
91 |
+
$chart = $this->_chart;
|
92 |
+
}
|
93 |
+
|
94 |
+
return array(
|
95 |
+
'type' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ),
|
96 |
+
'series' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ),
|
97 |
+
'settings' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true ),
|
98 |
+
'data' => unserialize( $chart->post_content ),
|
99 |
+
);
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Fetches charts from database.
|
104 |
+
*
|
105 |
+
* @since 1.0.0
|
106 |
+
*
|
107 |
+
* @access public
|
108 |
+
*/
|
109 |
+
public function getCharts() {
|
110 |
+
$query_args = array(
|
111 |
+
'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
|
112 |
+
'posts_per_page' => 9,
|
113 |
+
'paged' => filter_input( INPUT_GET, 'page', FILTER_VALIDATE_INT, array(
|
114 |
+
'options' => array(
|
115 |
+
'min_range' => 1,
|
116 |
+
'default' => 1,
|
117 |
+
)
|
118 |
+
) )
|
119 |
+
);
|
120 |
+
|
121 |
+
$filter = filter_input( INPUT_GET, 'filter' );
|
122 |
+
if ( $filter && in_array( $filter, Visualizer_Plugin::getChartTypes() ) ) {
|
123 |
+
$query_args['meta_query'] = array(
|
124 |
+
array(
|
125 |
+
'key' => Visualizer_Plugin::CF_CHART_TYPE,
|
126 |
+
'value' => $filter,
|
127 |
+
'compare' => '=',
|
128 |
+
),
|
129 |
+
);
|
130 |
+
}
|
131 |
+
|
132 |
+
$query = new WP_Query( $query_args );
|
133 |
+
|
134 |
+
$charts = array();
|
135 |
+
while( $query->have_posts() ) {
|
136 |
+
$chart = $query->next_post();
|
137 |
+
|
138 |
+
$chart_data = $this->_getChartArray( $chart );
|
139 |
+
$chart_data['id'] = $chart->ID;
|
140 |
+
|
141 |
+
$charts[] = $chart_data;
|
142 |
+
}
|
143 |
+
|
144 |
+
$this->_sendResponse( array(
|
145 |
+
'success' => true,
|
146 |
+
'data' => $charts,
|
147 |
+
'total' => $query->max_num_pages,
|
148 |
+
) );
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Deletes a chart from database.
|
153 |
+
*
|
154 |
+
* @since 1.0.0
|
155 |
+
* @uses wp_delete_post() To delete a chart.
|
156 |
+
*
|
157 |
+
* @access public
|
158 |
+
*/
|
159 |
+
public function deleteChart() {
|
160 |
+
$is_post = $_SERVER['REQUEST_METHOD'] == 'POST';
|
161 |
+
$input_method = $is_post ? INPUT_POST : INPUT_GET;
|
162 |
+
|
163 |
+
$chart_id = $success = false;
|
164 |
+
$nonce = Visualizer_Security::verifyNonce( filter_input( $input_method, 'nonce' ) );
|
165 |
+
$capable = current_user_can( 'delete_posts' );
|
166 |
+
if ( $nonce && $capable ) {
|
167 |
+
$chart_id = filter_input( $input_method, 'chart', FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1 ) ) );
|
168 |
+
if ( $chart_id ) {
|
169 |
+
$chart = get_post( $chart_id );
|
170 |
+
$success = $chart && $chart->post_type == Visualizer_Plugin::CPT_VISUALIZER;
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
if ( $success ) {
|
175 |
+
wp_delete_post( $chart_id, true );
|
176 |
+
}
|
177 |
+
|
178 |
+
if ( $is_post ) {
|
179 |
+
$this->_sendResponse( array( 'success' => $success ) );
|
180 |
+
}
|
181 |
+
|
182 |
+
wp_redirect( wp_get_referer() );
|
183 |
+
exit;
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Renders appropriate page for chart builder. Creates new auto draft chart
|
188 |
+
* if no chart has been specified.
|
189 |
+
*
|
190 |
+
* @since 1.0.0
|
191 |
+
*
|
192 |
+
* @access public
|
193 |
+
*/
|
194 |
+
public function renderChartPages() {
|
195 |
+
// check chart, if chart not exists, will create new one and redirects to the same page with proper chart id
|
196 |
+
$chart_id = filter_input( INPUT_GET, 'chart', FILTER_VALIDATE_INT );
|
197 |
+
if ( !$chart_id || !( $chart = get_post( $chart_id ) ) || $chart->post_type != Visualizer_Plugin::CPT_VISUALIZER ) {
|
198 |
+
$default_type = 'line';
|
199 |
+
|
200 |
+
$source = new Visualizer_Source_Csv( VISUALIZER_ABSPATH . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . $default_type . '.csv' );
|
201 |
+
$source->fetch();
|
202 |
+
|
203 |
+
$chart_id = wp_insert_post( array(
|
204 |
+
'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
|
205 |
+
'post_title' => 'Visualization',
|
206 |
+
'post_author' => get_current_user_id(),
|
207 |
+
'post_status' => 'auto-draft',
|
208 |
+
'post_content' => $source->getData(),
|
209 |
+
) );
|
210 |
+
|
211 |
+
if ( $chart_id && !is_wp_error( $chart_id ) ) {
|
212 |
+
add_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_TYPE, $default_type );
|
213 |
+
add_post_meta( $chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, 1 );
|
214 |
+
add_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() );
|
215 |
+
add_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $source->getSeries() );
|
216 |
+
add_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, array() );
|
217 |
+
}
|
218 |
+
|
219 |
+
wp_redirect( add_query_arg( 'chart', (int)$chart_id ) );
|
220 |
+
exit;
|
221 |
+
}
|
222 |
+
|
223 |
+
// enqueue and register scripts and styles
|
224 |
+
wp_register_style( 'visualizer-frame', VISUALIZER_ABSURL . 'css/frame.css', array(), Visualizer_Plugin::VERSION );
|
225 |
+
|
226 |
+
wp_register_script( 'visualizer-frame', VISUALIZER_ABSURL . 'js/frame.js', array( 'jquery' ), Visualizer_Plugin::VERSION, true );
|
227 |
+
wp_register_script( 'google-jsapi', '//www.google.com/jsapi', array(), null, true );
|
228 |
+
wp_register_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( 'google-jsapi', 'visualizer-frame' ), Visualizer_Plugin::VERSION, true );
|
229 |
+
wp_register_script( 'visualizer-preview', VISUALIZER_ABSURL . 'js/preview.js', array( 'wp-color-picker', 'visualizer-render' ), Visualizer_Plugin::VERSION, true );
|
230 |
+
|
231 |
+
// dispatch pages
|
232 |
+
$this->_chart = $chart;
|
233 |
+
switch ( filter_input( INPUT_GET, 'tab' ) ) {
|
234 |
+
case 'data':
|
235 |
+
$this->_handleDataPage();
|
236 |
+
break;
|
237 |
+
case 'settings':
|
238 |
+
$this->_handleSettingsPage();
|
239 |
+
break;
|
240 |
+
case 'type':
|
241 |
+
default:
|
242 |
+
$this->_handleTypesPage();
|
243 |
+
break;
|
244 |
+
}
|
245 |
+
|
246 |
+
exit;
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* Handles chart type selection page.
|
251 |
+
*
|
252 |
+
* @since 1.0.0
|
253 |
+
*
|
254 |
+
* @access private
|
255 |
+
*/
|
256 |
+
private function _handleTypesPage() {
|
257 |
+
// process post request
|
258 |
+
if ( $_SERVER['REQUEST_METHOD'] == 'POST' && Visualizer_Security::verifyNonce( filter_input( INPUT_POST, 'nonce' ) ) ) {
|
259 |
+
$type = filter_input( INPUT_POST, 'type' );
|
260 |
+
if ( in_array( $type, Visualizer_Plugin::getChartTypes() ) ) {
|
261 |
+
// save new chart type
|
262 |
+
update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_CHART_TYPE, $type );
|
263 |
+
|
264 |
+
// if the chart has default data, update it with appropriate default data for new type
|
265 |
+
if ( filter_var( get_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_DEFAULT_DATA, true ), FILTER_VALIDATE_BOOLEAN ) ) {
|
266 |
+
$source = new Visualizer_Source_Csv( VISUALIZER_ABSPATH . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . $type . '.csv' );
|
267 |
+
$source->fetch();
|
268 |
+
|
269 |
+
$this->_chart->post_content = $source->getData();
|
270 |
+
wp_update_post( $this->_chart->to_array() );
|
271 |
+
|
272 |
+
update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_SERIES, $source->getSeries() );
|
273 |
+
}
|
274 |
+
|
275 |
+
// redirect to next tab
|
276 |
+
wp_redirect( add_query_arg( 'tab', 'data' ) );
|
277 |
+
return;
|
278 |
+
}
|
279 |
+
}
|
280 |
+
|
281 |
+
$render = new Visualizer_Render_Page_Types();
|
282 |
+
$render->type = get_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
|
283 |
+
$render->types = Visualizer_Plugin::getChartTypes();
|
284 |
+
$render->chart = $this->_chart;
|
285 |
+
|
286 |
+
wp_enqueue_style( 'visualizer-frame' );
|
287 |
+
wp_enqueue_script( 'visualizer-frame' );
|
288 |
+
|
289 |
+
wp_iframe( array( $render, 'render') );
|
290 |
+
}
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Handles chart data page.
|
294 |
+
*
|
295 |
+
* @since 1.0.0
|
296 |
+
*
|
297 |
+
* @access private
|
298 |
+
*/
|
299 |
+
private function _handleDataPage() {
|
300 |
+
$data = $this->_getChartArray();
|
301 |
+
|
302 |
+
$render = new Visualizer_Render_Page_Data();
|
303 |
+
$render->chart = $this->_chart;
|
304 |
+
$render->type = $data['type'];
|
305 |
+
|
306 |
+
unset( $data['settings']['width'], $data['settings']['height'] );
|
307 |
+
|
308 |
+
wp_enqueue_style( 'visualizer-frame' );
|
309 |
+
wp_enqueue_script( 'visualizer-render' );
|
310 |
+
wp_localize_script( 'visualizer-render', 'visualizer', array(
|
311 |
+
'charts' => array(
|
312 |
+
'canvas' => $data,
|
313 |
+
),
|
314 |
+
) );
|
315 |
+
|
316 |
+
wp_iframe( array( $render, 'render') );
|
317 |
+
}
|
318 |
+
|
319 |
+
/**
|
320 |
+
* Handles chart settigns page.
|
321 |
+
*
|
322 |
+
* @since 1.0.0
|
323 |
+
*
|
324 |
+
* @access private
|
325 |
+
*/
|
326 |
+
private function _handleSettingsPage() {
|
327 |
+
if ( $_SERVER['REQUEST_METHOD'] == 'POST' && Visualizer_Security::verifyNonce( filter_input( INPUT_GET, 'nonce' ) ) ) {
|
328 |
+
if ( $this->_chart->post_status == 'auto-draft' ) {
|
329 |
+
$this->_chart->post_status = 'publish';
|
330 |
+
wp_update_post( $this->_chart->to_array() );
|
331 |
+
}
|
332 |
+
|
333 |
+
update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_SETTINGS, $_POST );
|
334 |
+
|
335 |
+
$render = new Visualizer_Render_Page_Send();
|
336 |
+
$render->text = sprintf( '[visualizer id="%d"]', $this->_chart->ID );
|
337 |
+
|
338 |
+
wp_iframe( array( $render, 'render') );
|
339 |
+
return;
|
340 |
+
}
|
341 |
+
|
342 |
+
$data = $this->_getChartArray();
|
343 |
+
|
344 |
+
$sidebar = '';
|
345 |
+
$sidebar_class = 'Visualizer_Render_Sidebar_Type_' . ucfirst( $data['type'] );
|
346 |
+
if ( class_exists( $sidebar_class, true ) ) {
|
347 |
+
$sidebar = new $sidebar_class( $data['settings'] );
|
348 |
+
$sidebar->__series = $data['series'];
|
349 |
+
$sidebar->__data = $data['data'];
|
350 |
+
}
|
351 |
+
|
352 |
+
unset( $data['settings']['width'], $data['settings']['height'] );
|
353 |
+
|
354 |
+
wp_enqueue_style( 'wp-color-picker' );
|
355 |
+
wp_enqueue_style( 'visualizer-frame' );
|
356 |
+
|
357 |
+
wp_enqueue_script( 'visualizer-preview' );
|
358 |
+
wp_localize_script( 'visualizer-render', 'visualizer', array(
|
359 |
+
'charts' => array(
|
360 |
+
'canvas' => $data,
|
361 |
+
),
|
362 |
+
) );
|
363 |
+
|
364 |
+
$render = new Visualizer_Render_Page_Settings();
|
365 |
+
|
366 |
+
$render->sidebar = $sidebar;
|
367 |
+
if ( filter_input( INPUT_GET, 'library', FILTER_VALIDATE_BOOLEAN ) ) {
|
368 |
+
$render->button = filter_input( INPUT_GET, 'action' ) == Visualizer_Plugin::ACTION_EDIT_CHART
|
369 |
+
? esc_html__( 'Save Chart', Visualizer_Plugin::NAME )
|
370 |
+
: esc_html__( 'Create Chart', Visualizer_Plugin::NAME );
|
371 |
+
} else {
|
372 |
+
$render->button = esc_attr__( 'Insert Chart', Visualizer_Plugin::NAME );
|
373 |
+
}
|
374 |
+
|
375 |
+
wp_iframe( array( $render, 'render') );
|
376 |
+
}
|
377 |
+
|
378 |
+
/**
|
379 |
+
* Parses uploaded CSV file and saves new data for the chart.
|
380 |
+
*
|
381 |
+
* @since 1.0.0
|
382 |
+
*
|
383 |
+
* @access public
|
384 |
+
*/
|
385 |
+
public function uploadData() {
|
386 |
+
// validate nonce
|
387 |
+
if ( !Visualizer_Security::verifyNonce( filter_input( INPUT_GET, 'nonce' ) ) ) {
|
388 |
+
status_header( 403 );
|
389 |
+
exit;
|
390 |
+
}
|
391 |
+
|
392 |
+
// check chart, if chart exists
|
393 |
+
$chart_id = filter_input( INPUT_GET, 'chart', FILTER_VALIDATE_INT );
|
394 |
+
if ( !$chart_id || !( $chart = get_post( $chart_id ) ) || $chart->post_type != Visualizer_Plugin::CPT_VISUALIZER ) {
|
395 |
+
status_header( 400 );
|
396 |
+
exit;
|
397 |
+
}
|
398 |
+
|
399 |
+
$render = new Visualizer_Render_Page_Update();
|
400 |
+
if ( !isset( $_FILES['data'] ) || $_FILES['data']['error'] != 0 ) {
|
401 |
+
$render->message = esc_html__( "CSV file with chart data was not uploaded. Please, try again.", Visualizer_Plugin::NAME );
|
402 |
+
} else {
|
403 |
+
$source = new Visualizer_Source_Csv( $_FILES['data']['tmp_name'] );
|
404 |
+
if ( $source->fetch() ) {
|
405 |
+
$chart->post_content = $source->getData();
|
406 |
+
wp_update_post( $chart->to_array() );
|
407 |
+
|
408 |
+
update_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, $source->getSeries() );
|
409 |
+
update_post_meta( $chart->ID, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() );
|
410 |
+
update_post_meta( $chart->ID, Visualizer_Plugin::CF_DEFAULT_DATA, 0 );
|
411 |
+
|
412 |
+
$render->data = $source->getData();
|
413 |
+
$render->series = $source->getSeries();
|
414 |
+
} else {
|
415 |
+
$render->message = esc_html__( "CSV file is broken or incorrect. Please, try again.", Visualizer_Plugin::NAME );
|
416 |
+
}
|
417 |
+
}
|
418 |
+
|
419 |
+
$render->render();
|
420 |
+
exit;
|
421 |
+
}
|
422 |
+
|
423 |
+
/**
|
424 |
+
* Clones the chart.
|
425 |
+
*
|
426 |
+
* @since 1.0.0
|
427 |
+
*
|
428 |
+
* @access public
|
429 |
+
*/
|
430 |
+
public function cloneChart() {
|
431 |
+
$chart_id = $success = false;
|
432 |
+
$nonce = Visualizer_Security::verifyNonce( filter_input( INPUT_GET, 'nonce' ), Visualizer_Plugin::ACTION_CLONE_CHART );
|
433 |
+
$capable = current_user_can( 'edit_posts' );
|
434 |
+
if ( $nonce && $capable ) {
|
435 |
+
$chart_id = filter_input( INPUT_GET, 'chart', FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1 ) ) );
|
436 |
+
if ( $chart_id ) {
|
437 |
+
$chart = get_post( $chart_id );
|
438 |
+
$success = $chart && $chart->post_type == Visualizer_Plugin::CPT_VISUALIZER;
|
439 |
+
}
|
440 |
+
}
|
441 |
+
|
442 |
+
$redirect = wp_get_referer();
|
443 |
+
if ( $success ) {
|
444 |
+
$new_chart_id = wp_insert_post( array(
|
445 |
+
'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
|
446 |
+
'post_title' => 'Visualization',
|
447 |
+
'post_author' => get_current_user_id(),
|
448 |
+
'post_status' => $chart->post_status,
|
449 |
+
'post_content' => $chart->post_content,
|
450 |
+
) );
|
451 |
+
|
452 |
+
if ( $new_chart_id && !is_wp_error( $new_chart_id ) ) {
|
453 |
+
add_post_meta( $new_chart_id, Visualizer_Plugin::CF_CHART_TYPE, get_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_TYPE, true ) );
|
454 |
+
add_post_meta( $new_chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, get_post_meta( $chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, true ) );
|
455 |
+
add_post_meta( $new_chart_id, Visualizer_Plugin::CF_SOURCE, get_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, true ) );
|
456 |
+
add_post_meta( $new_chart_id, Visualizer_Plugin::CF_SERIES, get_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, true ) );
|
457 |
+
add_post_meta( $new_chart_id, Visualizer_Plugin::CF_SETTINGS, get_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, true ) );
|
458 |
+
|
459 |
+
$redirect = add_query_arg( array(
|
460 |
+
'page' => 'visualizer',
|
461 |
+
'type' => filter_input( INPUT_GET, 'type' ),
|
462 |
+
), admin_url( 'upload.php' ) );
|
463 |
+
}
|
464 |
+
}
|
465 |
+
|
466 |
+
wp_redirect( $redirect );
|
467 |
+
exit;
|
468 |
+
}
|
469 |
+
|
470 |
+
}
|
classes/Visualizer/Module/Frontend.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Frontend module class.
|
25 |
+
*
|
26 |
+
* @category Visualizer
|
27 |
+
* @package Module
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
*/
|
31 |
+
class Visualizer_Module_Frontend extends Visualizer_Module {
|
32 |
+
|
33 |
+
const NAME = __CLASS__;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* The array of charts to render.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
*
|
40 |
+
* @access private
|
41 |
+
* @var array
|
42 |
+
*/
|
43 |
+
private $_charts = array();
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Constructor.
|
47 |
+
*
|
48 |
+
* @since 1.0.0
|
49 |
+
* @uses add_filter() To add "do_shortcode" hook for "widget_text" and "term_description" filters.
|
50 |
+
*
|
51 |
+
* @access public
|
52 |
+
* @param Visualizer_Plugin $plugin The instance of the plugin.
|
53 |
+
*/
|
54 |
+
public function __construct( Visualizer_Plugin $plugin ) {
|
55 |
+
parent::__construct( $plugin );
|
56 |
+
|
57 |
+
$this->_addAction( 'wp_enqueue_scripts', 'enqueueScripts' );
|
58 |
+
$this->_addShortcode( 'visualizer', 'renderChart' );
|
59 |
+
|
60 |
+
add_filter( 'widget_text', 'do_shortcode' );
|
61 |
+
add_filter( 'term_description', 'do_shortcode' );
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Registers scripts for charts rendering.
|
66 |
+
*
|
67 |
+
* @since 1.0.0
|
68 |
+
* @uses wp_register_script To register javascript file.
|
69 |
+
*
|
70 |
+
* @access public
|
71 |
+
*/
|
72 |
+
public function enqueueScripts() {
|
73 |
+
wp_register_script( 'google-jsapi', '//www.google.com/jsapi', array(), null, true );
|
74 |
+
wp_register_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( 'google-jsapi', 'jquery' ), Visualizer_Plugin::VERSION, true );
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Returns placeholder for chart according to visualizer shortcode attributes.
|
79 |
+
*
|
80 |
+
* @since 1.0.0
|
81 |
+
* @uses shortcode_atts() To parse income shortocdes.
|
82 |
+
*
|
83 |
+
* @access public
|
84 |
+
* @param array $atts The array of shortcode attributes.
|
85 |
+
*/
|
86 |
+
public function renderChart( $atts ) {
|
87 |
+
$atts = shortcode_atts( array( 'id' => false ), $atts );
|
88 |
+
|
89 |
+
// if empty id or chart does not exists, then return empty string
|
90 |
+
if ( !$atts['id'] || !( $chart = get_post( $atts['id'] ) ) || $chart->post_type != Visualizer_Plugin::CPT_VISUALIZER ) {
|
91 |
+
return '';
|
92 |
+
}
|
93 |
+
|
94 |
+
$id = 'visualizer-' . $atts['id'];
|
95 |
+
|
96 |
+
// faetch and update settings
|
97 |
+
$settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true );
|
98 |
+
if ( empty( $settings['height'] ) ) {
|
99 |
+
$settings['height'] = '400';
|
100 |
+
}
|
101 |
+
|
102 |
+
// add chart to the array
|
103 |
+
$this->_charts[$id] = array(
|
104 |
+
'type' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ),
|
105 |
+
'series' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ),
|
106 |
+
'settings' => $settings,
|
107 |
+
'data' => unserialize( $chart->post_content ),
|
108 |
+
);
|
109 |
+
|
110 |
+
// enqueue visualizer render and update render localizations
|
111 |
+
wp_enqueue_script( 'visualizer-render' );
|
112 |
+
wp_localize_script( 'visualizer-render', 'visualizer', array( 'charts' => $this->_charts ) );
|
113 |
+
|
114 |
+
// return placeholder div
|
115 |
+
return '<div id="' . $id . '"></div>';
|
116 |
+
}
|
117 |
+
|
118 |
+
}
|
classes/Visualizer/Module/Setup.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* General module what setups all required environment.
|
25 |
+
*
|
26 |
+
* @category Visualizer
|
27 |
+
* @package Module
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
*/
|
31 |
+
class Visualizer_Module_Setup extends Visualizer_Module {
|
32 |
+
|
33 |
+
const NAME = __CLASS__;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Constructor.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
*
|
40 |
+
* @access public
|
41 |
+
* @param Visualizer_Plugin $plugin The instance of the plugin.
|
42 |
+
*/
|
43 |
+
public function __construct( Visualizer_Plugin $plugin ) {
|
44 |
+
parent::__construct( $plugin );
|
45 |
+
|
46 |
+
$this->_addAction( 'init', 'setupCustomPostTypes' );
|
47 |
+
$this->_addAction( 'plugins_loaded', 'loadTextDomain' );
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Registers custom post type for charts.
|
52 |
+
*
|
53 |
+
* @since 1.0.0
|
54 |
+
* @uses register_post_type() To register custom post type for charts.
|
55 |
+
*
|
56 |
+
* @access public
|
57 |
+
*/
|
58 |
+
public function setupCustomPostTypes() {
|
59 |
+
register_post_type( Visualizer_Plugin::CPT_VISUALIZER, array(
|
60 |
+
'public' => false,
|
61 |
+
) );
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Loads plugin text domain translations.
|
66 |
+
*
|
67 |
+
* @since 1.0.0
|
68 |
+
* @uses load_plugin_textdomain() To load translations for the plugin.
|
69 |
+
*
|
70 |
+
* @access public
|
71 |
+
*/
|
72 |
+
public function loadTextDomain() {
|
73 |
+
load_plugin_textdomain( Visualizer_Plugin::NAME, false, dirname( plugin_basename( VISUALIZER_BASEFILE ) ) . '/languages/' );
|
74 |
+
}
|
75 |
+
|
76 |
+
}
|
classes/Visualizer/Plugin.php
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* The core plugin class.
|
25 |
+
*
|
26 |
+
* @category Visualizer
|
27 |
+
*
|
28 |
+
* @since 1.0.0
|
29 |
+
*/
|
30 |
+
class Visualizer_Plugin {
|
31 |
+
|
32 |
+
const NAME = 'visualizer';
|
33 |
+
const VERSION = '1.0.0';
|
34 |
+
|
35 |
+
// custom post types
|
36 |
+
const CPT_VISUALIZER = 'visualizer';
|
37 |
+
|
38 |
+
// custom meta fields
|
39 |
+
const CF_CHART_TYPE = 'visualizer-chart-type';
|
40 |
+
const CF_SOURCE = 'visualizer-source';
|
41 |
+
const CF_SERIES = 'visualizer-series';
|
42 |
+
const CF_DEFAULT_DATA = 'visualizer-default-data';
|
43 |
+
const CF_SETTINGS = 'visualizer-settings';
|
44 |
+
|
45 |
+
// custom actions
|
46 |
+
const ACTION_GET_CHARTS = 'visualizer-get-charts';
|
47 |
+
const ACTION_CREATE_CHART = 'visualizer-create-chart';
|
48 |
+
const ACTION_EDIT_CHART = 'visualizer-edit-chart';
|
49 |
+
const ACTION_CLONE_CHART = 'visualizer-clone-chart';
|
50 |
+
const ACTION_DELETE_CHART = 'visualizer-delete-chart';
|
51 |
+
const ACTION_UPLOAD_DATA = 'visualizer-upload-data';
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Singletone instance of the plugin.
|
55 |
+
*
|
56 |
+
* @since 1.0.0
|
57 |
+
*
|
58 |
+
* @access private
|
59 |
+
* @var Visualizer_Plugin
|
60 |
+
*/
|
61 |
+
private static $_instance = null;
|
62 |
+
|
63 |
+
/**
|
64 |
+
* The array of registered modules.
|
65 |
+
*
|
66 |
+
* @since 1.0.0
|
67 |
+
*
|
68 |
+
* @access private
|
69 |
+
* @var array
|
70 |
+
*/
|
71 |
+
private $_modules = array();
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Private constructor.
|
75 |
+
*
|
76 |
+
* @since 1.0.0
|
77 |
+
*
|
78 |
+
* @access private
|
79 |
+
*/
|
80 |
+
private function __construct() {}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Private clone method.
|
84 |
+
*
|
85 |
+
* @since 1.0.0
|
86 |
+
*
|
87 |
+
* @access private
|
88 |
+
*/
|
89 |
+
private function __clone() {}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Returns singletone instance of the plugin.
|
93 |
+
*
|
94 |
+
* @since 1.0.0
|
95 |
+
*
|
96 |
+
* @static
|
97 |
+
* @access public
|
98 |
+
* @return Visualizer_Plugin
|
99 |
+
*/
|
100 |
+
public static function instance() {
|
101 |
+
if ( is_null( self::$_instance ) ) {
|
102 |
+
self::$_instance = new Visualizer_Plugin();
|
103 |
+
}
|
104 |
+
|
105 |
+
return self::$_instance;
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Returns a module if it was registered before. Otherwise NULL.
|
110 |
+
*
|
111 |
+
* @since 1.0.0
|
112 |
+
*
|
113 |
+
* @access public
|
114 |
+
* @param string $name The name of the module to return.
|
115 |
+
* @return Visualizer_Module|null Returns a module if it was registered or NULL.
|
116 |
+
*/
|
117 |
+
public function getModule( $name ) {
|
118 |
+
return isset( $this->_modules[$name] ) ? $this->_modules[$name] : null;
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Determines whether the module has been registered or not.
|
123 |
+
*
|
124 |
+
* @since 1.0.0
|
125 |
+
*
|
126 |
+
* @access public
|
127 |
+
* @param string $name The name of a module to check.
|
128 |
+
* @return boolean TRUE if the module has been registered. Otherwise FALSE.
|
129 |
+
*/
|
130 |
+
public function hasModule( $name ) {
|
131 |
+
return isset( $this->_modules[$name] );
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Register new module in the plugin.
|
136 |
+
*
|
137 |
+
* @since 1.0.0
|
138 |
+
*
|
139 |
+
* @access public
|
140 |
+
* @param string $module The name of the module to use in the plugin.
|
141 |
+
*/
|
142 |
+
public function setModule( $class ) {
|
143 |
+
$this->_modules[$class] = new $class( $this );
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Returns chart types.
|
148 |
+
*
|
149 |
+
* @since 1.0.0
|
150 |
+
*
|
151 |
+
* @static
|
152 |
+
* @access public
|
153 |
+
* @return array
|
154 |
+
*/
|
155 |
+
public static function getChartTypes() {
|
156 |
+
return array( 'line', 'area', 'bar', 'column', 'pie', 'geo', 'scatter', 'candlestick', 'gauge' );
|
157 |
+
}
|
158 |
+
|
159 |
+
}
|
classes/Visualizer/Render.php
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Abstract render class implements all routine stuff required for template
|
25 |
+
* rendering.
|
26 |
+
*
|
27 |
+
* @category Visualizer
|
28 |
+
* @package Render
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
* @abstract
|
32 |
+
*/
|
33 |
+
abstract class Visualizer_Render {
|
34 |
+
|
35 |
+
/**
|
36 |
+
* The storage of all data associated with this render.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
*
|
40 |
+
* @access protected
|
41 |
+
* @var array
|
42 |
+
*/
|
43 |
+
protected $_data;
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Constructor.
|
47 |
+
*
|
48 |
+
* @since 1.0.0
|
49 |
+
*
|
50 |
+
* @access public
|
51 |
+
* @param array $data The data what has to be associated with this render.
|
52 |
+
*/
|
53 |
+
public function __construct( $data = array() ) {
|
54 |
+
$this->_data = $data;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Returns property associated with the render.
|
59 |
+
*
|
60 |
+
* @since 1.0.0
|
61 |
+
*
|
62 |
+
* @access public
|
63 |
+
* @param string $name The name of a property.
|
64 |
+
* @return mixed Returns mixed value of a property or NULL if a property doesn't exist.
|
65 |
+
*/
|
66 |
+
public function __get( $name ) {
|
67 |
+
return array_key_exists( $name, $this->_data ) ? $this->_data[$name] : null;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Checks whether the render has specific property or not.
|
72 |
+
*
|
73 |
+
* @since 1.0.0
|
74 |
+
*
|
75 |
+
* @access public
|
76 |
+
* @param string $name
|
77 |
+
* @return boolean TRUE if the property exists, otherwise FALSE.
|
78 |
+
*/
|
79 |
+
public function __isset( $name ) {
|
80 |
+
return array_key_exists( $name, $this->_data );
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Associates the render with specific property.
|
85 |
+
*
|
86 |
+
* @since 1.0.0
|
87 |
+
*
|
88 |
+
* @access public
|
89 |
+
* @param string $name The name of a property to associate.
|
90 |
+
* @param mixed $value The value of a property.
|
91 |
+
*/
|
92 |
+
public function __set( $name, $value ) {
|
93 |
+
$this->_data[$name] = $value;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Unassociates specific property from the render.
|
98 |
+
*
|
99 |
+
* @since 1.0.0
|
100 |
+
*
|
101 |
+
* @access public
|
102 |
+
* @param string $name The name of the property to unassociate.
|
103 |
+
*/
|
104 |
+
public function __unset( $name ) {
|
105 |
+
unset( $this->_data[$name] );
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Renders template.
|
110 |
+
*
|
111 |
+
* @since 1.0.0
|
112 |
+
*
|
113 |
+
* @abstract
|
114 |
+
* @access protected
|
115 |
+
*/
|
116 |
+
protected abstract function _toHTML();
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Builds template and return it as string.
|
120 |
+
*
|
121 |
+
* @since 1.0.0
|
122 |
+
*
|
123 |
+
* @access public
|
124 |
+
* @return string
|
125 |
+
*/
|
126 |
+
public function toHtml() {
|
127 |
+
ob_start();
|
128 |
+
$this->_toHTML();
|
129 |
+
return ob_get_clean();
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Returns built template as string.
|
134 |
+
*
|
135 |
+
* @since 1.0.0
|
136 |
+
*
|
137 |
+
* @access public
|
138 |
+
* @return type
|
139 |
+
*/
|
140 |
+
public function __toString() {
|
141 |
+
return $this->toHtml();
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Renders the template.
|
146 |
+
*
|
147 |
+
* @since 1.0.0
|
148 |
+
*
|
149 |
+
* @access public
|
150 |
+
*/
|
151 |
+
public function render() {
|
152 |
+
$this->_toHTML();
|
153 |
+
}
|
154 |
+
|
155 |
+
}
|
classes/Visualizer/Render/Library.php
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Renders visualizer library page.
|
25 |
+
*
|
26 |
+
* @category Visualizer
|
27 |
+
* @package Render
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
*/
|
31 |
+
class Visualizer_Render_Library extends Visualizer_Render {
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Renders chart's box block.
|
35 |
+
*
|
36 |
+
* @since 1.0.0
|
37 |
+
*
|
38 |
+
* @access private
|
39 |
+
* @param string $placeholder_id The placeholder's id for the chart.
|
40 |
+
* @param int $chart_id The id of the chart.
|
41 |
+
*/
|
42 |
+
private function _renderChartBox( $placeholder_id, $chart_id ) {
|
43 |
+
$ajax_url = admin_url( 'admin-ajax.php' );
|
44 |
+
|
45 |
+
$delete_url = add_query_arg( array(
|
46 |
+
'action' => Visualizer_Plugin::ACTION_DELETE_CHART,
|
47 |
+
'nonce' => Visualizer_Security::createNonce(),
|
48 |
+
'chart' => $chart_id,
|
49 |
+
), $ajax_url );
|
50 |
+
|
51 |
+
$clone_url = add_query_arg( array(
|
52 |
+
'action' => Visualizer_Plugin::ACTION_CLONE_CHART,
|
53 |
+
'nonce' => Visualizer_Security::createNonce( Visualizer_Plugin::ACTION_CLONE_CHART ),
|
54 |
+
'chart' => $chart_id,
|
55 |
+
'type' => $this->type,
|
56 |
+
), $ajax_url );
|
57 |
+
|
58 |
+
echo '<div class="visualizer-chart">';
|
59 |
+
echo '<div id="', $placeholder_id, '" class="visualizer-chart-canvas">';
|
60 |
+
echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">';
|
61 |
+
echo '</div>';
|
62 |
+
echo '<div class="visualizer-chart-footer visualizer-clearfix">';
|
63 |
+
echo '<a class="visualizer-chart-action visualizer-chart-delete" href="', $delete_url, '" title="', esc_attr__( 'Delete', Visualizer_Plugin::NAME ), '" onclick="return showNotice.warn();"></a>';
|
64 |
+
echo '<a class="visualizer-chart-action visualizer-chart-clone" href="', $clone_url, '" title="', esc_attr__( 'Clone', Visualizer_Plugin::NAME ), '"></a>';
|
65 |
+
echo '<a class="visualizer-chart-action visualizer-chart-edit" href="javascript:;" title="', esc_attr__( 'Edit', Visualizer_Plugin::NAME ), '" data-chart="', $chart_id, '"></a>';
|
66 |
+
|
67 |
+
echo '<span class="visualizer-chart-shortcode" title="', esc_attr__( 'Click to select', Visualizer_Plugin::NAME ), '">';
|
68 |
+
echo ' [visualizer id="', $chart_id, '"] ';
|
69 |
+
echo '</span>';
|
70 |
+
echo '</div>';
|
71 |
+
echo '</div>';
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Renders library content.
|
76 |
+
*
|
77 |
+
* @since 1.0.0
|
78 |
+
*
|
79 |
+
* @access private
|
80 |
+
*/
|
81 |
+
private function _renderLibrary() {
|
82 |
+
echo '<div id="visualizer-types" class="visualizer-clearfix">';
|
83 |
+
echo '<ul>';
|
84 |
+
foreach ( $this->types as $type => $label ) {
|
85 |
+
echo '<li class="visualizer-list-item">';
|
86 |
+
if ( $type == $this->type ) {
|
87 |
+
echo '<a class="page-numbers current" href="', add_query_arg( 'vpage', false ), '">';
|
88 |
+
echo $label;
|
89 |
+
echo '</a>';
|
90 |
+
} else {
|
91 |
+
echo '<a class="page-numbers" href="', add_query_arg( array( 'type' => $type, 'vpage' => false ) ), '">';
|
92 |
+
echo $label;
|
93 |
+
echo '</a>';
|
94 |
+
}
|
95 |
+
echo '</li>';
|
96 |
+
}
|
97 |
+
echo '</ul>';
|
98 |
+
echo '</div>';
|
99 |
+
|
100 |
+
if ( !empty( $this->charts ) ) {
|
101 |
+
echo '<div id="visualizer-library" class="visualizer-clearfix">';
|
102 |
+
foreach ( $this->charts as $placeholder_id => $chart ) {
|
103 |
+
$this->_renderChartBox( $placeholder_id, $chart['id'] );
|
104 |
+
}
|
105 |
+
echo '</div>';
|
106 |
+
|
107 |
+
if ( is_array( $this->pagination ) ) {
|
108 |
+
echo '<ul>';
|
109 |
+
foreach ( $this->pagination as $page ) {
|
110 |
+
echo '<li class="visualizer-list-item">', $page, '</li>';
|
111 |
+
}
|
112 |
+
echo '</ul>';
|
113 |
+
}
|
114 |
+
} else {
|
115 |
+
echo '<div id="visualizer-library" class="visualizer-clearfix">';
|
116 |
+
echo '<div class="visualizer-chart">';
|
117 |
+
echo '<div class="visualizer-chart-canvas visualizer-nochart-canvas">';
|
118 |
+
echo '<div class="visualizer-notfound">', esc_html__( 'No charts found', Visualizer_Plugin::NAME ), '</div>';
|
119 |
+
echo '</div>';
|
120 |
+
echo '<div class="visualizer-chart-footer visualizer-clearfix">';
|
121 |
+
echo '<span class="visualizer-chart-action visualizer-nochart-delete"></span>';
|
122 |
+
echo '<span class="visualizer-chart-action visualizer-nochart-clone"></span>';
|
123 |
+
echo '<span class="visualizer-chart-action visualizer-nochart-edit"></span>';
|
124 |
+
|
125 |
+
echo '<span class="visualizer-chart-shortcode">';
|
126 |
+
echo ' [visualizer] ';
|
127 |
+
echo '</span>';
|
128 |
+
echo '</div>';
|
129 |
+
echo '</div>';
|
130 |
+
echo '</div>';
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Renders library page.
|
136 |
+
*
|
137 |
+
* @since 1.0.0
|
138 |
+
*
|
139 |
+
* @access protected
|
140 |
+
*/
|
141 |
+
protected function _toHTML() {
|
142 |
+
echo '<div class="wrap">';
|
143 |
+
echo '<div id="visualizer-icon" class="icon32"><br></div>';
|
144 |
+
echo '<h2>';
|
145 |
+
esc_html_e( 'Visualizer Library', Visualizer_Plugin::NAME );
|
146 |
+
echo ' <a href="javascript:;" class="add-new-h2">', esc_html__( 'Add New', Visualizer_Plugin::NAME ), '</a>';
|
147 |
+
echo '</h2>';
|
148 |
+
|
149 |
+
$this->_renderLibrary();
|
150 |
+
echo '</div>';
|
151 |
+
}
|
152 |
+
|
153 |
+
}
|
classes/Visualizer/Render/Page.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Base class for all chart builder pages.
|
26 |
+
*
|
27 |
+
* @category Visualizer
|
28 |
+
* @package Render
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
*/
|
32 |
+
class Visualizer_Render_Page extends Visualizer_Render {
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Renders the page.
|
36 |
+
*
|
37 |
+
* @since 1.0.0
|
38 |
+
*
|
39 |
+
* @access protected
|
40 |
+
*/
|
41 |
+
protected function _toHTML() {
|
42 |
+
echo '<div id="content">';
|
43 |
+
$this->_renderContent();
|
44 |
+
echo '</div>';
|
45 |
+
$this->_renderSidebar();
|
46 |
+
echo '<div id="toolbar">';
|
47 |
+
$this->_renderToolbar();
|
48 |
+
echo '</div>';
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Renders page content.
|
53 |
+
*
|
54 |
+
* @since 1.0.0
|
55 |
+
*
|
56 |
+
* @access protected
|
57 |
+
*/
|
58 |
+
protected function _renderContent() {}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Renders page sidebar.
|
62 |
+
*
|
63 |
+
* @since 1.0.0
|
64 |
+
*
|
65 |
+
* @access protected
|
66 |
+
*/
|
67 |
+
protected function _renderSidebar() {
|
68 |
+
echo '<div id="sidebar">';
|
69 |
+
echo '<ul class="group-wrapper">';
|
70 |
+
$this->_renderSidebarContent();
|
71 |
+
echo '</ul>';
|
72 |
+
echo '</div>';
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Renders sidebar content.
|
77 |
+
*
|
78 |
+
* @since 1.0.0
|
79 |
+
*
|
80 |
+
* @access protected
|
81 |
+
*/
|
82 |
+
protected function _renderSidebarContent() {}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Renders toolbar content.
|
86 |
+
*
|
87 |
+
* @since 1.0.0
|
88 |
+
*
|
89 |
+
* @access protected
|
90 |
+
*/
|
91 |
+
protected function _renderToolbar() {}
|
92 |
+
|
93 |
+
}
|
classes/Visualizer/Render/Page/Data.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Renders chart data setup page.
|
25 |
+
*
|
26 |
+
* @category Visualizer
|
27 |
+
* @package Render
|
28 |
+
* @subpackage Page
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
*/
|
32 |
+
class Visualizer_Render_Page_Data extends Visualizer_Render_Page {
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Renders page content.
|
36 |
+
*
|
37 |
+
* @since 1.0.0
|
38 |
+
*
|
39 |
+
* @access protected
|
40 |
+
*/
|
41 |
+
protected function _renderContent() {
|
42 |
+
echo '<div id="canvas">';
|
43 |
+
echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">';
|
44 |
+
echo '</div>';
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Renders sidebar content.
|
49 |
+
*
|
50 |
+
* @since 1.0.0
|
51 |
+
*
|
52 |
+
* @access protected
|
53 |
+
*/
|
54 |
+
protected function _renderSidebarContent() {
|
55 |
+
$upload_link = add_query_arg( array(
|
56 |
+
'action' => Visualizer_Plugin::ACTION_UPLOAD_DATA,
|
57 |
+
'nonce' => Visualizer_Security::createNonce(),
|
58 |
+
'chart' => $this->chart->ID,
|
59 |
+
), admin_url( 'admin-ajax.php' ) );
|
60 |
+
|
61 |
+
echo '<li class="group">';
|
62 |
+
echo '<h3 class="group-title">', esc_html__( 'Upload CSV file', Visualizer_Plugin::NAME ), '</h3>';
|
63 |
+
echo '<div class="group-content">';
|
64 |
+
echo '<p class="group-description">';
|
65 |
+
esc_html_e( "Select and upload your data CSV file here. The first row of the CSV file should contain the column headings. If you are unsure about how to format your data CSV then please take a look at this sample:", Visualizer_Plugin::NAME );
|
66 |
+
echo ' <a href="', VISUALIZER_ABSURL, 'samples/', $this->type, '.csv">', $this->type, '.csv</a>';
|
67 |
+
echo '</p>';
|
68 |
+
echo '<div>';
|
69 |
+
echo '<iframe id="thehole" name="thehole"></iframe>';
|
70 |
+
echo '<form id="csv-form" action="', $upload_link, '" method="post" target="thehole" enctype="multipart/form-data">';
|
71 |
+
echo '<div class="button button-primary file-wrapper">';
|
72 |
+
echo '<input type="file" name="data" id="csv-file" class="file">';
|
73 |
+
esc_attr_e( 'Upload CSV file', Visualizer_Plugin::NAME );
|
74 |
+
echo '</div>';
|
75 |
+
echo '</form>';
|
76 |
+
echo '</div>';
|
77 |
+
echo '</div>';
|
78 |
+
echo '</li>';
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Renders toolbar content.
|
83 |
+
*
|
84 |
+
* @since 1.0.0
|
85 |
+
*
|
86 |
+
* @access protected
|
87 |
+
*/
|
88 |
+
protected function _renderToolbar() {
|
89 |
+
echo '<a class="button button-large" href="', add_query_arg( 'tab', false ), '">';
|
90 |
+
esc_html_e( 'Back', Visualizer_Plugin::NAME );
|
91 |
+
echo '</a>';
|
92 |
+
echo '<a class="button button-large button-primary push-right" href="', add_query_arg( 'tab', 'settings' ), '">';
|
93 |
+
esc_html_e( 'Next', Visualizer_Plugin::NAME );
|
94 |
+
echo '</a>';
|
95 |
+
}
|
96 |
+
|
97 |
+
}
|
classes/Visualizer/Render/Page/Send.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Renders page which sends a text to editor.
|
25 |
+
*
|
26 |
+
* @category Visualizer
|
27 |
+
* @package Render
|
28 |
+
* @subpackage Page
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
*/
|
32 |
+
class Visualizer_Render_Page_Send extends Visualizer_Render_Page {
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Renders page template.
|
36 |
+
*
|
37 |
+
* @since 1.0.0
|
38 |
+
*
|
39 |
+
* @access protected
|
40 |
+
*/
|
41 |
+
protected function _toHTML() {
|
42 |
+
echo '<!DOCTYPE html>';
|
43 |
+
echo '<html>';
|
44 |
+
echo '<head>';
|
45 |
+
echo '<script type="text/javascript">';
|
46 |
+
echo '(function() {';
|
47 |
+
echo 'var win = window.dialogArguments || opener || parent || top;';
|
48 |
+
echo 'if (win.send_to_editor) {';
|
49 |
+
echo "win.send_to_editor('", $this->text, "');";
|
50 |
+
echo '}';
|
51 |
+
echo '})();';
|
52 |
+
echo '</script>';
|
53 |
+
echo '</head>';
|
54 |
+
echo '<body></body>';
|
55 |
+
echo '</html>';
|
56 |
+
}
|
57 |
+
|
58 |
+
}
|
classes/Visualizer/Render/Page/Settings.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Renders chart settings page.
|
25 |
+
*
|
26 |
+
* @category Visualizer
|
27 |
+
* @package Render
|
28 |
+
* @subpackage Page
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
*/
|
32 |
+
class Visualizer_Render_Page_Settings extends Visualizer_Render_Page {
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Renders page content.
|
36 |
+
*
|
37 |
+
* @since 1.0.0
|
38 |
+
*
|
39 |
+
* @access protected
|
40 |
+
*/
|
41 |
+
protected function _renderContent() {
|
42 |
+
echo '<div id="canvas">';
|
43 |
+
echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">';
|
44 |
+
echo '</div>';
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Renders toolbar content.
|
49 |
+
*
|
50 |
+
* @since 1.0.0
|
51 |
+
*
|
52 |
+
* @access protected
|
53 |
+
*/
|
54 |
+
protected function _renderToolbar() {
|
55 |
+
echo '<a class="button button-large" href="', add_query_arg( 'tab', 'data' ), '">';
|
56 |
+
esc_html_e( 'Back', Visualizer_Plugin::NAME );
|
57 |
+
echo '</a>';
|
58 |
+
echo '<input type="submit" class="button button-primary button-large push-right" value="', $this->button, '">';
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Renders page template.
|
63 |
+
*
|
64 |
+
* @since 1.0.0
|
65 |
+
*
|
66 |
+
* @access protected
|
67 |
+
*/
|
68 |
+
protected function _toHTML() {
|
69 |
+
echo '<form id="settings-form" action="', add_query_arg( 'nonce', Visualizer_Security::createNonce() ), '" method="post">';
|
70 |
+
parent::_toHTML();
|
71 |
+
echo '</form>';
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Renders sidebar content.
|
76 |
+
*
|
77 |
+
* @since 1.0.0
|
78 |
+
*
|
79 |
+
* @access protected
|
80 |
+
*/
|
81 |
+
protected function _renderSidebarContent() {
|
82 |
+
echo $this->sidebar;
|
83 |
+
}
|
84 |
+
|
85 |
+
}
|
classes/Visualizer/Render/Page/Types.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Renders chart type picker page.
|
25 |
+
*
|
26 |
+
* @category Visualizer
|
27 |
+
* @package Render
|
28 |
+
* @subpackage Page
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
*/
|
32 |
+
class Visualizer_Render_Page_Types extends Visualizer_Render_Page {
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Renders page template.
|
36 |
+
*
|
37 |
+
* @since 1.0.0
|
38 |
+
*
|
39 |
+
* @access protected
|
40 |
+
*/
|
41 |
+
protected function _toHTML() {
|
42 |
+
echo '<form method="post">';
|
43 |
+
echo '<input type="hidden" name="nonce" value="', Visualizer_Security::createNonce(), '">';
|
44 |
+
parent::_toHTML();
|
45 |
+
echo '</form>';
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Renders page content.
|
50 |
+
*
|
51 |
+
* @since 1.0.0
|
52 |
+
*
|
53 |
+
* @access protected
|
54 |
+
*/
|
55 |
+
protected function _renderContent() {
|
56 |
+
echo '<div id="type-picker">';
|
57 |
+
foreach ( $this->types as $type ) {
|
58 |
+
echo '<div class="type-box type-box-', $type, '">';
|
59 |
+
echo '<label class="type-label', $type == $this->type ? ' type-label-selected' : '', '">';
|
60 |
+
echo '<input type="radio" class="type-radio" name="type" value="', $type, '"', checked( $type, $this->type, false ), '>';
|
61 |
+
echo '</label>';
|
62 |
+
echo '</div>';
|
63 |
+
}
|
64 |
+
echo '</div>';
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Renders page sidebar.
|
69 |
+
*
|
70 |
+
* @since 1.0.0
|
71 |
+
*
|
72 |
+
* @access protected
|
73 |
+
*/
|
74 |
+
protected function _renderSidebar() {}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Renders toolbar content.
|
78 |
+
*
|
79 |
+
* @since 1.0.0
|
80 |
+
*
|
81 |
+
* @access protected
|
82 |
+
*/
|
83 |
+
protected function _renderToolbar() {
|
84 |
+
echo '<input type="submit" class="button button-primary button-large push-right" value="', esc_attr__( 'Next', Visualizer_Plugin::NAME ), '">';
|
85 |
+
}
|
86 |
+
|
87 |
+
}
|
classes/Visualizer/Render/Page/Update.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Renders data uploading respond.
|
26 |
+
*
|
27 |
+
* @category Visualizer
|
28 |
+
* @package Render
|
29 |
+
* @subpackage Page
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
*/
|
33 |
+
class Visualizer_Render_Page_Update extends Visualizer_Render_Page {
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Renders page template.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
*
|
40 |
+
* @access protected
|
41 |
+
*/
|
42 |
+
protected function _toHTML() {
|
43 |
+
echo '<!DOCTYPE html>';
|
44 |
+
echo '<html>';
|
45 |
+
echo '<head>';
|
46 |
+
echo '<script type="text/javascript">';
|
47 |
+
echo '(function() {';
|
48 |
+
if ( empty( $this->message ) ) {
|
49 |
+
echo 'var win = window.dialogArguments || opener || parent || top;';
|
50 |
+
echo 'if (win.visualizer) {';
|
51 |
+
echo 'win.visualizer.charts.canvas.series = ', $this->series, ';';
|
52 |
+
echo 'win.visualizer.charts.canvas.data = ', $this->data, ';';
|
53 |
+
echo 'win.visualizer.render();';
|
54 |
+
echo '}';
|
55 |
+
} else {
|
56 |
+
echo 'alert("', $this->message, '");';
|
57 |
+
}
|
58 |
+
echo '})();';
|
59 |
+
echo '</script>';
|
60 |
+
echo '</head>';
|
61 |
+
echo '<body></body>';
|
62 |
+
echo '</html>';
|
63 |
+
}
|
64 |
+
|
65 |
+
}
|
classes/Visualizer/Render/Sidebar.php
ADDED
@@ -0,0 +1,455 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Base class for all chart sidebar groups.
|
26 |
+
*
|
27 |
+
* @category Visualizer
|
28 |
+
* @package Render
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
* @abstract
|
32 |
+
*/
|
33 |
+
abstract class Visualizer_Render_Sidebar extends Visualizer_Render {
|
34 |
+
|
35 |
+
/**
|
36 |
+
* The array of font families accepted by visualization API.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
*
|
40 |
+
* @static
|
41 |
+
* @access protected
|
42 |
+
* @var array
|
43 |
+
*/
|
44 |
+
protected static $_fontFamilies = array(
|
45 |
+
'Arial' => 'Arial',
|
46 |
+
'Sans Serif' => 'Sans Serif',
|
47 |
+
'serif' => 'Serif',
|
48 |
+
'Arial black' => 'Wide',
|
49 |
+
'Arial Narrow' => 'Narrow',
|
50 |
+
'Comic Sans MS' => 'Comic Sans MS',
|
51 |
+
'Courier New' => 'Courier New',
|
52 |
+
'Garamond' => 'Garamond',
|
53 |
+
'Georgia' => 'Georgia',
|
54 |
+
'Tahoma' => 'Tahoma',
|
55 |
+
'Verdana' => 'Verdana',
|
56 |
+
);
|
57 |
+
|
58 |
+
/**
|
59 |
+
* The Yes/No array.
|
60 |
+
*
|
61 |
+
* @since 1.0.0
|
62 |
+
*
|
63 |
+
* @access protected
|
64 |
+
* @var array
|
65 |
+
*/
|
66 |
+
protected $_yesno;
|
67 |
+
|
68 |
+
/**
|
69 |
+
* The array of available legend positions.
|
70 |
+
*
|
71 |
+
* @since 1.0.0
|
72 |
+
*
|
73 |
+
* @access protected
|
74 |
+
* @var array
|
75 |
+
*/
|
76 |
+
protected $_legendPositions;
|
77 |
+
|
78 |
+
/**
|
79 |
+
* The array of available alignments.
|
80 |
+
*
|
81 |
+
* @since 1.0.0
|
82 |
+
*
|
83 |
+
* @access protected
|
84 |
+
* @var array
|
85 |
+
*/
|
86 |
+
protected $_alignments;
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Constructor.
|
90 |
+
*
|
91 |
+
* @since 1.0.0
|
92 |
+
*
|
93 |
+
* @access public
|
94 |
+
* @param array $data The data what has to be associated with this render.
|
95 |
+
*/
|
96 |
+
public function __construct( $data = array() ) {
|
97 |
+
parent::__construct( $data );
|
98 |
+
|
99 |
+
$this->_legendPositions = array(
|
100 |
+
'' => '',
|
101 |
+
'right' => esc_html__( 'Right of the chart', Visualizer_Plugin::NAME ),
|
102 |
+
'top' => esc_html__( 'Above the chart', Visualizer_Plugin::NAME ),
|
103 |
+
'bottom' => esc_html__( 'Below the chart', Visualizer_Plugin::NAME ),
|
104 |
+
'in' => esc_html__( 'Inside the chart', Visualizer_Plugin::NAME ),
|
105 |
+
'none' => esc_html__( 'Omit the legend', Visualizer_Plugin::NAME ),
|
106 |
+
);
|
107 |
+
|
108 |
+
$this->_alignments = array(
|
109 |
+
'' => '',
|
110 |
+
'start' => esc_html__( 'Aligned to the start of the allocated area', Visualizer_Plugin::NAME ),
|
111 |
+
'center' => esc_html__( 'Centered in the allocated area', Visualizer_Plugin::NAME ),
|
112 |
+
'end' => esc_html__( 'Aligned to the end of the allocated area', Visualizer_Plugin::NAME ),
|
113 |
+
);
|
114 |
+
|
115 |
+
$this->_yesno = array(
|
116 |
+
'' => '',
|
117 |
+
'1' => esc_html__( 'Yes', Visualizer_Plugin::NAME ),
|
118 |
+
'0' => esc_html__( 'No', Visualizer_Plugin::NAME ),
|
119 |
+
);
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Renders chart title settings.
|
124 |
+
*
|
125 |
+
* @since 1.0.0
|
126 |
+
*
|
127 |
+
* @access protected
|
128 |
+
*/
|
129 |
+
protected function _renderChartTitleSettings() {
|
130 |
+
self::_renderTextItem(
|
131 |
+
esc_html__( 'Chart Title', Visualizer_Plugin::NAME ),
|
132 |
+
'title',
|
133 |
+
$this->title,
|
134 |
+
esc_html__( 'Text to display above the chart.', Visualizer_Plugin::NAME )
|
135 |
+
);
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Renders chart general settings group.
|
140 |
+
*
|
141 |
+
* @since 1.0.0
|
142 |
+
*
|
143 |
+
* @access protected
|
144 |
+
*/
|
145 |
+
protected function _renderGeneralSettings() {
|
146 |
+
self::_renderGroupStart( esc_html__( 'General Settings', Visualizer_Plugin::NAME ) );
|
147 |
+
self::_renderSectionStart();
|
148 |
+
self::_renderSectionDescription( esc_html__( 'Configure title, font styles and legend positioning settings for the chart.', Visualizer_Plugin::NAME ) );
|
149 |
+
|
150 |
+
$this->_renderChartTitleSettings();
|
151 |
+
|
152 |
+
echo '<div class="section-item">';
|
153 |
+
echo '<a class="more-info" href="javascript:;">[?]</a>';
|
154 |
+
echo '<b>', esc_html__( 'Font Family And Size', Visualizer_Plugin::NAME ), '</b>';
|
155 |
+
|
156 |
+
echo '<table class="section-table" cellspacing="0" cellpadding="0" border="0">';
|
157 |
+
echo '<tr>';
|
158 |
+
echo '<td class="section-table-column">';
|
159 |
+
echo '<select name="fontName" class="control-select">';
|
160 |
+
echo '<option></option>';
|
161 |
+
foreach ( self::$_fontFamilies as $font => $label ) {
|
162 |
+
echo '<option value="', $font, '"', selected( $font, $this->fontName, false ), '>';
|
163 |
+
echo $label;
|
164 |
+
echo '</option>';
|
165 |
+
}
|
166 |
+
echo '</select>';
|
167 |
+
echo '</td>';
|
168 |
+
echo '<td class="section-table-column">';
|
169 |
+
echo '<select name="fontSize" class="control-select">';
|
170 |
+
echo '<option></option>';
|
171 |
+
for ( $i = 7; $i <= 20; $i++ ) {
|
172 |
+
echo '<option value="', $i, '"', selected( $i, $this->fontSize, false ), '>', $i, '</option>';
|
173 |
+
}
|
174 |
+
echo '</select>';
|
175 |
+
echo '</td>';
|
176 |
+
echo '</tr>';
|
177 |
+
echo '</table>';
|
178 |
+
|
179 |
+
echo '<p class="section-description">';
|
180 |
+
esc_html_e( 'The default font family and size for all text in the chart.', Visualizer_Plugin::NAME );
|
181 |
+
echo '</p>';
|
182 |
+
echo '</div>';
|
183 |
+
self::_renderSectionEnd();
|
184 |
+
|
185 |
+
self::_renderSectionStart( esc_html__( 'Legend', Visualizer_Plugin::NAME ), false );
|
186 |
+
self::_renderSelectItem(
|
187 |
+
esc_html__( 'Position', Visualizer_Plugin::NAME ),
|
188 |
+
'legend[position]',
|
189 |
+
$this->legend['position'],
|
190 |
+
$this->_legendPositions,
|
191 |
+
esc_html__( 'Determines where to place the legend, compared to the chart area.', Visualizer_Plugin::NAME )
|
192 |
+
);
|
193 |
+
|
194 |
+
self::_renderSelectItem(
|
195 |
+
esc_html__( 'Alignment', Visualizer_Plugin::NAME ),
|
196 |
+
'legend[alignment]',
|
197 |
+
$this->legend['alignment'],
|
198 |
+
$this->_alignments,
|
199 |
+
esc_html__( 'Determines the alignment of the legend.', Visualizer_Plugin::NAME )
|
200 |
+
);
|
201 |
+
self::_renderSectionEnd();
|
202 |
+
self::_renderGroupEnd();
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Renders chart view settings group.
|
207 |
+
*
|
208 |
+
* @since 1.0.0
|
209 |
+
*
|
210 |
+
* @access protected
|
211 |
+
*/
|
212 |
+
protected function _renderViewSettings() {
|
213 |
+
self::_renderGroupStart( esc_html__( 'Layout & Chart Area', Visualizer_Plugin::NAME ) );
|
214 |
+
self::_renderSectionStart( esc_html__( 'Layout', Visualizer_Plugin::NAME ), false );
|
215 |
+
self::_renderSectionDescription( esc_html__( 'Configure the total size of the chart. Two formats are supported: a number, or a number followed by %. A simple number is a value in pixels; a number followed by % is a percentage.', Visualizer_Plugin::NAME ) );
|
216 |
+
|
217 |
+
echo '<div class="section-item">';
|
218 |
+
echo '<a class="more-info" href="javascript:;">[?]</a>';
|
219 |
+
echo '<b>', esc_html__( 'Width And Height Of Chart', Visualizer_Plugin::NAME ), '</b>';
|
220 |
+
|
221 |
+
echo '<table class="section-table" cellspacing="0" cellpadding="0" border="0">';
|
222 |
+
echo '<tr>';
|
223 |
+
echo '<td class="section-table-column">';
|
224 |
+
echo '<input type="text" name="width" class="control-text" value="', esc_attr( $this->width ), '" placeholder="100%">';
|
225 |
+
echo '</td>';
|
226 |
+
echo '<td class="section-table-column">';
|
227 |
+
echo '<input type="text" name="height" class="control-text" value="', esc_attr( $this->height ), '" placeholder="400">';
|
228 |
+
echo '</td>';
|
229 |
+
echo '</tr>';
|
230 |
+
echo '</table>';
|
231 |
+
|
232 |
+
echo '<p class="section-description">';
|
233 |
+
esc_html_e( 'Determines the total width and height of the chart.', Visualizer_Plugin::NAME );
|
234 |
+
echo '</p>';
|
235 |
+
echo '</div>';
|
236 |
+
|
237 |
+
echo '<div class="section-delimiter"></div>';
|
238 |
+
|
239 |
+
self::_renderSectionDescription( esc_html__( 'Configure the background color for the main area of the chart and the chart border width and color.', Visualizer_Plugin::NAME ) );
|
240 |
+
|
241 |
+
self::_renderTextItem(
|
242 |
+
esc_html__( 'Stroke Width', Visualizer_Plugin::NAME ),
|
243 |
+
'backgroundColor[strokeWidth]',
|
244 |
+
isset( $this->backgroundColor['strokeWidth'] ) ? $this->backgroundColor['strokeWidth'] : null,
|
245 |
+
esc_html__( 'The chart border width in pixels.', Visualizer_Plugin::NAME ),
|
246 |
+
'0'
|
247 |
+
);
|
248 |
+
|
249 |
+
self::_renderColorPickerItem(
|
250 |
+
esc_html__( 'Stroke Color', Visualizer_Plugin::NAME ),
|
251 |
+
'backgroundColor[stroke]',
|
252 |
+
!empty( $this->backgroundColor['stroke'] ) ? $this->backgroundColor['stroke'] : null,
|
253 |
+
'#666'
|
254 |
+
);
|
255 |
+
|
256 |
+
self::_renderColorPickerItem(
|
257 |
+
esc_html__( 'Background Color', Visualizer_Plugin::NAME ),
|
258 |
+
'backgroundColor[fill]',
|
259 |
+
!empty( $this->backgroundColor['fill'] ) ? $this->backgroundColor['fill'] : null,
|
260 |
+
'#fff'
|
261 |
+
);
|
262 |
+
self::_renderSectionEnd();
|
263 |
+
|
264 |
+
self::_renderSectionStart( esc_html__( 'Chart Area', Visualizer_Plugin::NAME ), false );
|
265 |
+
self::_renderSectionDescription( esc_html__( 'Configure the placement and size of the chart area (where the chart itself is drawn, excluding axis and legends). Two formats are supported: a number, or a number followed by %. A simple number is a value in pixels; a number followed by % is a percentage.', Visualizer_Plugin::NAME ) );
|
266 |
+
|
267 |
+
echo '<div class="section-item">';
|
268 |
+
echo '<a class="more-info" href="javascript:;">[?]</a>';
|
269 |
+
echo '<b>', esc_html__( 'Left And Top Margins', Visualizer_Plugin::NAME ), '</b>';
|
270 |
+
|
271 |
+
echo '<table class="section-table" cellspacing="0" cellpadding="0" border="0">';
|
272 |
+
echo '<tr>';
|
273 |
+
echo '<td class="section-table-column">';
|
274 |
+
echo '<input type="text" name="chartArea[left]" class="control-text" value="', !empty( $this->chartArea['left'] ) ? esc_attr( $this->chartArea['left'] ) : '', '" placeholder="20%">';
|
275 |
+
echo '</td>';
|
276 |
+
echo '<td class="section-table-column">';
|
277 |
+
echo '<input type="text" name="chartArea[top]" class="control-text" value="', !empty( $this->chartArea['top'] ) ? esc_attr( $this->chartArea['top'] ) : '', '" placeholder="20%">';
|
278 |
+
echo '</td>';
|
279 |
+
echo '</tr>';
|
280 |
+
echo '</table>';
|
281 |
+
|
282 |
+
echo '<p class="section-description">';
|
283 |
+
esc_html_e( 'Determines how far to draw the chart from the left and top borders.', Visualizer_Plugin::NAME );
|
284 |
+
echo '</p>';
|
285 |
+
echo '</div>';
|
286 |
+
|
287 |
+
echo '<div class="section-item">';
|
288 |
+
echo '<a class="more-info" href="javascript:;">[?]</a>';
|
289 |
+
echo '<b>', esc_html__( 'Width And Height Of Chart Area', Visualizer_Plugin::NAME ), '</b>';
|
290 |
+
|
291 |
+
echo '<table class="section-table" cellspacing="0" cellpadding="0" border="0">';
|
292 |
+
echo '<tr>';
|
293 |
+
echo '<td class="section-table-column">';
|
294 |
+
echo '<input type="text" name="chartArea[width]" class="control-text" value="', !empty( $this->chartArea['width'] ) ? esc_attr( $this->chartArea['width'] ) : '', '" placeholder="60%">';
|
295 |
+
echo '</td>';
|
296 |
+
echo '<td class="section-table-column">';
|
297 |
+
echo '<input type="text" name="chartArea[height]" class="control-text" value="', !empty( $this->chartArea['height'] ) ? esc_attr( $this->chartArea['height'] ) : '', '" placeholder="60%">';
|
298 |
+
echo '</td>';
|
299 |
+
echo '</tr>';
|
300 |
+
echo '</table>';
|
301 |
+
|
302 |
+
echo '<p class="section-description">';
|
303 |
+
esc_html_e( 'Determines the width and hight of the chart area.', Visualizer_Plugin::NAME );
|
304 |
+
echo '</p>';
|
305 |
+
echo '</div>';
|
306 |
+
self::_renderSectionEnd();
|
307 |
+
self::_renderGroupEnd();
|
308 |
+
}
|
309 |
+
|
310 |
+
/**
|
311 |
+
* Renders select item.
|
312 |
+
*
|
313 |
+
* @since 1.0.0
|
314 |
+
*
|
315 |
+
* @static
|
316 |
+
* @access protected
|
317 |
+
* @param string $title The title of the select item.
|
318 |
+
* @param string $name The name of the select item.
|
319 |
+
* @param string $value The actual value of the select item.
|
320 |
+
* @param array $options The array of select options.
|
321 |
+
* @param string $desc The description of the select item.
|
322 |
+
*/
|
323 |
+
protected static function _renderSelectItem( $title, $name, $value, array $options, $desc ) {
|
324 |
+
echo '<div class="section-item">';
|
325 |
+
echo '<a class="more-info" href="javascript:;">[?]</a>';
|
326 |
+
echo '<b>', $title, '</b>';
|
327 |
+
echo '<select class="control-select" name="', $name, '">';
|
328 |
+
foreach ( $options as $key => $label ) {
|
329 |
+
echo '<option value="', $key, '"', selected( $key, $value, false ), '>';
|
330 |
+
echo $label;
|
331 |
+
echo '</option>';
|
332 |
+
}
|
333 |
+
echo '</select>';
|
334 |
+
echo '<p class="section-description">', $desc, '</p>';
|
335 |
+
echo '</div>';
|
336 |
+
}
|
337 |
+
|
338 |
+
/**
|
339 |
+
* Renders color picker item.
|
340 |
+
*
|
341 |
+
* @since 1.0.0
|
342 |
+
*
|
343 |
+
* @static
|
344 |
+
* @access protected
|
345 |
+
* @param string $title The title of the select item.
|
346 |
+
* @param string $name The name of the select item.
|
347 |
+
* @param string $value The actual value of the select item.
|
348 |
+
* @param string $default The default value of the color picker.
|
349 |
+
*/
|
350 |
+
protected static function _renderColorPickerItem( $title, $name, $value, $default ) {
|
351 |
+
echo '<div class="section-item">';
|
352 |
+
echo '<b>', $title, '</b>';
|
353 |
+
echo '<div>';
|
354 |
+
echo '<input type="text" class="color-picker-hex" name="', $name, '" maxlength="7" placeholder="', esc_attr__( 'Hex Value', Visualizer_Plugin::NAME ), '" value="', is_null( $value ) ? $default : esc_attr( $value ), '" data-default-color="', $default, '">';
|
355 |
+
echo '</div>';
|
356 |
+
echo '</div>';
|
357 |
+
}
|
358 |
+
|
359 |
+
/**
|
360 |
+
* Renders text item.
|
361 |
+
*
|
362 |
+
* @since 1.0.0
|
363 |
+
*
|
364 |
+
* @static
|
365 |
+
* @access protected
|
366 |
+
* @param string $title The title of the select item.
|
367 |
+
* @param string $name The name of the select item.
|
368 |
+
* @param string $value The actual value of the select item.
|
369 |
+
* @param string $desc The description of the select item.
|
370 |
+
* @param string $placeholder The placeholder for the input.
|
371 |
+
*/
|
372 |
+
protected static function _renderTextItem( $title, $name, $value, $desc, $placeholder = '' ) {
|
373 |
+
echo '<div class="section-item">';
|
374 |
+
echo '<a class="more-info" href="javascript:;">[?]</a>';
|
375 |
+
echo '<b>', $title, '</b>';
|
376 |
+
echo '<input type="text" class="control-text" name="', $name, '" value="', esc_attr( $value ), '" placeholder="', $placeholder, '">';
|
377 |
+
echo '<p class="section-description">', $desc, '</p>';
|
378 |
+
echo '</div>';
|
379 |
+
}
|
380 |
+
|
381 |
+
/**
|
382 |
+
* Renders the beginning of a group.
|
383 |
+
*
|
384 |
+
* @since 1.0.0
|
385 |
+
*
|
386 |
+
* @static
|
387 |
+
* @access protected
|
388 |
+
* @param string $title The title of this group.
|
389 |
+
*/
|
390 |
+
protected static function _renderGroupStart( $title ) {
|
391 |
+
echo '<li class="group">';
|
392 |
+
echo '<h3 class="group-title">', $title, '</h3>';
|
393 |
+
echo '<ul class="group-content">';
|
394 |
+
}
|
395 |
+
|
396 |
+
/**
|
397 |
+
* Renders the ending of a group.
|
398 |
+
*
|
399 |
+
* @since 1.0.0
|
400 |
+
*
|
401 |
+
* @static
|
402 |
+
* @access protected
|
403 |
+
*/
|
404 |
+
protected static function _renderGroupEnd() {
|
405 |
+
echo '</ul>';
|
406 |
+
echo '</li>';
|
407 |
+
}
|
408 |
+
|
409 |
+
/**
|
410 |
+
* Renders the beginning of a section.
|
411 |
+
*
|
412 |
+
* @since 1.0.0
|
413 |
+
*
|
414 |
+
* @static
|
415 |
+
* @access protected
|
416 |
+
* @param string $title The title of this section. If the title is empty, no title will be displayed.
|
417 |
+
* @param boolean $open Determines whether the section items block has to be expanded or collapsed.
|
418 |
+
*/
|
419 |
+
protected static function _renderSectionStart( $title = false, $open = true ) {
|
420 |
+
echo '<li>';
|
421 |
+
if ( !empty( $title ) ) {
|
422 |
+
echo '<span class="section-title">', $title, '</span>';
|
423 |
+
}
|
424 |
+
echo '<div class="section-items', $open ? ' open' : '', '">';
|
425 |
+
}
|
426 |
+
|
427 |
+
/**
|
428 |
+
* Renders the ending of a section.
|
429 |
+
*
|
430 |
+
* @since 1.0.0
|
431 |
+
*
|
432 |
+
* @static
|
433 |
+
* @access protected
|
434 |
+
*/
|
435 |
+
protected static function _renderSectionEnd() {
|
436 |
+
echo '</div>';
|
437 |
+
echo '</li>';
|
438 |
+
}
|
439 |
+
|
440 |
+
/**
|
441 |
+
* Renders section description block.
|
442 |
+
*
|
443 |
+
* @since 1.0.0
|
444 |
+
*
|
445 |
+
* @static
|
446 |
+
* @access protected
|
447 |
+
* @param string $description The description text.
|
448 |
+
*/
|
449 |
+
protected static function _renderSectionDescription( $description ) {
|
450 |
+
echo '<div class="section-item">';
|
451 |
+
echo '<div class="section-description">', $description, '</div>';
|
452 |
+
echo '</div>';
|
453 |
+
}
|
454 |
+
|
455 |
+
}
|
classes/Visualizer/Render/Sidebar/Columnar.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Base class for sidebar settings of columnar based charts.
|
26 |
+
*
|
27 |
+
* @category Visualizer
|
28 |
+
* @package Render
|
29 |
+
* @subpackage Sidebar
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
* @abstract
|
33 |
+
*/
|
34 |
+
abstract class Visualizer_Render_Sidebar_Columnar extends Visualizer_Render_Sidebar_Graph {
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Renders columnar settings group.
|
38 |
+
*
|
39 |
+
* @since 1.0.0
|
40 |
+
*
|
41 |
+
* @access protected
|
42 |
+
*/
|
43 |
+
protected function _renderColumnarSettings() {
|
44 |
+
self::_renderGroupStart( esc_html__( 'Bars Settings', Visualizer_Plugin::NAME ) );
|
45 |
+
self::_renderSectionStart();
|
46 |
+
self::_renderSelectItem(
|
47 |
+
esc_html__( 'Is Stacked', Visualizer_Plugin::NAME ),
|
48 |
+
'isStacked',
|
49 |
+
$this->isStacked,
|
50 |
+
$this->_yesno,
|
51 |
+
esc_html__( 'If set to yes, series elements are stacked.', Visualizer_Plugin::NAME )
|
52 |
+
);
|
53 |
+
self::_renderSectionEnd();
|
54 |
+
self::_renderGroupEnd();
|
55 |
+
}
|
56 |
+
|
57 |
+
}
|
classes/Visualizer/Render/Sidebar/Graph.php
ADDED
@@ -0,0 +1,280 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Base class for sidebar settigns of graph based charts.
|
26 |
+
*
|
27 |
+
* @category Visualizer
|
28 |
+
* @package Render
|
29 |
+
* @subpackage Sidebar
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
* @abstract
|
33 |
+
*/
|
34 |
+
abstract class Visualizer_Render_Sidebar_Graph extends Visualizer_Render_Sidebar {
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Determines whether we need to render vertical gridlines options or not.
|
38 |
+
*
|
39 |
+
* @since 1.0.0
|
40 |
+
*
|
41 |
+
* @access protected
|
42 |
+
* @var boolean
|
43 |
+
*/
|
44 |
+
protected $_verticalGridLines;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Determines whether we need to render horizontal gridlines options or not.
|
48 |
+
*
|
49 |
+
* @since 1.0.0
|
50 |
+
*
|
51 |
+
* @access protected
|
52 |
+
* @var boolean
|
53 |
+
*/
|
54 |
+
protected $_horizontalGridLines;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* The array of available axis positions.
|
58 |
+
*
|
59 |
+
* @since 1.0.0
|
60 |
+
*
|
61 |
+
* @access protected
|
62 |
+
* @var array
|
63 |
+
*/
|
64 |
+
protected $_positions;
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Constructor.
|
68 |
+
*
|
69 |
+
* @since 1.0.0
|
70 |
+
*
|
71 |
+
* @access public
|
72 |
+
* @param array $data The data what has to be associated with this render.
|
73 |
+
*/
|
74 |
+
public function __construct( $data = array() ) {
|
75 |
+
parent::__construct( $data );
|
76 |
+
|
77 |
+
$this->_verticalGridLines = true;
|
78 |
+
$this->_horizontalGridLines = true;
|
79 |
+
|
80 |
+
$this->_positions = array(
|
81 |
+
'' => '',
|
82 |
+
'in' => esc_html__( 'Inside the chart', Visualizer_Plugin::NAME ),
|
83 |
+
'out' => esc_html__( 'Outside the chart', Visualizer_Plugin::NAME ),
|
84 |
+
'none' => esc_html__( 'None', Visualizer_Plugin::NAME ),
|
85 |
+
);
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Renders chart title settings.
|
90 |
+
*
|
91 |
+
* @since 1.0.0
|
92 |
+
*
|
93 |
+
* @access protected
|
94 |
+
*/
|
95 |
+
protected function _renderChartTitleSettings() {
|
96 |
+
parent::_renderChartTitleSettings();
|
97 |
+
|
98 |
+
self::_renderSelectItem(
|
99 |
+
esc_html__( 'Chart Title Position', Visualizer_Plugin::NAME ),
|
100 |
+
'titlePosition',
|
101 |
+
$this->titlePosition,
|
102 |
+
$this->_positions,
|
103 |
+
esc_html__( 'Where to place the chart title, compared to the chart area.', Visualizer_Plugin::NAME )
|
104 |
+
);
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Renders chart axes settings.
|
109 |
+
*
|
110 |
+
* @since 1.0.0
|
111 |
+
*
|
112 |
+
* @access protected
|
113 |
+
*/
|
114 |
+
protected function _renderAxesSettings() {
|
115 |
+
$directions = array(
|
116 |
+
'' => '',
|
117 |
+
'1' => esc_html__( 'Identical Direction', Visualizer_Plugin::NAME ),
|
118 |
+
'-1' => esc_html__( 'Reverse Direction', Visualizer_Plugin::NAME ),
|
119 |
+
);
|
120 |
+
|
121 |
+
self::_renderGroupStart( esc_html__( 'Horizontal & Vertical Axes', Visualizer_Plugin::NAME ) );
|
122 |
+
self::_renderSectionStart();
|
123 |
+
self::_renderSelectItem(
|
124 |
+
esc_html__( 'Axes Titles Position', Visualizer_Plugin::NAME ),
|
125 |
+
'axisTitlesPosition',
|
126 |
+
$this->axisTitlesPosition,
|
127 |
+
$this->_positions,
|
128 |
+
esc_html__( 'Determines where to place the axis titles, compared to the chart area.', Visualizer_Plugin::NAME )
|
129 |
+
);
|
130 |
+
self::_renderSectionEnd();
|
131 |
+
|
132 |
+
self::_renderSectionStart( esc_html__( 'Horizontal Axis', Visualizer_Plugin::NAME ), false );
|
133 |
+
self::_renderTextItem(
|
134 |
+
esc_html__( 'Axis Title', Visualizer_Plugin::NAME ),
|
135 |
+
'hAxis[title]',
|
136 |
+
isset( $this->hAxis['title'] ) ? $this->hAxis['title'] : '',
|
137 |
+
esc_html__( 'The title of the horizontal axis.', Visualizer_Plugin::NAME )
|
138 |
+
);
|
139 |
+
|
140 |
+
self::_renderSelectItem(
|
141 |
+
esc_html__( 'Text Position', Visualizer_Plugin::NAME ),
|
142 |
+
'vAxis[textPosition]',
|
143 |
+
isset( $this->vAxis['textPosition'] ) ? $this->vAxis['textPosition'] : '',
|
144 |
+
$this->_positions,
|
145 |
+
esc_html__( 'Position of the horizontal axis text, relative to the chart area.', Visualizer_Plugin::NAME )
|
146 |
+
);
|
147 |
+
|
148 |
+
self::_renderSelectItem(
|
149 |
+
esc_html__( 'Direction', Visualizer_Plugin::NAME ),
|
150 |
+
'hAxis[direction]',
|
151 |
+
isset( $this->hAxis['direction'] ) ? $this->hAxis['direction'] : '',
|
152 |
+
$directions,
|
153 |
+
esc_html__( 'The direction in which the values along the horizontal axis grow.', Visualizer_Plugin::NAME )
|
154 |
+
);
|
155 |
+
|
156 |
+
if ( $this->_horizontalGridLines ) {
|
157 |
+
self::_renderTextItem(
|
158 |
+
esc_html__( 'Grid Lines Count', Visualizer_Plugin::NAME ),
|
159 |
+
'vAxis[gridlines][count]',
|
160 |
+
isset( $this->vAxis['gridlines']['count'] ) ? $this->vAxis['gridlines']['count'] : '',
|
161 |
+
esc_html__( 'The number of horizontal gridlines inside the chart area. Minimum value is 2. Specify -1 to automatically compute the number of gridlines.', Visualizer_Plugin::NAME ),
|
162 |
+
5
|
163 |
+
);
|
164 |
+
|
165 |
+
self::_renderColorPickerItem(
|
166 |
+
esc_html__( 'Grid Lines Color', Visualizer_Plugin::NAME ),
|
167 |
+
'vAxis[gridlines][color]',
|
168 |
+
isset( $this->vAxis['gridlines']['color'] ) ? $this->vAxis['gridlines']['color'] : null,
|
169 |
+
'#ccc'
|
170 |
+
);
|
171 |
+
}
|
172 |
+
|
173 |
+
self::_renderColorPickerItem(
|
174 |
+
esc_html__( 'Base Line Color', Visualizer_Plugin::NAME ),
|
175 |
+
'vAxis[baselineColor]',
|
176 |
+
isset( $this->vAxis['baselineColor'] ) ? $this->vAxis['baselineColor'] : null,
|
177 |
+
'#000'
|
178 |
+
);
|
179 |
+
self::_renderSectionEnd();
|
180 |
+
|
181 |
+
self::_renderSectionStart( esc_html__( 'Vertical Axis', Visualizer_Plugin::NAME ), false );
|
182 |
+
self::_renderTextItem(
|
183 |
+
esc_html__( 'Axis Title', Visualizer_Plugin::NAME ),
|
184 |
+
'vAxis[title]',
|
185 |
+
isset( $this->vAxis['title'] ) ? $this->vAxis['title'] : '',
|
186 |
+
esc_html__( 'The title of the vertical axis.', Visualizer_Plugin::NAME )
|
187 |
+
);
|
188 |
+
|
189 |
+
self::_renderSelectItem(
|
190 |
+
esc_html__( 'Text Position', Visualizer_Plugin::NAME ),
|
191 |
+
'hAxis[textPosition]',
|
192 |
+
isset( $this->hAxis['textPosition'] ) ? $this->hAxis['textPosition'] : '',
|
193 |
+
$this->_positions,
|
194 |
+
esc_html__( 'Position of the vertical axis text, relative to the chart area.', Visualizer_Plugin::NAME )
|
195 |
+
);
|
196 |
+
|
197 |
+
self::_renderSelectItem(
|
198 |
+
esc_html__( 'Direction', Visualizer_Plugin::NAME ),
|
199 |
+
'vAxis[direction]',
|
200 |
+
isset( $this->vAxis['direction'] ) ? $this->vAxis['direction'] : '',
|
201 |
+
$directions,
|
202 |
+
esc_html__( 'The direction in which the values along the vertical axis grow.', Visualizer_Plugin::NAME )
|
203 |
+
);
|
204 |
+
|
205 |
+
if ( $this->_verticalGridLines ) {
|
206 |
+
self::_renderTextItem(
|
207 |
+
esc_html__( 'Grid Lines Count', Visualizer_Plugin::NAME ),
|
208 |
+
'hAxis[gridlines][count]',
|
209 |
+
isset( $this->hAxis['gridlines']['count'] ) ? $this->hAxis['gridlines']['count'] : '',
|
210 |
+
esc_html__( 'The number of vertical gridlines inside the chart area. Minimum value is 2. Specify -1 to automatically compute the number of gridlines.', Visualizer_Plugin::NAME ),
|
211 |
+
5
|
212 |
+
);
|
213 |
+
|
214 |
+
self::_renderColorPickerItem(
|
215 |
+
esc_html__( 'Grid Lines Color', Visualizer_Plugin::NAME ),
|
216 |
+
'hAxis[gridlines][color]',
|
217 |
+
isset( $this->hAxis['gridlines']['color'] ) ? $this->hAxis['gridlines']['color'] : null,
|
218 |
+
'#ccc'
|
219 |
+
);
|
220 |
+
}
|
221 |
+
|
222 |
+
self::_renderColorPickerItem(
|
223 |
+
esc_html__( 'Base Line Color', Visualizer_Plugin::NAME ),
|
224 |
+
'hAxis[baselineColor]',
|
225 |
+
isset( $this->hAxis['baselineColor'] ) ? $this->hAxis['baselineColor'] : null,
|
226 |
+
'#000'
|
227 |
+
);
|
228 |
+
self::_renderSectionEnd();
|
229 |
+
self::_renderGroupEnd();
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Renders series settings group.
|
234 |
+
*
|
235 |
+
* @since 1.0.0
|
236 |
+
*
|
237 |
+
* @access protected
|
238 |
+
*/
|
239 |
+
protected function _renderSeriesSettings() {
|
240 |
+
self::_renderGroupStart( esc_html__( 'Series Settings', Visualizer_Plugin::NAME ) );
|
241 |
+
for ( $i = 1, $cnt = count( $this->__series ); $i < $cnt; $i++ ) {
|
242 |
+
if ( !empty( $this->__series[$i]['label'] ) ) {
|
243 |
+
self::_renderSectionStart( esc_html( $this->__series[$i]['label'] ), false );
|
244 |
+
$this->_renderSeries( $i - 1 );
|
245 |
+
self::_renderSectionEnd();
|
246 |
+
}
|
247 |
+
}
|
248 |
+
self::_renderGroupEnd();
|
249 |
+
}
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Renders concreate series settings.
|
253 |
+
*
|
254 |
+
* @since 1.0.0
|
255 |
+
*
|
256 |
+
* @access protected
|
257 |
+
* @param int $index The series index.
|
258 |
+
*/
|
259 |
+
protected function _renderSeries( $index ) {
|
260 |
+
self::_renderSelectItem(
|
261 |
+
esc_html__( 'Visible In Legend', Visualizer_Plugin::NAME ),
|
262 |
+
'series[' . $index . '][visibleInLegend]',
|
263 |
+
isset( $this->series[$index]['visibleInLegend'] ) ? $this->series[$index]['visibleInLegend'] : '',
|
264 |
+
array(
|
265 |
+
'' => '',
|
266 |
+
'0' => esc_html__( 'No', Visualizer_Plugin::NAME ),
|
267 |
+
'1' => esc_html__( 'Yes', Visualizer_Plugin::NAME ),
|
268 |
+
),
|
269 |
+
esc_html__( 'Determines whether the series has to be presented in the legend or not.', Visualizer_Plugin::NAME )
|
270 |
+
);
|
271 |
+
|
272 |
+
self::_renderColorPickerItem(
|
273 |
+
esc_html__( 'Color', Visualizer_Plugin::NAME ),
|
274 |
+
'series[' . $index . '][color]',
|
275 |
+
isset( $this->series[$index]['color'] ) ? $this->series[$index]['color'] : null,
|
276 |
+
null
|
277 |
+
);
|
278 |
+
}
|
279 |
+
|
280 |
+
}
|
classes/Visualizer/Render/Sidebar/Linear.php
ADDED
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Base class for sidebar settings of linear based charts.
|
26 |
+
*
|
27 |
+
* @category Visualizer
|
28 |
+
* @package Render
|
29 |
+
* @subpackage Sidebar
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
* @abstract
|
33 |
+
*/
|
34 |
+
abstract class Visualizer_Render_Sidebar_Linear extends Visualizer_Render_Sidebar_Graph {
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Determines whether we need to render curve type option or not.
|
38 |
+
*
|
39 |
+
* @since 1.0.0
|
40 |
+
*
|
41 |
+
* @access protected
|
42 |
+
* @var boolean
|
43 |
+
*/
|
44 |
+
protected $_includeCurveTypes;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* The array of available curve types.
|
48 |
+
*
|
49 |
+
* @since 1.0.0
|
50 |
+
*
|
51 |
+
* @access protected
|
52 |
+
* @var array
|
53 |
+
*/
|
54 |
+
protected $_curveTypes;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Determines whether we need to render focus target option or not.
|
58 |
+
*
|
59 |
+
* @since 1.0.0
|
60 |
+
*
|
61 |
+
* @access protected
|
62 |
+
* @var boolean
|
63 |
+
*/
|
64 |
+
protected $_includeFocusTarget;
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Constructor.
|
68 |
+
*
|
69 |
+
* @since 1.0.0
|
70 |
+
*
|
71 |
+
* @access public
|
72 |
+
* @param array $data The data what has to be associated with this render.
|
73 |
+
*/
|
74 |
+
public function __construct( $data = array() ) {
|
75 |
+
parent::__construct( $data );
|
76 |
+
|
77 |
+
$this->_includeCurveTypes = true;
|
78 |
+
$this->_includeFocusTarget = true;
|
79 |
+
|
80 |
+
$this->_curveTypes = array(
|
81 |
+
'' => '',
|
82 |
+
'none' => esc_html__( 'Straight line without curve', Visualizer_Plugin::NAME ),
|
83 |
+
'function' => esc_html__( 'The angles of the line will be smoothed', Visualizer_Plugin::NAME ),
|
84 |
+
);
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Renders line settings items.
|
89 |
+
*
|
90 |
+
* @since 1.0.0
|
91 |
+
*
|
92 |
+
* @access protected
|
93 |
+
*/
|
94 |
+
protected function _renderLineSettingsItems() {
|
95 |
+
self::_renderTextItem(
|
96 |
+
esc_html__( 'Line Width', Visualizer_Plugin::NAME ),
|
97 |
+
'lineWidth',
|
98 |
+
$this->lineWidth,
|
99 |
+
esc_html__( 'Data line width in pixels. Use zero to hide all lines and show only the points.', Visualizer_Plugin::NAME ),
|
100 |
+
2
|
101 |
+
);
|
102 |
+
|
103 |
+
self::_renderTextItem(
|
104 |
+
esc_html__( 'Point Size', Visualizer_Plugin::NAME ),
|
105 |
+
'pointSize',
|
106 |
+
$this->pointSize,
|
107 |
+
esc_html__( 'Diameter of displayed points in pixels. Use zero to hide all points.', Visualizer_Plugin::NAME ),
|
108 |
+
0
|
109 |
+
);
|
110 |
+
|
111 |
+
if ( $this->_includeCurveTypes ) {
|
112 |
+
self::_renderSelectItem(
|
113 |
+
esc_html__( 'Curve Type', Visualizer_Plugin::NAME ),
|
114 |
+
'curveType',
|
115 |
+
$this->curveType,
|
116 |
+
$this->_curveTypes,
|
117 |
+
esc_html__( 'Determines whether the series has to be presented in the legend or not.', Visualizer_Plugin::NAME )
|
118 |
+
);
|
119 |
+
}
|
120 |
+
|
121 |
+
if ( $this->_includeFocusTarget ) {
|
122 |
+
self::_renderSelectItem(
|
123 |
+
esc_html__( 'Focus Target', Visualizer_Plugin::NAME ),
|
124 |
+
'focusTarget',
|
125 |
+
$this->focusTarget,
|
126 |
+
array(
|
127 |
+
'' => '',
|
128 |
+
'datum' => esc_html__( 'Focus on a single data point.', Visualizer_Plugin::NAME ),
|
129 |
+
'category' => esc_html__( 'Focus on a grouping of all data points along the major axis.', Visualizer_Plugin::NAME ),
|
130 |
+
),
|
131 |
+
esc_html__( 'The type of the entity that receives focus on mouse hover. Also affects which entity is selected by mouse click.', Visualizer_Plugin::NAME )
|
132 |
+
);
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Renders lines settings.
|
138 |
+
*
|
139 |
+
* @since 1.0.0
|
140 |
+
*
|
141 |
+
* @access protected
|
142 |
+
*/
|
143 |
+
protected function _renderLineSettings() {
|
144 |
+
self::_renderGroupStart( esc_html__( 'Lines Settings', Visualizer_Plugin::NAME ) );
|
145 |
+
self::_renderSectionStart();
|
146 |
+
$this->_renderLineSettingsItems();
|
147 |
+
self::_renderSectionEnd();
|
148 |
+
self::_renderGroupEnd();
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Renders concreate series settings.
|
153 |
+
*
|
154 |
+
* @since 1.0.0
|
155 |
+
*
|
156 |
+
* @access protected
|
157 |
+
* @param int $index The series index.
|
158 |
+
*/
|
159 |
+
protected function _renderSeries( $index ) {
|
160 |
+
self::_renderSelectItem(
|
161 |
+
esc_html__( 'Visible In Legend', Visualizer_Plugin::NAME ),
|
162 |
+
'series[' . $index . '][visibleInLegend]',
|
163 |
+
isset( $this->series[$index]['visibleInLegend'] ) ? $this->series[$index]['visibleInLegend'] : '',
|
164 |
+
array(
|
165 |
+
'' => '',
|
166 |
+
'0' => esc_html__( 'No', Visualizer_Plugin::NAME ),
|
167 |
+
'1' => esc_html__( 'Yes', Visualizer_Plugin::NAME ),
|
168 |
+
),
|
169 |
+
esc_html__( 'Determines whether the series has to be presented in the legend or not.', Visualizer_Plugin::NAME )
|
170 |
+
);
|
171 |
+
|
172 |
+
self::_renderTextItem(
|
173 |
+
esc_html__( 'Line Width', Visualizer_Plugin::NAME ),
|
174 |
+
'series[' . $index . '][lineWidth]',
|
175 |
+
isset( $this->series[$index]['lineWidth'] ) ? $this->series[$index]['lineWidth'] : '',
|
176 |
+
esc_html__( 'Overrides the global line width value for this series.', Visualizer_Plugin::NAME ),
|
177 |
+
2
|
178 |
+
);
|
179 |
+
|
180 |
+
self::_renderTextItem(
|
181 |
+
esc_html__( 'Point Size', Visualizer_Plugin::NAME ),
|
182 |
+
'series[' . $index . '][pointSize]',
|
183 |
+
isset( $this->series[$index]['pointSize'] ) ? $this->series[$index]['pointSize'] : '',
|
184 |
+
esc_html__( 'Overrides the global point size value for this series.', Visualizer_Plugin::NAME ),
|
185 |
+
0
|
186 |
+
);
|
187 |
+
|
188 |
+
if ( $this->_includeCurveTypes ) {
|
189 |
+
self::_renderSelectItem(
|
190 |
+
esc_html__( 'Curve Type', Visualizer_Plugin::NAME ),
|
191 |
+
'series[' . $index . '][curveType]',
|
192 |
+
isset( $this->series[$index]['curveType'] ) ? $this->series[$index]['curveType'] : '',
|
193 |
+
$this->_curveTypes,
|
194 |
+
esc_html__( 'Determines whether the series has to be presented in the legend or not.', Visualizer_Plugin::NAME )
|
195 |
+
);
|
196 |
+
}
|
197 |
+
|
198 |
+
self::_renderColorPickerItem(
|
199 |
+
esc_html__( 'Color', Visualizer_Plugin::NAME ),
|
200 |
+
'series[' . $index . '][color]',
|
201 |
+
isset( $this->series[$index]['color'] ) ? $this->series[$index]['color'] : null,
|
202 |
+
null
|
203 |
+
);
|
204 |
+
}
|
205 |
+
|
206 |
+
}
|
classes/Visualizer/Render/Sidebar/Type/Area.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Class for area chart sidebar settings.
|
26 |
+
*
|
27 |
+
* @category Visualizer
|
28 |
+
* @package Render
|
29 |
+
* @subpackage Sidebar
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
*/
|
33 |
+
class Visualizer_Render_Sidebar_Type_Area extends Visualizer_Render_Sidebar_Linear {
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Constructor.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
*
|
40 |
+
* @access public
|
41 |
+
* @param array $data The data what has to be associated with this render.
|
42 |
+
*/
|
43 |
+
public function __construct( $data = array( ) ) {
|
44 |
+
parent::__construct( $data );
|
45 |
+
$this->_includeCurveTypes = false;
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Renders template.
|
50 |
+
*
|
51 |
+
* @since 1.0.0
|
52 |
+
*
|
53 |
+
* @access protected
|
54 |
+
*/
|
55 |
+
protected function _toHTML() {
|
56 |
+
$this->_renderGeneralSettings();
|
57 |
+
$this->_renderAxesSettings();
|
58 |
+
$this->_renderLineSettings();
|
59 |
+
$this->_renderSeriesSettings();
|
60 |
+
$this->_renderViewSettings();
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Renders line settings items.
|
65 |
+
*
|
66 |
+
* @since 1.0.0
|
67 |
+
*
|
68 |
+
* @access protected
|
69 |
+
*/
|
70 |
+
protected function _renderLineSettingsItems() {
|
71 |
+
parent::_renderLineSettingsItems();
|
72 |
+
|
73 |
+
self::_renderSelectItem(
|
74 |
+
esc_html__( 'Is Stacked', Visualizer_Plugin::NAME ),
|
75 |
+
'isStacked',
|
76 |
+
$this->isStacked,
|
77 |
+
$this->_yesno,
|
78 |
+
esc_html__( 'If set to yes, series elements are stacked.', Visualizer_Plugin::NAME )
|
79 |
+
);
|
80 |
+
}
|
81 |
+
|
82 |
+
}
|
classes/Visualizer/Render/Sidebar/Type/Bar.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Class for bar chart sidebar settings.
|
26 |
+
*
|
27 |
+
* @category Visualizer
|
28 |
+
* @package Render
|
29 |
+
* @subpackage Sidebar
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
*/
|
33 |
+
class Visualizer_Render_Sidebar_Type_Bar extends Visualizer_Render_Sidebar_Columnar {
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Constructor.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
*
|
40 |
+
* @access public
|
41 |
+
* @param array $data The data what has to be associated with this render.
|
42 |
+
*/
|
43 |
+
public function __construct( $data = array( ) ) {
|
44 |
+
parent::__construct( $data );
|
45 |
+
|
46 |
+
// disable horizontal gridlines settings
|
47 |
+
$this->_horizontalGridLines = false;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Renders template.
|
52 |
+
*
|
53 |
+
* @since 1.0.0
|
54 |
+
*
|
55 |
+
* @access protected
|
56 |
+
*/
|
57 |
+
protected function _toHTML() {
|
58 |
+
$this->_renderGeneralSettings();
|
59 |
+
$this->_renderAxesSettings();
|
60 |
+
$this->_renderColumnarSettings();
|
61 |
+
$this->_renderSeriesSettings();
|
62 |
+
$this->_renderViewSettings();
|
63 |
+
}
|
64 |
+
|
65 |
+
}
|
classes/Visualizer/Render/Sidebar/Type/Candlestick.php
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Class for candlestick chart sidebar settings.
|
26 |
+
*
|
27 |
+
* @category Visualizer
|
28 |
+
* @package Render
|
29 |
+
* @subpackage Sidebar
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
*/
|
33 |
+
class Visualizer_Render_Sidebar_Type_Candlestick extends Visualizer_Render_Sidebar_Linear {
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Renders template.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
*
|
40 |
+
* @access protected
|
41 |
+
*/
|
42 |
+
protected function _toHTML() {
|
43 |
+
$this->_renderGeneralSettings();
|
44 |
+
$this->_renderAxesSettings();
|
45 |
+
$this->_renderLineSettings();
|
46 |
+
$this->_renderSeriesSettings();
|
47 |
+
$this->_renderViewSettings();
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Renders lines settings.
|
52 |
+
*
|
53 |
+
* @since 1.0.0
|
54 |
+
*
|
55 |
+
* @access protected
|
56 |
+
*/
|
57 |
+
protected function _renderLineSettings() {
|
58 |
+
self::_renderGroupStart( esc_html__( 'Candles Settings', Visualizer_Plugin::NAME ) );
|
59 |
+
self::_renderSectionStart();
|
60 |
+
self::_renderSelectItem(
|
61 |
+
esc_html__( 'Focus Target', Visualizer_Plugin::NAME ),
|
62 |
+
'focusTarget',
|
63 |
+
$this->focusTarget,
|
64 |
+
array(
|
65 |
+
'' => '',
|
66 |
+
'datum' => esc_html__( 'Focus on a single data point.', Visualizer_Plugin::NAME ),
|
67 |
+
'category' => esc_html__( 'Focus on a grouping of all data points along the major axis.', Visualizer_Plugin::NAME ),
|
68 |
+
),
|
69 |
+
esc_html__( 'The type of the entity that receives focus on mouse hover. Also affects which entity is selected by mouse click.', Visualizer_Plugin::NAME )
|
70 |
+
);
|
71 |
+
self::_renderSectionEnd();
|
72 |
+
|
73 |
+
self::_renderSectionStart( esc_html__( 'Failing Candles', Visualizer_Plugin::NAME ), false );
|
74 |
+
self::_renderTextItem(
|
75 |
+
esc_html__( 'Stroke Width', Visualizer_Plugin::NAME ),
|
76 |
+
'candlestick[fallingColor][strokeWidth]',
|
77 |
+
isset( $this->candlestick['fallingColor']['strokeWidth'] ) ? $this->candlestick['fallingColor']['strokeWidth'] : null,
|
78 |
+
esc_html__( 'The stroke width of falling candles.', Visualizer_Plugin::NAME ),
|
79 |
+
'2'
|
80 |
+
);
|
81 |
+
|
82 |
+
self::_renderColorPickerItem(
|
83 |
+
esc_html__( 'Stroke Color', Visualizer_Plugin::NAME ),
|
84 |
+
'candlestick[fallingColor][stroke]',
|
85 |
+
!empty( $this->candlestick['fallingColor']['stroke'] ) ? $this->candlestick['fallingColor']['stroke'] : null,
|
86 |
+
null
|
87 |
+
);
|
88 |
+
|
89 |
+
self::_renderColorPickerItem(
|
90 |
+
esc_html__( 'Fill Color', Visualizer_Plugin::NAME ),
|
91 |
+
'candlestick[fallingColor][fill]',
|
92 |
+
!empty( $this->candlestick['fallingColor']['fill'] ) ? $this->candlestick['fallingColor']['fill'] : null,
|
93 |
+
null
|
94 |
+
);
|
95 |
+
self::_renderSectionEnd();
|
96 |
+
|
97 |
+
self::_renderSectionStart( esc_html__( 'Rising Candles', Visualizer_Plugin::NAME ), false );
|
98 |
+
self::_renderTextItem(
|
99 |
+
esc_html__( 'Stroke Width', Visualizer_Plugin::NAME ),
|
100 |
+
'candlestick[risingColor][strokeWidth]',
|
101 |
+
isset( $this->candlestick['risingColor']['strokeWidth'] ) ? $this->candlestick['risingColor']['strokeWidth'] : null,
|
102 |
+
esc_html__( 'The stroke width of rising candles.', Visualizer_Plugin::NAME ),
|
103 |
+
'2'
|
104 |
+
);
|
105 |
+
|
106 |
+
self::_renderColorPickerItem(
|
107 |
+
esc_html__( 'Stroke Color', Visualizer_Plugin::NAME ),
|
108 |
+
'candlestick[risingColor][stroke]',
|
109 |
+
!empty( $this->candlestick['risingColor']['stroke'] ) ? $this->candlestick['risingColor']['stroke'] : null,
|
110 |
+
null
|
111 |
+
);
|
112 |
+
|
113 |
+
self::_renderColorPickerItem(
|
114 |
+
esc_html__( 'Fill Color', Visualizer_Plugin::NAME ),
|
115 |
+
'candlestick[risingColor][fill]',
|
116 |
+
!empty( $this->candlestick['risingColor']['fill'] ) ? $this->candlestick['risingColor']['fill'] : null,
|
117 |
+
null
|
118 |
+
);
|
119 |
+
self::_renderSectionEnd();
|
120 |
+
self::_renderGroupEnd();
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Renders concreate series settings.
|
125 |
+
*
|
126 |
+
* @since 1.0.0
|
127 |
+
*
|
128 |
+
* @access protected
|
129 |
+
* @param int $index The series index.
|
130 |
+
*/
|
131 |
+
protected function _renderSeries( $index ) {
|
132 |
+
self::_renderSelectItem(
|
133 |
+
esc_html__( 'Visible In Legend', Visualizer_Plugin::NAME ),
|
134 |
+
'series[' . $index . '][visibleInLegend]',
|
135 |
+
isset( $this->series[$index]['visibleInLegend'] ) ? $this->series[$index]['visibleInLegend'] : '',
|
136 |
+
array(
|
137 |
+
'' => '',
|
138 |
+
'0' => esc_html__( 'No', Visualizer_Plugin::NAME ),
|
139 |
+
'1' => esc_html__( 'Yes', Visualizer_Plugin::NAME ),
|
140 |
+
),
|
141 |
+
esc_html__( 'Determines whether the series has to be presented in the legend or not.', Visualizer_Plugin::NAME )
|
142 |
+
);
|
143 |
+
|
144 |
+
self::_renderColorPickerItem(
|
145 |
+
esc_html__( 'Color', Visualizer_Plugin::NAME ),
|
146 |
+
'series[' . $index . '][color]',
|
147 |
+
isset( $this->series[$index]['color'] ) ? $this->series[$index]['color'] : null,
|
148 |
+
null
|
149 |
+
);
|
150 |
+
}
|
151 |
+
|
152 |
+
}
|
classes/Visualizer/Render/Sidebar/Type/Column.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Class for column chart sidebar settings.
|
26 |
+
*
|
27 |
+
* @category Visualizer
|
28 |
+
* @package Render
|
29 |
+
* @subpackage Sidebar
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
*/
|
33 |
+
class Visualizer_Render_Sidebar_Type_Column extends Visualizer_Render_Sidebar_Columnar {
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Constructor.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
*
|
40 |
+
* @access public
|
41 |
+
* @param array $data The data what has to be associated with this render.
|
42 |
+
*/
|
43 |
+
public function __construct( $data = array( ) ) {
|
44 |
+
parent::__construct( $data );
|
45 |
+
|
46 |
+
// disable vertical gridlines settings
|
47 |
+
$this->_verticalGridLines = false;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Renders template.
|
52 |
+
*
|
53 |
+
* @since 1.0.0
|
54 |
+
*
|
55 |
+
* @access protected
|
56 |
+
*/
|
57 |
+
protected function _toHTML() {
|
58 |
+
$this->_renderGeneralSettings();
|
59 |
+
$this->_renderAxesSettings();
|
60 |
+
$this->_renderColumnarSettings();
|
61 |
+
$this->_renderSeriesSettings();
|
62 |
+
$this->_renderViewSettings();
|
63 |
+
}
|
64 |
+
|
65 |
+
}
|
classes/Visualizer/Render/Sidebar/Type/Gauge.php
ADDED
@@ -0,0 +1,254 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Class for gauge chart sidebar settings.
|
26 |
+
*
|
27 |
+
* @category Visualizer
|
28 |
+
* @package Render
|
29 |
+
* @subpackage Sidebar
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
*/
|
33 |
+
class Visualizer_Render_Sidebar_Type_Gauge extends Visualizer_Render_Sidebar {
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Renders template.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
*
|
40 |
+
* @access protected
|
41 |
+
*/
|
42 |
+
protected function _toHTML() {
|
43 |
+
$this->_renderGeneralSettings();
|
44 |
+
$this->_renderGreenColorSettings();
|
45 |
+
$this->_renderYellowColorSettings();
|
46 |
+
$this->_renderRedColorSettings();
|
47 |
+
$this->_renderViewSettings();
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Renders chart general settings group.
|
52 |
+
*
|
53 |
+
* @since 1.0.0
|
54 |
+
*
|
55 |
+
* @access protected
|
56 |
+
*/
|
57 |
+
protected function _renderGeneralSettings() {
|
58 |
+
self::_renderGroupStart( esc_html__( 'General Settings', Visualizer_Plugin::NAME ) );
|
59 |
+
self::_renderSectionStart();
|
60 |
+
|
61 |
+
echo '<div class="section-item">';
|
62 |
+
echo '<a class="more-info" href="javascript:;">[?]</a>';
|
63 |
+
echo '<b>', esc_html__( 'Min And Max Values', Visualizer_Plugin::NAME ), '</b>';
|
64 |
+
|
65 |
+
echo '<table class="section-table" cellspacing="0" cellpadding="0" border="0">';
|
66 |
+
echo '<tr>';
|
67 |
+
echo '<td class="section-table-column">';
|
68 |
+
echo '<input type="text" name="min" class="control-text" value="', esc_attr( $this->min ), '" placeholder="0">';
|
69 |
+
echo '</td>';
|
70 |
+
echo '<td class="section-table-column">';
|
71 |
+
echo '<input type="text" name="max" class="control-text" value="', esc_attr( $this->max ), '" placeholder="100">';
|
72 |
+
echo '</td>';
|
73 |
+
echo '</tr>';
|
74 |
+
echo '</table>';
|
75 |
+
|
76 |
+
echo '<p class="section-description">';
|
77 |
+
esc_html_e( 'The maximal and minimal values of the gauge.', Visualizer_Plugin::NAME );
|
78 |
+
echo '</p>';
|
79 |
+
echo '</div>';
|
80 |
+
|
81 |
+
self::_renderTextItem(
|
82 |
+
esc_html__( 'Minor Ticks', Visualizer_Plugin::NAME ),
|
83 |
+
'minorTicks',
|
84 |
+
$this->minorTicks,
|
85 |
+
esc_html__( 'The number of minor tick section in each major tick section.', Visualizer_Plugin::NAME ),
|
86 |
+
2
|
87 |
+
);
|
88 |
+
|
89 |
+
self::_renderSectionEnd();
|
90 |
+
self::_renderGroupEnd();
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Renders green color settings group.
|
95 |
+
*
|
96 |
+
* @since 1.0.0
|
97 |
+
*
|
98 |
+
* @access protected
|
99 |
+
*/
|
100 |
+
protected function _renderGreenColorSettings() {
|
101 |
+
self::_renderGroupStart( esc_html__( 'Green Color', Visualizer_Plugin::NAME ) );
|
102 |
+
self::_renderSectionStart();
|
103 |
+
self::_renderSectionDescription( esc_html__( 'Configure the green section of the gauge chart.', Visualizer_Plugin::NAME ) );
|
104 |
+
|
105 |
+
echo '<div class="section-item">';
|
106 |
+
echo '<a class="more-info" href="javascript:;">[?]</a>';
|
107 |
+
echo '<b>', esc_html__( 'From And To Range', Visualizer_Plugin::NAME ), '</b>';
|
108 |
+
|
109 |
+
echo '<table class="section-table" cellspacing="0" cellpadding="0" border="0">';
|
110 |
+
echo '<tr>';
|
111 |
+
echo '<td class="section-table-column">';
|
112 |
+
echo '<input type="text" name="greenFrom" class="control-text" value="', esc_attr( $this->greenFrom ), '">';
|
113 |
+
echo '</td>';
|
114 |
+
echo '<td class="section-table-column">';
|
115 |
+
echo '<input type="text" name="greenTo" class="control-text" value="', esc_attr( $this->greenTo ), '">';
|
116 |
+
echo '</td>';
|
117 |
+
echo '</tr>';
|
118 |
+
echo '</table>';
|
119 |
+
|
120 |
+
echo '<p class="section-description">';
|
121 |
+
esc_html_e( 'The lowest and highest values for a range marked by a green color.', Visualizer_Plugin::NAME );
|
122 |
+
echo '</p>';
|
123 |
+
echo '</div>';
|
124 |
+
|
125 |
+
self::_renderColorPickerItem(
|
126 |
+
esc_html__( 'Green Color', Visualizer_Plugin::NAME ),
|
127 |
+
'greenColor',
|
128 |
+
$this->greenColor,
|
129 |
+
'#109618'
|
130 |
+
);
|
131 |
+
self::_renderSectionEnd();
|
132 |
+
self::_renderGroupEnd();
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Renders yellow color settings group.
|
137 |
+
*
|
138 |
+
* @since 1.0.0
|
139 |
+
*
|
140 |
+
* @access protected
|
141 |
+
*/
|
142 |
+
protected function _renderYellowColorSettings() {
|
143 |
+
self::_renderGroupStart( esc_html__( 'Yellow Color', Visualizer_Plugin::NAME ) );
|
144 |
+
self::_renderSectionStart();
|
145 |
+
self::_renderSectionDescription( esc_html__( 'Configure the yellow section of the gauge chart.', Visualizer_Plugin::NAME ) );
|
146 |
+
|
147 |
+
echo '<div class="section-item">';
|
148 |
+
echo '<a class="more-info" href="javascript:;">[?]</a>';
|
149 |
+
echo '<b>', esc_html__( 'From And To Range', Visualizer_Plugin::NAME ), '</b>';
|
150 |
+
|
151 |
+
echo '<table class="section-table" cellspacing="0" cellpadding="0" border="0">';
|
152 |
+
echo '<tr>';
|
153 |
+
echo '<td class="section-table-column">';
|
154 |
+
echo '<input type="text" name="yellowFrom" class="control-text" value="', esc_attr( $this->yellowFrom ), '">';
|
155 |
+
echo '</td>';
|
156 |
+
echo '<td class="section-table-column">';
|
157 |
+
echo '<input type="text" name="yellowTo" class="control-text" value="', esc_attr( $this->yellowTo ), '">';
|
158 |
+
echo '</td>';
|
159 |
+
echo '</tr>';
|
160 |
+
echo '</table>';
|
161 |
+
|
162 |
+
echo '<p class="section-description">';
|
163 |
+
esc_html_e( 'The lowest and highest values for a range marked by a yellow color.', Visualizer_Plugin::NAME );
|
164 |
+
echo '</p>';
|
165 |
+
echo '</div>';
|
166 |
+
|
167 |
+
self::_renderColorPickerItem(
|
168 |
+
esc_html__( 'Yellow Color', Visualizer_Plugin::NAME ),
|
169 |
+
'yellowColor',
|
170 |
+
$this->yellowColor,
|
171 |
+
'#FF9900'
|
172 |
+
);
|
173 |
+
self::_renderSectionEnd();
|
174 |
+
self::_renderGroupEnd();
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Renders red color settings group.
|
179 |
+
*
|
180 |
+
* @since 1.0.0
|
181 |
+
*
|
182 |
+
* @access protected
|
183 |
+
*/
|
184 |
+
protected function _renderRedColorSettings() {
|
185 |
+
self::_renderGroupStart( esc_html__( 'Red Color', Visualizer_Plugin::NAME ) );
|
186 |
+
self::_renderSectionStart();
|
187 |
+
self::_renderSectionDescription( esc_html__( 'Configure the red section of the gauge chart.', Visualizer_Plugin::NAME ) );
|
188 |
+
|
189 |
+
echo '<div class="section-item">';
|
190 |
+
echo '<a class="more-info" href="javascript:;">[?]</a>';
|
191 |
+
echo '<b>', esc_html__( 'From And To Range', Visualizer_Plugin::NAME ), '</b>';
|
192 |
+
|
193 |
+
echo '<table class="section-table" cellspacing="0" cellpadding="0" border="0">';
|
194 |
+
echo '<tr>';
|
195 |
+
echo '<td class="section-table-column">';
|
196 |
+
echo '<input type="text" name="redFrom" class="control-text" value="', esc_attr( $this->redFrom ), '">';
|
197 |
+
echo '</td>';
|
198 |
+
echo '<td class="section-table-column">';
|
199 |
+
echo '<input type="text" name="redTo" class="control-text" value="', esc_attr( $this->redTo ), '">';
|
200 |
+
echo '</td>';
|
201 |
+
echo '</tr>';
|
202 |
+
echo '</table>';
|
203 |
+
|
204 |
+
echo '<p class="section-description">';
|
205 |
+
esc_html_e( 'The lowest and highest values for a range marked by a red color.', Visualizer_Plugin::NAME );
|
206 |
+
echo '</p>';
|
207 |
+
echo '</div>';
|
208 |
+
|
209 |
+
self::_renderColorPickerItem(
|
210 |
+
esc_html__( 'Red Color', Visualizer_Plugin::NAME ),
|
211 |
+
'redColor',
|
212 |
+
$this->redColor,
|
213 |
+
'#DC3912'
|
214 |
+
);
|
215 |
+
self::_renderSectionEnd();
|
216 |
+
self::_renderGroupEnd();
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Renders chart view settings group.
|
221 |
+
*
|
222 |
+
* @since 1.0.0
|
223 |
+
*
|
224 |
+
* @access protected
|
225 |
+
*/
|
226 |
+
protected function _renderViewSettings() {
|
227 |
+
self::_renderGroupStart( esc_html__( 'Layout & Chart Area', Visualizer_Plugin::NAME ) );
|
228 |
+
self::_renderSectionStart();
|
229 |
+
self::_renderSectionDescription( esc_html__( 'Configure the total size of the chart. Two formats are supported: a number, or a number followed by %. A simple number is a value in pixels; a number followed by % is a percentage.', Visualizer_Plugin::NAME ) );
|
230 |
+
|
231 |
+
echo '<div class="section-item">';
|
232 |
+
echo '<a class="more-info" href="javascript:;">[?]</a>';
|
233 |
+
echo '<b>', esc_html__( 'Width And Height Of Chart', Visualizer_Plugin::NAME ), '</b>';
|
234 |
+
|
235 |
+
echo '<table class="section-table" cellspacing="0" cellpadding="0" border="0">';
|
236 |
+
echo '<tr>';
|
237 |
+
echo '<td class="section-table-column">';
|
238 |
+
echo '<input type="text" name="width" class="control-text" value="', esc_attr( $this->width ), '" placeholder="100%">';
|
239 |
+
echo '</td>';
|
240 |
+
echo '<td class="section-table-column">';
|
241 |
+
echo '<input type="text" name="height" class="control-text" value="', esc_attr( $this->height ), '" placeholder="400">';
|
242 |
+
echo '</td>';
|
243 |
+
echo '</tr>';
|
244 |
+
echo '</table>';
|
245 |
+
|
246 |
+
echo '<p class="section-description">';
|
247 |
+
esc_html_e( 'Determines the total width and height of the chart.', Visualizer_Plugin::NAME );
|
248 |
+
echo '</p>';
|
249 |
+
echo '</div>';
|
250 |
+
self::_renderSectionEnd();
|
251 |
+
self::_renderGroupEnd();
|
252 |
+
}
|
253 |
+
|
254 |
+
}
|
classes/Visualizer/Render/Sidebar/Type/Geo.php
ADDED
@@ -0,0 +1,360 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Class for geo chart sidebar settings.
|
26 |
+
*
|
27 |
+
* @category Visualizer
|
28 |
+
* @package Render
|
29 |
+
* @subpackage Sidebar
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
*/
|
33 |
+
class Visualizer_Render_Sidebar_Type_Geo extends Visualizer_Render_Sidebar {
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Renders template.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
*
|
40 |
+
* @access protected
|
41 |
+
*/
|
42 |
+
protected function _toHTML() {
|
43 |
+
$this->_renderMapSettings();
|
44 |
+
$this->_renderColorAxisSettings();
|
45 |
+
$this->_renderSizeAxisSettings();
|
46 |
+
$this->_renderMagnifyingGlassSettings();
|
47 |
+
$this->_renderViewSettings();
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Renders map settings group.
|
52 |
+
*
|
53 |
+
* @since 1.0.0
|
54 |
+
*
|
55 |
+
* @access protected
|
56 |
+
*/
|
57 |
+
protected function _renderMapSettings() {
|
58 |
+
self::_renderGroupStart( esc_html__( 'Map Settings', Visualizer_Plugin::NAME ) );
|
59 |
+
self::_renderSectionStart( esc_html__( 'Region', Visualizer_Plugin::NAME ), false );
|
60 |
+
self::_renderSectionDescription(
|
61 |
+
esc_html__( 'Configure the region area to display on the map. (Surrounding areas will be displayed as well.) Can be one of the following:' ) .
|
62 |
+
'<ul>' .
|
63 |
+
'<li>' . esc_html__( "'world' - A map of the entire world.", Visualizer_Plugin::NAME ) . '</li>' .
|
64 |
+
'<li>' . sprintf( esc_html__( "A continent or a sub-continent, specified by its %s code, e.g., '011' for Western Africa.", Visualizer_Plugin::NAME ), '<a href="https://google-developers.appspot.com/chart/interactive/docs/gallery/geochart#Continent_Hierarchy" target="_blank">3-digit</a>' ) . '</li>' .
|
65 |
+
'<li>' . sprintf( esc_html__( "A country, specified by its %s code, e.g., 'AU' for Australia.", Visualizer_Plugin::NAME ), '<a href="http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2" target="_blank">ISO 3166-1 alpha-2</a>' ) . '</li>' .
|
66 |
+
'<li>' . sprintf( esc_html__( "A state in the United States, specified by its %s code, e.g., 'US-AL' for Alabama. Note that the resolution option must be set to either 'provinces' or 'metros'.", Visualizer_Plugin::NAME ), '<a href="http://en.wikipedia.org/wiki/ISO_3166-2:US" target="_blank">ISO 3166-2:US</a>' ) . '</li>' .
|
67 |
+
'</ul>'
|
68 |
+
);
|
69 |
+
|
70 |
+
self::_renderTextItem(
|
71 |
+
esc_html__( 'Region', Visualizer_Plugin::NAME ),
|
72 |
+
'region',
|
73 |
+
$this->region,
|
74 |
+
'',
|
75 |
+
'world'
|
76 |
+
);
|
77 |
+
|
78 |
+
self::_renderSectionEnd();
|
79 |
+
self::_renderSectionStart( esc_html__( 'Resolution', Visualizer_Plugin::NAME ), false );
|
80 |
+
|
81 |
+
self::_renderSectionDescription(
|
82 |
+
esc_html__( 'The resolution of the map borders. Choose one of the following values:' ) .
|
83 |
+
'<ul>' .
|
84 |
+
'<li>' . esc_html__( "'countries' - Supported for all regions, except for US state regions.", Visualizer_Plugin::NAME ) . '</li>' .
|
85 |
+
'<li>' . esc_html__( "'provinces' - Supported only for country regions and US state regions. Not supported for all countries; please test a country to see whether this option is supported.", Visualizer_Plugin::NAME ) . '</li>' .
|
86 |
+
'<li>' . esc_html__( "'metros' - Supported for the US country region and US state regions only.", Visualizer_Plugin::NAME ) . '</li>' .
|
87 |
+
'</ul>'
|
88 |
+
);
|
89 |
+
|
90 |
+
self::_renderSelectItem(
|
91 |
+
esc_html__( 'Resolution', Visualizer_Plugin::NAME ),
|
92 |
+
'resolution',
|
93 |
+
$this->resolution,
|
94 |
+
array(
|
95 |
+
'' => '',
|
96 |
+
'countries' => esc_html__( 'Countries', Visualizer_Plugin::NAME ),
|
97 |
+
'provinces' => esc_html__( 'Provinces', Visualizer_Plugin::NAME ),
|
98 |
+
'metros' => esc_html__( 'Metros', Visualizer_Plugin::NAME ),
|
99 |
+
),
|
100 |
+
''
|
101 |
+
);
|
102 |
+
|
103 |
+
self::_renderSectionEnd();
|
104 |
+
self::_renderSectionStart( esc_html__( 'Display Mode', Visualizer_Plugin::NAME ), false );
|
105 |
+
|
106 |
+
self::_renderSectionDescription(
|
107 |
+
esc_html__( 'Determines which type of map this is. The following values are supported:' ) .
|
108 |
+
'<ul>' .
|
109 |
+
'<li>' . esc_html__( "'auto' - Choose based on the format of the data.", Visualizer_Plugin::NAME ) . '</li>' .
|
110 |
+
'<li>' . esc_html__( "'regions' - This is a region map.", Visualizer_Plugin::NAME ) . '</li>' .
|
111 |
+
'<li>' . esc_html__( "'markers' - This is a marker map.", Visualizer_Plugin::NAME ) . '</li>' .
|
112 |
+
'</ul>'
|
113 |
+
);
|
114 |
+
|
115 |
+
self::_renderSelectItem(
|
116 |
+
esc_html__( 'Display Mode', Visualizer_Plugin::NAME ),
|
117 |
+
'displayMode',
|
118 |
+
$this->displayMode,
|
119 |
+
array(
|
120 |
+
'' => '',
|
121 |
+
'auto' => esc_html__( 'Auto', Visualizer_Plugin::NAME ),
|
122 |
+
'regions' => esc_html__( 'Regions', Visualizer_Plugin::NAME ),
|
123 |
+
'markers' => esc_html__( 'Markers', Visualizer_Plugin::NAME ),
|
124 |
+
),
|
125 |
+
''
|
126 |
+
);
|
127 |
+
self::_renderSectionEnd();
|
128 |
+
self::_renderGroupEnd();
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Renders color axis settings group.
|
133 |
+
*
|
134 |
+
* @since 1.0.0
|
135 |
+
*
|
136 |
+
* @access protected
|
137 |
+
*/
|
138 |
+
protected function _renderColorAxisSettings() {
|
139 |
+
self::_renderGroupStart( esc_html__( 'Color Axis', Visualizer_Plugin::NAME ) );
|
140 |
+
self::_renderSectionStart();
|
141 |
+
self::_renderSectionDescription( esc_html__( 'Configure color axis gradient scale, minimum and maximun values and a color of the dateless regions.', Visualizer_Plugin::NAME ) );
|
142 |
+
|
143 |
+
echo '<div class="section-item">';
|
144 |
+
echo '<a class="more-info" href="javascript:;">[?]</a>';
|
145 |
+
echo '<b>', esc_html__( 'Minimum And Maximum Values', Visualizer_Plugin::NAME ), '</b>';
|
146 |
+
|
147 |
+
echo '<table class="section-table" cellspacing="0" cellpadding="0" border="0">';
|
148 |
+
echo '<tr>';
|
149 |
+
echo '<td class="section-table-column">';
|
150 |
+
echo '<input type="text" name="colorAxis[minValue]" class="control-text" value="', isset( $this->colorAxis['minValue'] ) ? esc_attr( $this->colorAxis['minValue'] ) : '', '">';
|
151 |
+
echo '</td>';
|
152 |
+
echo '<td class="section-table-column">';
|
153 |
+
echo '<input type="text" name="colorAxis[maxValue]" class="control-text" value="', isset( $this->colorAxis['maxValue'] ) ? esc_attr( $this->colorAxis['maxValue'] ) : '', '">';
|
154 |
+
echo '</td>';
|
155 |
+
echo '</tr>';
|
156 |
+
echo '</table>';
|
157 |
+
|
158 |
+
echo '<p class="section-description">';
|
159 |
+
esc_html_e( 'Determines the minimum and maximum values of color axis.', Visualizer_Plugin::NAME );
|
160 |
+
echo '</p>';
|
161 |
+
echo '</div>';
|
162 |
+
|
163 |
+
self::_renderColorPickerItem(
|
164 |
+
esc_html__( 'Minimum Value', Visualizer_Plugin::NAME ),
|
165 |
+
'colorAxis[colors][]',
|
166 |
+
!empty( $this->colorAxis['color'][0] ) ? $this->colorAxis['color'][0] : null,
|
167 |
+
'#efe6dc'
|
168 |
+
);
|
169 |
+
|
170 |
+
self::_renderColorPickerItem(
|
171 |
+
esc_html__( 'Intermediate Value', Visualizer_Plugin::NAME ),
|
172 |
+
'colorAxis[colors][]',
|
173 |
+
!empty( $this->colorAxis['color'][1] ) ? $this->colorAxis['color'][1] : null,
|
174 |
+
'#82bf7c'
|
175 |
+
);
|
176 |
+
|
177 |
+
self::_renderColorPickerItem(
|
178 |
+
esc_html__( 'Maximum Value', Visualizer_Plugin::NAME ),
|
179 |
+
'colorAxis[colors][]',
|
180 |
+
!empty( $this->colorAxis['color'][2] ) ? $this->colorAxis['color'][2] : null,
|
181 |
+
'#109618'
|
182 |
+
);
|
183 |
+
|
184 |
+
self::_renderColorPickerItem(
|
185 |
+
esc_html__( 'Dateless Region', Visualizer_Plugin::NAME ),
|
186 |
+
'datalessRegionColor',
|
187 |
+
!empty( $this->datalessRegionColor ) ? $this->datalessRegionColor : null,
|
188 |
+
null
|
189 |
+
);
|
190 |
+
|
191 |
+
self::_renderSectionEnd();
|
192 |
+
self::_renderGroupEnd();
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Renders size axis settings group.
|
197 |
+
*
|
198 |
+
* @since 1.0.0
|
199 |
+
*
|
200 |
+
* @access protected
|
201 |
+
*/
|
202 |
+
protected function _renderSizeAxisSettings() {
|
203 |
+
self::_renderGroupStart( esc_html__( 'Size Axis', Visualizer_Plugin::NAME ) );
|
204 |
+
self::_renderSectionStart();
|
205 |
+
self::_renderSectionDescription( esc_html__( 'Configure how values are associated with bubble size, minimum and maximun values and marker opacity setting.', Visualizer_Plugin::NAME ) );
|
206 |
+
|
207 |
+
echo '<div class="section-item">';
|
208 |
+
echo '<a class="more-info" href="javascript:;">[?]</a>';
|
209 |
+
echo '<b>', esc_html__( 'Minimum And Maximum Values', Visualizer_Plugin::NAME ), '</b>';
|
210 |
+
|
211 |
+
echo '<table class="section-table" cellspacing="0" cellpadding="0" border="0">';
|
212 |
+
echo '<tr>';
|
213 |
+
echo '<td class="section-table-column">';
|
214 |
+
echo '<input type="text" name="sizeAxis[minValue]" class="control-text" value="', isset( $this->sizeAxis['minValue'] ) ? esc_attr( $this->sizeAxis['minValue'] ) : '', '">';
|
215 |
+
echo '</td>';
|
216 |
+
echo '<td class="section-table-column">';
|
217 |
+
echo '<input type="text" name="sizeAxis[maxValue]" class="control-text" value="', isset( $this->sizeAxis['maxValue'] ) ? esc_attr( $this->sizeAxis['maxValue'] ) : '', '">';
|
218 |
+
echo '</td>';
|
219 |
+
echo '</tr>';
|
220 |
+
echo '</table>';
|
221 |
+
|
222 |
+
echo '<p class="section-description">';
|
223 |
+
esc_html_e( 'Determines the minimum and maximum values of size axis.', Visualizer_Plugin::NAME );
|
224 |
+
echo '</p>';
|
225 |
+
echo '</div>';
|
226 |
+
|
227 |
+
echo '<div class="section-item">';
|
228 |
+
echo '<a class="more-info" href="javascript:;">[?]</a>';
|
229 |
+
echo '<b>', esc_html__( 'Minimum And Maximum Marker Radius', Visualizer_Plugin::NAME ), '</b>';
|
230 |
+
|
231 |
+
echo '<table class="section-table" cellspacing="0" cellpadding="0" border="0">';
|
232 |
+
echo '<tr>';
|
233 |
+
echo '<td class="section-table-column">';
|
234 |
+
echo '<input type="text" name="sizeAxis[minSize]" class="control-text" value="', isset( $this->sizeAxis['minSize'] ) ? esc_attr( $this->sizeAxis['minSize'] ) : '', '" placeholder="3">';
|
235 |
+
echo '</td>';
|
236 |
+
echo '<td class="section-table-column">';
|
237 |
+
echo '<input type="text" name="sizeAxis[maxSize]" class="control-text" value="', isset( $this->sizeAxis['maxSize'] ) ? esc_attr( $this->sizeAxis['maxSize'] ) : '', '" placeholder="12">';
|
238 |
+
echo '</td>';
|
239 |
+
echo '</tr>';
|
240 |
+
echo '</table>';
|
241 |
+
|
242 |
+
echo '<p class="section-description">';
|
243 |
+
esc_html_e( 'Determines the radius of the smallest and largest possible bubbles, in pixels.', Visualizer_Plugin::NAME );
|
244 |
+
echo '</p>';
|
245 |
+
echo '</div>';
|
246 |
+
|
247 |
+
self::_renderTextItem(
|
248 |
+
esc_html__( 'Marker Opacity', Visualizer_Plugin::NAME ),
|
249 |
+
'markerOpacity',
|
250 |
+
$this->markerOpacity,
|
251 |
+
esc_html__( 'The opacity of the markers, where 0.0 is fully transparent and 1.0 is fully opaque.', Visualizer_Plugin::NAME ),
|
252 |
+
'1.0'
|
253 |
+
);
|
254 |
+
|
255 |
+
self::_renderSectionEnd();
|
256 |
+
self::_renderGroupEnd();
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Renders magnifying glass settings.
|
261 |
+
*
|
262 |
+
* @since 1.0.0
|
263 |
+
*
|
264 |
+
* @access protected
|
265 |
+
*/
|
266 |
+
protected function _renderMagnifyingGlassSettings() {
|
267 |
+
self::_renderGroupStart( esc_html__( 'Magnifying Glass', Visualizer_Plugin::NAME ) );
|
268 |
+
self::_renderSectionStart();
|
269 |
+
self::_renderSectionDescription( esc_html__( 'Configure magnifying glass settings, which appears, when the user lingers over a cluttered marker. Note: this feature is not supported in browsers that do not support SVG, i.e. Internet Explorer version 8 or earlier.', Visualizer_Plugin::NAME ) );
|
270 |
+
|
271 |
+
self::_renderSelectItem(
|
272 |
+
esc_html__( 'Enabled', Visualizer_Plugin::NAME ),
|
273 |
+
'magnifyingGlass[enable]',
|
274 |
+
isset( $this->magnifyingGlass['enable'] ) ? $this->magnifyingGlass['enable'] : '',
|
275 |
+
$this->_yesno,
|
276 |
+
esc_html__( 'If yes, when the user lingers over a cluttered marker, a magnifiying glass will be opened.', Visualizer_Plugin::NAME )
|
277 |
+
);
|
278 |
+
|
279 |
+
self::_renderTextItem(
|
280 |
+
esc_html__( 'Zoom Factor', Visualizer_Plugin::NAME ),
|
281 |
+
'magnifyingGlass[zoomFactor]',
|
282 |
+
isset( $this->magnifyingGlass['zoomFactor'] ) ? $this->magnifyingGlass['zoomFactor'] : '',
|
283 |
+
esc_html__( 'The zoom factor of the magnifying glass. Can be any number greater than 0.', Visualizer_Plugin::NAME ),
|
284 |
+
'5.0'
|
285 |
+
);
|
286 |
+
self::_renderSectionEnd();
|
287 |
+
self::_renderGroupEnd();
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Renders chart view settings group.
|
292 |
+
*
|
293 |
+
* @since 1.0.0
|
294 |
+
*
|
295 |
+
* @access protected
|
296 |
+
*/
|
297 |
+
protected function _renderViewSettings() {
|
298 |
+
self::_renderGroupStart( esc_html__( 'Layout Settings', Visualizer_Plugin::NAME ) );
|
299 |
+
self::_renderSectionStart();
|
300 |
+
self::_renderSectionDescription( esc_html__( 'Configure the total size of the chart. Two formats are supported: a number, or a number followed by %. A simple number is a value in pixels; a number followed by % is a percentage.', Visualizer_Plugin::NAME ) );
|
301 |
+
|
302 |
+
echo '<div class="section-item">';
|
303 |
+
echo '<a class="more-info" href="javascript:;">[?]</a>';
|
304 |
+
echo '<b>', esc_html__( 'Width And Height Of Chart', Visualizer_Plugin::NAME ), '</b>';
|
305 |
+
|
306 |
+
echo '<table class="section-table" cellspacing="0" cellpadding="0" border="0">';
|
307 |
+
echo '<tr>';
|
308 |
+
echo '<td class="section-table-column">';
|
309 |
+
echo '<input type="text" name="width" class="control-text" value="', esc_attr( $this->width ), '" placeholder="100%">';
|
310 |
+
echo '</td>';
|
311 |
+
echo '<td class="section-table-column">';
|
312 |
+
echo '<input type="text" name="height" class="control-text" value="', esc_attr( $this->height ), '" placeholder="400">';
|
313 |
+
echo '</td>';
|
314 |
+
echo '</tr>';
|
315 |
+
echo '</table>';
|
316 |
+
|
317 |
+
echo '<p class="section-description">';
|
318 |
+
esc_html_e( 'Determines the total width and height of the chart.', Visualizer_Plugin::NAME );
|
319 |
+
echo '</p>';
|
320 |
+
echo '</div>';
|
321 |
+
|
322 |
+
self::_renderSelectItem(
|
323 |
+
esc_html__( 'Keep Aspect Ratio', Visualizer_Plugin::NAME ),
|
324 |
+
'keepAspectRatio',
|
325 |
+
$this->keepAspectRatio,
|
326 |
+
$this->_yesno,
|
327 |
+
esc_html__( 'If yes, the map will be drawn at the largest size that can fit inside the chart area at its natural aspect ratio. If only one of the width and height options is specified, the other one will be calculated according to the aspect ratio.', Visualizer_Plugin::NAME ) . '<br><br>' .
|
328 |
+
esc_html__( 'If no, the map will be stretched to the exact size of the chart as specified by the width and height options.', Visualizer_Plugin::NAME )
|
329 |
+
);
|
330 |
+
|
331 |
+
echo '<div class="section-delimiter"></div>';
|
332 |
+
|
333 |
+
self::_renderSectionDescription( esc_html__( 'Configure the background color for the main area of the chart and the chart border width and color.', Visualizer_Plugin::NAME ) );
|
334 |
+
|
335 |
+
self::_renderTextItem(
|
336 |
+
esc_html__( 'Stroke Width', Visualizer_Plugin::NAME ),
|
337 |
+
'backgroundColor[strokeWidth]',
|
338 |
+
isset( $this->backgroundColor['strokeWidth'] ) ? $this->backgroundColor['strokeWidth'] : null,
|
339 |
+
esc_html__( 'The chart border width in pixels.', Visualizer_Plugin::NAME ),
|
340 |
+
'0'
|
341 |
+
);
|
342 |
+
|
343 |
+
self::_renderColorPickerItem(
|
344 |
+
esc_html__( 'Stroke Color', Visualizer_Plugin::NAME ),
|
345 |
+
'backgroundColor[stroke]',
|
346 |
+
!empty( $this->backgroundColor['stroke'] ) ? $this->backgroundColor['stroke'] : null,
|
347 |
+
'#666'
|
348 |
+
);
|
349 |
+
|
350 |
+
self::_renderColorPickerItem(
|
351 |
+
esc_html__( 'Background Color', Visualizer_Plugin::NAME ),
|
352 |
+
'backgroundColor[fill]',
|
353 |
+
!empty( $this->backgroundColor['fill'] ) ? $this->backgroundColor['fill'] : null,
|
354 |
+
'#fff'
|
355 |
+
);
|
356 |
+
self::_renderSectionEnd();
|
357 |
+
self::_renderGroupEnd();
|
358 |
+
}
|
359 |
+
|
360 |
+
}
|
classes/Visualizer/Render/Sidebar/Type/Line.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Class for line chart sidebar settings.
|
26 |
+
*
|
27 |
+
* @category Visualizer
|
28 |
+
* @package Render
|
29 |
+
* @subpackage Sidebar
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
*/
|
33 |
+
class Visualizer_Render_Sidebar_Type_Line extends Visualizer_Render_Sidebar_Linear {
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Renders template.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
*
|
40 |
+
* @access protected
|
41 |
+
*/
|
42 |
+
protected function _toHTML() {
|
43 |
+
$this->_renderGeneralSettings();
|
44 |
+
$this->_renderAxesSettings();
|
45 |
+
$this->_renderLineSettings();
|
46 |
+
$this->_renderSeriesSettings();
|
47 |
+
$this->_renderViewSettings();
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
classes/Visualizer/Render/Sidebar/Type/Pie.php
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Class for pie chart sidebar settings.
|
26 |
+
*
|
27 |
+
* @category Visualizer
|
28 |
+
* @package Render
|
29 |
+
* @subpackage Sidebar
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
*/
|
33 |
+
class Visualizer_Render_Sidebar_Type_Pie extends Visualizer_Render_Sidebar {
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Renders template.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
*
|
40 |
+
* @access protected
|
41 |
+
*/
|
42 |
+
protected function _toHTML() {
|
43 |
+
$this->_renderGeneralSettings();
|
44 |
+
$this->_renderPieSettings();
|
45 |
+
$this->_renderResidueSettings();
|
46 |
+
$this->_renderSlicesSettings();
|
47 |
+
$this->_renderViewSettings();
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Renders pie settings group.
|
52 |
+
*
|
53 |
+
* @since 1.0.0
|
54 |
+
*
|
55 |
+
* @access protected
|
56 |
+
*/
|
57 |
+
protected function _renderPieSettings() {
|
58 |
+
self::_renderGroupStart( esc_html__( 'Pie Settings', Visualizer_Plugin::NAME ) );
|
59 |
+
self::_renderSectionStart();
|
60 |
+
self::_renderSelectItem(
|
61 |
+
esc_html__( 'Is 3D', Visualizer_Plugin::NAME ),
|
62 |
+
'is3D',
|
63 |
+
$this->is3D,
|
64 |
+
$this->_yesno,
|
65 |
+
esc_html__( 'If set to yes, displays a three-dimensional chart.', Visualizer_Plugin::NAME )
|
66 |
+
);
|
67 |
+
|
68 |
+
self::_renderSelectItem(
|
69 |
+
esc_html__( 'Reverse Categories', Visualizer_Plugin::NAME ),
|
70 |
+
'reverseCategories',
|
71 |
+
$this->reverseCategories,
|
72 |
+
$this->_yesno,
|
73 |
+
esc_html__( 'If set to yes, will draw slices counterclockwise.', Visualizer_Plugin::NAME )
|
74 |
+
);
|
75 |
+
|
76 |
+
self::_renderSelectItem(
|
77 |
+
esc_html__( 'Slice Text', Visualizer_Plugin::NAME ),
|
78 |
+
'pieSliceText',
|
79 |
+
$this->pieSliceText,
|
80 |
+
array(
|
81 |
+
'' => '',
|
82 |
+
'percentage' => esc_html__( 'The percentage of the slice size out of the total', Visualizer_Plugin::NAME ),
|
83 |
+
'value' => esc_html__( 'The quantitative value of the slice', Visualizer_Plugin::NAME ),
|
84 |
+
'label' => esc_html__( 'The name of the slice', Visualizer_Plugin::NAME ),
|
85 |
+
'none' => esc_html__( 'No text is displayed', Visualizer_Plugin::NAME ),
|
86 |
+
),
|
87 |
+
esc_html__( 'The content of the text displayed on the slice.', Visualizer_Plugin::NAME )
|
88 |
+
);
|
89 |
+
|
90 |
+
self::_renderColorPickerItem(
|
91 |
+
esc_html__( 'Slice Border Color', Visualizer_Plugin::NAME ),
|
92 |
+
'pieSliceBorderColor',
|
93 |
+
$this->pieSliceBorderColor,
|
94 |
+
'#fff'
|
95 |
+
);
|
96 |
+
self::_renderSectionEnd();
|
97 |
+
self::_renderGroupEnd();
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Renders residue settings group.
|
102 |
+
*
|
103 |
+
* @since 1.0.0
|
104 |
+
*
|
105 |
+
* @access protected
|
106 |
+
*/
|
107 |
+
protected function _renderResidueSettings() {
|
108 |
+
self::_renderGroupStart( esc_html__( 'Residue Settings', Visualizer_Plugin::NAME ) );
|
109 |
+
self::_renderSectionStart();
|
110 |
+
self::_renderTextItem(
|
111 |
+
esc_html__( 'Visibility Threshold', Visualizer_Plugin::NAME ),
|
112 |
+
'sliceVisibilityThreshold',
|
113 |
+
$this->sliceVisibilityThreshold,
|
114 |
+
esc_html__( 'The slice relative part, below which a slice will not show individually. All slices that have not passed this threshold will be combined to a single slice, whose size is the sum of all their sizes. Default is not to show individually any slice which is smaller than half a degree.', Visualizer_Plugin::NAME ),
|
115 |
+
'0.001388889'
|
116 |
+
);
|
117 |
+
|
118 |
+
self::_renderTextItem(
|
119 |
+
esc_html__( 'Residue Slice Label', Visualizer_Plugin::NAME ),
|
120 |
+
'pieResidueSliceLabel',
|
121 |
+
$this->pieResidueSliceLabel,
|
122 |
+
esc_html__( 'A label for the combination slice that holds all slices below slice visibility threshold.' ),
|
123 |
+
esc_html__( 'Other', Visualizer_Plugin::NAME )
|
124 |
+
);
|
125 |
+
|
126 |
+
self::_renderColorPickerItem(
|
127 |
+
esc_html__( 'Residue Slice Color', Visualizer_Plugin::NAME ),
|
128 |
+
'pieResidueSliceColor',
|
129 |
+
$this->pieResidueSliceColor,
|
130 |
+
'#ccc'
|
131 |
+
);
|
132 |
+
self::_renderSectionEnd();
|
133 |
+
self::_renderGroupEnd();
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Renders slices settings.
|
138 |
+
*
|
139 |
+
* @since 1.0.0
|
140 |
+
*
|
141 |
+
* @access protected
|
142 |
+
*/
|
143 |
+
protected function _renderSlicesSettings() {
|
144 |
+
self::_renderGroupStart( esc_html__( 'Slices Colors', Visualizer_Plugin::NAME ) );
|
145 |
+
self::_renderSectionStart();
|
146 |
+
for ( $i = 0, $cnt = count( $this->__data ); $i < $cnt; $i++ ) {
|
147 |
+
self::_renderColorPickerItem(
|
148 |
+
$this->__data[$i][0],
|
149 |
+
'slices[' . $i . '][color]',
|
150 |
+
isset( $this->slices[$i]['color'] ) ? $this->slices[$i]['color'] : null,
|
151 |
+
null
|
152 |
+
);
|
153 |
+
}
|
154 |
+
self::_renderSectionEnd();
|
155 |
+
self::_renderGroupEnd();
|
156 |
+
}
|
157 |
+
|
158 |
+
}
|
classes/Visualizer/Render/Sidebar/Type/Scatter.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Class for scatter chart sidebar settings.
|
26 |
+
*
|
27 |
+
* @category Visualizer
|
28 |
+
* @package Render
|
29 |
+
* @subpackage Sidebar
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
*/
|
33 |
+
class Visualizer_Render_Sidebar_Type_Scatter extends Visualizer_Render_Sidebar_Linear {
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Constructor.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
*
|
40 |
+
* @access public
|
41 |
+
* @param array $data The data what has to be associated with this render.
|
42 |
+
*/
|
43 |
+
public function __construct( $data = array() ) {
|
44 |
+
parent::__construct( $data );
|
45 |
+
|
46 |
+
// disable focus target option
|
47 |
+
$this->_includeFocusTarget = false;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Renders template.
|
52 |
+
*
|
53 |
+
* @since 1.0.0
|
54 |
+
*
|
55 |
+
* @access protected
|
56 |
+
*/
|
57 |
+
protected function _toHTML() {
|
58 |
+
$this->_renderGeneralSettings();
|
59 |
+
$this->_renderAxesSettings();
|
60 |
+
$this->_renderLineSettings();
|
61 |
+
$this->_renderSeriesSettings();
|
62 |
+
$this->_renderViewSettings();
|
63 |
+
}
|
64 |
+
|
65 |
+
}
|
classes/Visualizer/Render/Templates.php
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Media view template rendering class.
|
25 |
+
*
|
26 |
+
* @category Visualizer
|
27 |
+
* @package Render
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
*/
|
31 |
+
class Visualizer_Render_Templates extends Visualizer_Render {
|
32 |
+
|
33 |
+
/**
|
34 |
+
* The array of template names.
|
35 |
+
*
|
36 |
+
* @since 1.0.0
|
37 |
+
*
|
38 |
+
* @access private
|
39 |
+
* @var array
|
40 |
+
*/
|
41 |
+
private $_templates = array(
|
42 |
+
'library-chart',
|
43 |
+
'library-empty',
|
44 |
+
);
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Renders concreate template and wraps it into script tag.
|
48 |
+
*
|
49 |
+
* @since 1.0.0
|
50 |
+
*
|
51 |
+
* @param string $id The name of a template.
|
52 |
+
* @param string $callback The name of the function to render a template.
|
53 |
+
*/
|
54 |
+
private function _renderTemplate( $id, $callback ) {
|
55 |
+
echo '<script id="tmpl-visualizer-', $id, '" type="text/html">';
|
56 |
+
call_user_func( array( $this, $callback ) );
|
57 |
+
echo '</script>';
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Renders library-chart template.
|
62 |
+
*
|
63 |
+
* @since 1.0.0
|
64 |
+
*
|
65 |
+
* @access protected
|
66 |
+
*/
|
67 |
+
protected function _renderLibraryChart() {
|
68 |
+
echo '<div class="visualizer-library-chart-footer visualizer-clearfix">';
|
69 |
+
echo '<a class="visualizer-library-chart-action visualizer-library-chart-delete" href="javascript:;" title="', esc_attr__( 'Delete', Visualizer_Plugin::NAME ), '"></a>';
|
70 |
+
echo '<a class="visualizer-library-chart-action visualizer-library-chart-insert" href="javascript:;" title="', esc_attr__( 'Insert', Visualizer_Plugin::NAME ), '"></a>';
|
71 |
+
|
72 |
+
echo '<span class="visualizer-library-chart-shortcode" title="', esc_attr__( 'Click to select', Visualizer_Plugin::NAME ), '"> [visualizer id="{{data.id}}"] </span>';
|
73 |
+
echo '</div>';
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Renders library-empty template.
|
78 |
+
*
|
79 |
+
* @since 1.0.0
|
80 |
+
*
|
81 |
+
* @access protected
|
82 |
+
*/
|
83 |
+
protected function _renderLibraryEmpty() {
|
84 |
+
echo '<div class="visualizer-library-chart">';
|
85 |
+
echo '<div class="visualizer-library-chart-canvas visualizer-library-nochart-canvas">';
|
86 |
+
echo '<div class="visualizer-library-notfound">', esc_html__( 'No charts found', Visualizer_Plugin::NAME ), '</div>';
|
87 |
+
echo '</div>';
|
88 |
+
echo '<div class="visualizer-library-chart-footer visualizer-clearfix">';
|
89 |
+
echo '<span class="visualizer-library-chart-action visualizer-library-nochart-delete"></span>';
|
90 |
+
echo '<span class="visualizer-library-chart-action visualizer-library-nochart-insert"></span>';
|
91 |
+
|
92 |
+
echo '<span class="visualizer-library-chart-shortcode">';
|
93 |
+
echo ' [visualizer] ';
|
94 |
+
echo '</span>';
|
95 |
+
echo '</div>';
|
96 |
+
echo '</div>';
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Renders templates.
|
101 |
+
*
|
102 |
+
* @since 1.0.0
|
103 |
+
*
|
104 |
+
* @access protected
|
105 |
+
*/
|
106 |
+
protected function _toHTML() {
|
107 |
+
foreach ( $this->_templates as $template ) {
|
108 |
+
$callback = '_render' . str_replace( ' ', '', ucwords( str_replace( '-', ' ', $template ) ) );
|
109 |
+
$this->_renderTemplate( $template, $callback );
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
}
|
classes/Visualizer/Security.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Security helper class responsible for creation and verification nonce values.
|
25 |
+
*
|
26 |
+
* @category Visualizer
|
27 |
+
* @package Security
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
*/
|
31 |
+
class Visualizer_Security {
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Returns nonce salt.
|
35 |
+
*
|
36 |
+
* @since 1.0.0
|
37 |
+
*
|
38 |
+
* @static
|
39 |
+
* @access private
|
40 |
+
* @param string $action The action what requires the nonce.
|
41 |
+
* @return array
|
42 |
+
*/
|
43 |
+
private static function _getSalt( $action = '' ) {
|
44 |
+
return array(
|
45 |
+
'__ip' => @$_SERVER['REMOTE_ADDR'],
|
46 |
+
'__agent' => urlencode( @$_SERVER['HTTP_USER_AGENT'] ),
|
47 |
+
'__userid' => get_current_user_id(),
|
48 |
+
'__action' => $action,
|
49 |
+
);
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Creates nonce.
|
54 |
+
*
|
55 |
+
* @since 1.0.0
|
56 |
+
*
|
57 |
+
* @static
|
58 |
+
* @access public
|
59 |
+
* @param string $action The action what requires the nonce.
|
60 |
+
* @return string
|
61 |
+
*/
|
62 |
+
public static function createNonce( $action = '' ) {
|
63 |
+
return wp_create_nonce( implode( '/', array_slice( explode( '/', home_url() ), 0, 3 ) ) . add_query_arg( self::_getSalt( $action ) ) );
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Returns TRUE if nonce correct. Otherwise FALSE.
|
68 |
+
*
|
69 |
+
* @since 1.0.0
|
70 |
+
*
|
71 |
+
* @static
|
72 |
+
* @access public
|
73 |
+
* @param string $nonce The nonce to verify.
|
74 |
+
* @param string $action The action what requires the nonce.
|
75 |
+
* @return boolean TRUE if nonce is correct. Otherwise FALSE.
|
76 |
+
*/
|
77 |
+
public static function verifyNonce( $nonce, $action = '' ) {
|
78 |
+
return wp_verify_nonce( $nonce, add_query_arg( self::_getSalt( $action ), $_SERVER['HTTP_REFERER'] ) );
|
79 |
+
}
|
80 |
+
|
81 |
+
}
|
classes/Visualizer/Source.php
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* The abstract class for source managers.
|
25 |
+
*
|
26 |
+
* @category Visualizer
|
27 |
+
* @package Source
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
* @abstract
|
31 |
+
*/
|
32 |
+
abstract class Visualizer_Source {
|
33 |
+
|
34 |
+
/**
|
35 |
+
* The array of data.
|
36 |
+
*
|
37 |
+
* @since 1.0.0
|
38 |
+
*
|
39 |
+
* @access protected
|
40 |
+
* @var array
|
41 |
+
*/
|
42 |
+
protected $_data = array();
|
43 |
+
|
44 |
+
/**
|
45 |
+
* The array of series.
|
46 |
+
*
|
47 |
+
* @since 1.0.0
|
48 |
+
*
|
49 |
+
* @access protected
|
50 |
+
* @var array
|
51 |
+
*/
|
52 |
+
protected $_series = array();
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Returns source name.
|
56 |
+
*
|
57 |
+
* @since 1.0.0
|
58 |
+
*
|
59 |
+
* @abstract
|
60 |
+
* @access public
|
61 |
+
* @return string The name of source.
|
62 |
+
*/
|
63 |
+
public abstract function getSourceName();
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Fetches information from source, parses it and builds series and data arrays.
|
67 |
+
*
|
68 |
+
* @since 1.0.0
|
69 |
+
*
|
70 |
+
* @abstract
|
71 |
+
* @access public
|
72 |
+
*/
|
73 |
+
public abstract function fetch();
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Returns series parsed from source.
|
77 |
+
*
|
78 |
+
* @since 1.0.0
|
79 |
+
*
|
80 |
+
* @access public
|
81 |
+
* @return array The array of series.
|
82 |
+
*/
|
83 |
+
public function getSeries() {
|
84 |
+
return $this->_series;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Returns data parsed from source.
|
89 |
+
*
|
90 |
+
* @since 1.0.0
|
91 |
+
*
|
92 |
+
* @access public
|
93 |
+
* @return string The serialized array of data.
|
94 |
+
*/
|
95 |
+
public function getData() {
|
96 |
+
return serialize( $this->_data );
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Normalizes values according to series' type.
|
101 |
+
*
|
102 |
+
* @since 1.0.0
|
103 |
+
*
|
104 |
+
* @access protected
|
105 |
+
* @param array $data The row of data.
|
106 |
+
* @return array Normalized row of data.
|
107 |
+
*/
|
108 |
+
protected function _normalizeData( $data ) {
|
109 |
+
// normalize values
|
110 |
+
foreach ( $this->_series as $i => $series ) {
|
111 |
+
// if no value exists for the seires, then add null
|
112 |
+
if ( !isset( $data[$i] ) ) {
|
113 |
+
$data[$i] = null;
|
114 |
+
}
|
115 |
+
|
116 |
+
if ( is_null( $data[$i] ) ) {
|
117 |
+
continue;
|
118 |
+
}
|
119 |
+
|
120 |
+
switch ( $series['type'] ) {
|
121 |
+
case 'number':
|
122 |
+
$data[$i] = is_float( $data[$i] )
|
123 |
+
? floatval( $data[$i] )
|
124 |
+
: intval( $data[$i] );
|
125 |
+
break;
|
126 |
+
case 'boolean':
|
127 |
+
$data[$i] = filter_validate( $data[$i], FILTER_VALIDATE_BOOLEAN );
|
128 |
+
break;
|
129 |
+
case 'timeofday':
|
130 |
+
$date = new DateTime( '1984-03-16T' . $data[$i] );
|
131 |
+
if ( $date ) {
|
132 |
+
$data[$i] = array(
|
133 |
+
intval( $date->format( 'H' ) ),
|
134 |
+
intval( $date->format( 'i' ) ),
|
135 |
+
intval( $date->format( 's' ) ),
|
136 |
+
0,
|
137 |
+
);
|
138 |
+
}
|
139 |
+
break;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
+
return $data;
|
144 |
+
}
|
145 |
+
|
146 |
+
}
|
classes/Visualizer/Source/Csv.php
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// +----------------------------------------------------------------------+
|
4 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
5 |
+
// +----------------------------------------------------------------------+
|
6 |
+
// | This program is free software; you can redistribute it and/or modify |
|
7 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
8 |
+
// | published by the Free Software Foundation. |
|
9 |
+
// | |
|
10 |
+
// | This program is distributed in the hope that it will be useful, |
|
11 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+
// | GNU General Public License for more details. |
|
14 |
+
// | |
|
15 |
+
// | You should have received a copy of the GNU General Public License |
|
16 |
+
// | along with this program; if not, write to the Free Software |
|
17 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
18 |
+
// | MA 02110-1301 USA |
|
19 |
+
// +----------------------------------------------------------------------+
|
20 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
21 |
+
// +----------------------------------------------------------------------+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Source manager for CSV files.
|
25 |
+
*
|
26 |
+
* @category Visualizer
|
27 |
+
* @package Source
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
*/
|
31 |
+
class Visualizer_Source_Csv extends Visualizer_Source {
|
32 |
+
|
33 |
+
/**
|
34 |
+
* The path to the file with data.
|
35 |
+
*
|
36 |
+
* @since 1.0.0
|
37 |
+
*
|
38 |
+
* @access private
|
39 |
+
* @var string
|
40 |
+
*/
|
41 |
+
private $_filename;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Constructor.
|
45 |
+
*
|
46 |
+
* @since 1.0.0
|
47 |
+
*
|
48 |
+
* @access public
|
49 |
+
* @param string $filename The path to the file.
|
50 |
+
*/
|
51 |
+
public function __construct( $filename ) {
|
52 |
+
$this->_filename = $filename;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Fetches series information.
|
57 |
+
*
|
58 |
+
* @since 1.0.0
|
59 |
+
*
|
60 |
+
* @access private
|
61 |
+
* @param resource $handle The file handle resource.
|
62 |
+
*/
|
63 |
+
private function _fetchSeries( $handle ) {
|
64 |
+
// read column titles
|
65 |
+
$labels = fgetcsv( $handle );
|
66 |
+
|
67 |
+
// read series types
|
68 |
+
$types = fgetcsv( $handle );
|
69 |
+
|
70 |
+
if ( !$labels || !$types ) {
|
71 |
+
return false;
|
72 |
+
}
|
73 |
+
|
74 |
+
for ( $i = 0, $len = count( $labels ); $i < $len; $i++ ) {
|
75 |
+
$this->_series[] = array(
|
76 |
+
'label' => $labels[$i],
|
77 |
+
'type' => isset( $types[$i] ) ? $types[$i] : 'string',
|
78 |
+
);
|
79 |
+
}
|
80 |
+
|
81 |
+
return true;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Fetches information from source, parses it and builds series and data arrays.
|
86 |
+
*
|
87 |
+
* @since 1.0.0
|
88 |
+
*
|
89 |
+
* @access public
|
90 |
+
* @return boolean TRUE on success, otherwise FALSE.
|
91 |
+
*/
|
92 |
+
public function fetch() {
|
93 |
+
// set line endings auto detect mode
|
94 |
+
@ini_set( 'auto_detect_line_endings', true );
|
95 |
+
|
96 |
+
// read file and fill arrays
|
97 |
+
$handle = fopen( $this->_filename, 'rb' );
|
98 |
+
if ( $handle ) {
|
99 |
+
// fetch series
|
100 |
+
if ( !$this->_fetchSeries( $handle ) ) {
|
101 |
+
return false;
|
102 |
+
}
|
103 |
+
|
104 |
+
// fetch data
|
105 |
+
while ( ( $data = fgetcsv( $handle ) ) !== false ) {
|
106 |
+
$this->_data[] = $this->_normalizeData( $data );
|
107 |
+
}
|
108 |
+
|
109 |
+
// close file handle
|
110 |
+
fclose( $handle );
|
111 |
+
}
|
112 |
+
|
113 |
+
return true;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Returns source name.
|
118 |
+
*
|
119 |
+
* @since 1.0.0
|
120 |
+
*
|
121 |
+
* @access public
|
122 |
+
* @return string The name of source.
|
123 |
+
*/
|
124 |
+
public function getSourceName() {
|
125 |
+
return __CLASS__;
|
126 |
+
}
|
127 |
+
|
128 |
+
}
|
css/frame.css
ADDED
@@ -0,0 +1,394 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#content {
|
2 |
+
position: absolute;
|
3 |
+
top: 0;
|
4 |
+
right: 0;
|
5 |
+
bottom: 60px;
|
6 |
+
left: 0;
|
7 |
+
z-index: 75;
|
8 |
+
overflow: auto;
|
9 |
+
}
|
10 |
+
|
11 |
+
#canvas {
|
12 |
+
position: absolute;
|
13 |
+
left: 10px;
|
14 |
+
right: 310px;
|
15 |
+
top: 10px;
|
16 |
+
bottom: 10px;
|
17 |
+
}
|
18 |
+
|
19 |
+
.loader {
|
20 |
+
position: absolute;
|
21 |
+
left: 50%;
|
22 |
+
top: 50%;
|
23 |
+
margin-left: -16px;
|
24 |
+
margin-top: -16px;
|
25 |
+
}
|
26 |
+
|
27 |
+
/******************************************************************************/
|
28 |
+
/******************************** SIDEBAR ***********************************/
|
29 |
+
/******************************************************************************/
|
30 |
+
|
31 |
+
#sidebar {
|
32 |
+
position: absolute;
|
33 |
+
top: 0;
|
34 |
+
right: 0;
|
35 |
+
bottom: 60px;
|
36 |
+
width: 299px;
|
37 |
+
z-index: 75;
|
38 |
+
background: whitesmoke;
|
39 |
+
border-left: 1px solid #DFDFDF;
|
40 |
+
overflow: auto;
|
41 |
+
-webkit-overflow-scrolling: touch;
|
42 |
+
}
|
43 |
+
|
44 |
+
.group-wrapper {
|
45 |
+
border-top: 1px solid #DFDFDF;
|
46 |
+
margin: 0;
|
47 |
+
padding: 0;
|
48 |
+
list-style: none;
|
49 |
+
}
|
50 |
+
|
51 |
+
.group {
|
52 |
+
margin: 0;
|
53 |
+
list-style: none;
|
54 |
+
font-size: 12px;
|
55 |
+
line-height: 18px;
|
56 |
+
}
|
57 |
+
|
58 |
+
.group.open {
|
59 |
+
border-bottom: 1px solid #DFDFDF;
|
60 |
+
}
|
61 |
+
|
62 |
+
.group-title {
|
63 |
+
border-top: 1px solid white;
|
64 |
+
border-bottom: 1px solid #DFDFDF;
|
65 |
+
position: relative;
|
66 |
+
cursor: pointer;
|
67 |
+
-webkit-user-select: none;
|
68 |
+
-moz-user-select: none;
|
69 |
+
-ms-user-select: none;
|
70 |
+
user-select: none;
|
71 |
+
margin: 0;
|
72 |
+
padding: 10px 20px;
|
73 |
+
font-size: 15px;
|
74 |
+
font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
|
75 |
+
font-weight: normal;
|
76 |
+
text-shadow: 0 1px 0 white;
|
77 |
+
background: whiteSmoke;
|
78 |
+
background-image: -webkit-gradient(linear, left bottom, left top, from(#EEE), to(whiteSmoke));
|
79 |
+
background-image: -webkit-linear-gradient(bottom, #EEE, whiteSmoke);
|
80 |
+
background-image: -moz-linear-gradient(bottom, #EEE, whiteSmoke);
|
81 |
+
background-image: -o-linear-gradient(bottom, #EEE, whiteSmoke);
|
82 |
+
background-image: -ms-linear-gradient(bottom, #EEE, whiteSmoke);
|
83 |
+
background-image: linear-gradient(bottom, #EEE, whiteSmoke);
|
84 |
+
}
|
85 |
+
|
86 |
+
.group-title:hover,
|
87 |
+
.group.open .group-title {
|
88 |
+
color: white;
|
89 |
+
text-shadow: 0 -1px 0 #333;
|
90 |
+
background: gray;
|
91 |
+
background-image: -webkit-gradient(linear, left bottom, left top, from(#6D6D6D), to(gray));
|
92 |
+
background-image: -webkit-linear-gradient(bottom, #6D6D6D, gray);
|
93 |
+
background-image: -moz-linear-gradient(bottom, #6D6D6D, gray);
|
94 |
+
background-image: -o-linear-gradient(bottom, #6D6D6D, gray);
|
95 |
+
background-image: -ms-linear-gradient(bottom, #6D6D6D, gray);
|
96 |
+
background-image: linear-gradient(bottom, #6D6D6D, gray);
|
97 |
+
}
|
98 |
+
|
99 |
+
.group-title::after {
|
100 |
+
content: '';
|
101 |
+
width: 0;
|
102 |
+
height: 0;
|
103 |
+
border-color: #CCC transparent;
|
104 |
+
border-style: solid;
|
105 |
+
border-width: 6px 6px 0;
|
106 |
+
position: absolute;
|
107 |
+
top: 15px;
|
108 |
+
right: 20px;
|
109 |
+
z-index: 1;
|
110 |
+
}
|
111 |
+
|
112 |
+
.group-title:hover::after,
|
113 |
+
.group.open .group-title::after {
|
114 |
+
border-color: #EEE transparent;
|
115 |
+
}
|
116 |
+
|
117 |
+
.group:hover .group-title {
|
118 |
+
border-top-color: gray;
|
119 |
+
}
|
120 |
+
|
121 |
+
.group.open .group-title {
|
122 |
+
border-top-color: #6D6D6D;
|
123 |
+
}
|
124 |
+
|
125 |
+
.group.open .group-title::after {
|
126 |
+
border-width: 0 6px 6px;
|
127 |
+
}
|
128 |
+
|
129 |
+
.group-content {
|
130 |
+
margin: 0;
|
131 |
+
display: none;
|
132 |
+
background-color: #FDFDFD;
|
133 |
+
padding: 10px 0 20px 0;
|
134 |
+
overflow: hidden;
|
135 |
+
}
|
136 |
+
|
137 |
+
div.group-content {
|
138 |
+
padding: 10px 20px 20px;
|
139 |
+
}
|
140 |
+
|
141 |
+
.group.open .group-content {
|
142 |
+
display: block;
|
143 |
+
}
|
144 |
+
|
145 |
+
.group-description {
|
146 |
+
font-size: 12px;
|
147 |
+
color: #555;
|
148 |
+
padding: 5px 20px 10px;
|
149 |
+
margin: 0;
|
150 |
+
}
|
151 |
+
|
152 |
+
div.group-content .group-description {
|
153 |
+
padding: 0;
|
154 |
+
margin-bottom: 20px;
|
155 |
+
}
|
156 |
+
|
157 |
+
.section-title {
|
158 |
+
display: block;
|
159 |
+
font-weight: bold;
|
160 |
+
position: relative;
|
161 |
+
cursor: pointer;
|
162 |
+
padding: 4px 20px;
|
163 |
+
margin-bottom: 5px;
|
164 |
+
background-color: rgba(0, 0, 0, 0.02);
|
165 |
+
border-top: 1px solid #eeeeee;
|
166 |
+
-webkit-box-shadow: 0 4px 4px -4px rgba(0, 0, 0, 0.1);
|
167 |
+
box-shadow: 0 4px 4px -4px rgba(0, 0, 0, 0.1);
|
168 |
+
border-bottom: 1px solid #eeeeee;
|
169 |
+
}
|
170 |
+
|
171 |
+
.section-title::after {
|
172 |
+
content: '';
|
173 |
+
width: 0;
|
174 |
+
height: 0;
|
175 |
+
border-color: #CCC transparent;
|
176 |
+
border-style: solid;
|
177 |
+
border-width: 4px 4px 0;
|
178 |
+
position: absolute;
|
179 |
+
top: 13px;
|
180 |
+
right: 20px;
|
181 |
+
z-index: 1;
|
182 |
+
}
|
183 |
+
|
184 |
+
.section-title.open::after {
|
185 |
+
border-width: 0 4px 4px;
|
186 |
+
}
|
187 |
+
|
188 |
+
.section-items {
|
189 |
+
display: none;
|
190 |
+
padding: 5px 20px 10px 20px;
|
191 |
+
}
|
192 |
+
|
193 |
+
.section-items.open {
|
194 |
+
display: block;
|
195 |
+
}
|
196 |
+
|
197 |
+
.more-info {
|
198 |
+
text-decoration: none;
|
199 |
+
color: #21759B;
|
200 |
+
font-size: 85%;
|
201 |
+
font-weight: normal;
|
202 |
+
float: right;
|
203 |
+
display: none;
|
204 |
+
}
|
205 |
+
|
206 |
+
.section-description {
|
207 |
+
/*display: none;*/
|
208 |
+
padding: 0;
|
209 |
+
margin: 0;
|
210 |
+
font-size: 11px;
|
211 |
+
color: gray;
|
212 |
+
}
|
213 |
+
|
214 |
+
.section-table {
|
215 |
+
width: 100%;
|
216 |
+
}
|
217 |
+
|
218 |
+
.section-delimiter {
|
219 |
+
margin: 15px 0;
|
220 |
+
border-top: 1px dashed #ccc;
|
221 |
+
}
|
222 |
+
|
223 |
+
.section-table-column {
|
224 |
+
width: 50%;
|
225 |
+
text-align: left;
|
226 |
+
vertical-align: top;
|
227 |
+
padding: 0 1px;
|
228 |
+
}
|
229 |
+
|
230 |
+
.section-item {
|
231 |
+
margin-bottom: 10px;
|
232 |
+
}
|
233 |
+
|
234 |
+
.control-select,
|
235 |
+
.control-text {
|
236 |
+
width: 100%;
|
237 |
+
}
|
238 |
+
|
239 |
+
.section-description ul {
|
240 |
+
margin: 0 0 0 25px;
|
241 |
+
list-style: circle;
|
242 |
+
}
|
243 |
+
|
244 |
+
.section-description li {
|
245 |
+
list-style: circle;
|
246 |
+
margin: 0;
|
247 |
+
}
|
248 |
+
|
249 |
+
/******************************************************************************/
|
250 |
+
/******************************** TOOLBAR ***********************************/
|
251 |
+
/******************************************************************************/
|
252 |
+
|
253 |
+
#toolbar {
|
254 |
+
height: 36px;
|
255 |
+
padding: 12px 16px;
|
256 |
+
position: absolute;
|
257 |
+
z-index: 100;
|
258 |
+
left: 0;
|
259 |
+
right: 0;
|
260 |
+
bottom: 0;
|
261 |
+
border-top: 1px solid #DFDFDF;
|
262 |
+
overflow: hidden;
|
263 |
+
-webkit-box-shadow: 0 -4px 4px -4px rgba(0, 0, 0, 0.1);
|
264 |
+
box-shadow: 0 -4px 4px -4px rgba(0, 0, 0, 0.1);
|
265 |
+
}
|
266 |
+
|
267 |
+
#toolbar .push-right {
|
268 |
+
float: right;
|
269 |
+
}
|
270 |
+
|
271 |
+
/******************************************************************************/
|
272 |
+
/******************************** TYPE PICKER ******************************/
|
273 |
+
/******************************************************************************/
|
274 |
+
|
275 |
+
#type-picker {
|
276 |
+
margin: 50px auto;
|
277 |
+
width: 952px;
|
278 |
+
}
|
279 |
+
|
280 |
+
.type-box {
|
281 |
+
float: left;
|
282 |
+
margin: 0 20px 20px 0;
|
283 |
+
border: 1px dashed #ddd;
|
284 |
+
-webkit-box-shadow: 0px 0px 8px #ddd;
|
285 |
+
box-shadow: 0px 0px 8px #ddd;
|
286 |
+
background-color: #efefef;
|
287 |
+
}
|
288 |
+
|
289 |
+
.type-box:nth-child(3n+3) {
|
290 |
+
margin-right: 0px;
|
291 |
+
}
|
292 |
+
|
293 |
+
.type-label {
|
294 |
+
display: block;
|
295 |
+
width: 270px;
|
296 |
+
height: 195px;
|
297 |
+
padding: 15px;
|
298 |
+
background-color: white;
|
299 |
+
background-image: url(../images/chart_types_g.png);
|
300 |
+
background-repeat: no-repeat;
|
301 |
+
background-position: center center;
|
302 |
+
border: 1px solid #e0e0e0;
|
303 |
+
}
|
304 |
+
|
305 |
+
.type-label-selected,
|
306 |
+
.type-label:hover {
|
307 |
+
background-image: url(../images/chart_types.png);
|
308 |
+
}
|
309 |
+
|
310 |
+
.type-box-area .type-label {
|
311 |
+
background-position: 0px -225px;
|
312 |
+
}
|
313 |
+
|
314 |
+
.type-box-line .type-label {
|
315 |
+
background-position: -600px 0px;
|
316 |
+
}
|
317 |
+
|
318 |
+
.type-box-scatter .type-label {
|
319 |
+
background-position: -300px 0px;
|
320 |
+
}
|
321 |
+
|
322 |
+
.type-box-pie .type-label {
|
323 |
+
background-position: 0px 0px;
|
324 |
+
}
|
325 |
+
|
326 |
+
.type-box-gauge .type-label {
|
327 |
+
background-position: 0px -450px;
|
328 |
+
}
|
329 |
+
|
330 |
+
.type-box-geo .type-label {
|
331 |
+
background-position: -600px -450px;
|
332 |
+
}
|
333 |
+
|
334 |
+
.type-box-candlestick .type-label {
|
335 |
+
background-position: -300px -450px;
|
336 |
+
}
|
337 |
+
|
338 |
+
.type-box-bar .type-label {
|
339 |
+
background-position: -300px -225px;
|
340 |
+
}
|
341 |
+
|
342 |
+
.type-box-column .type-label {
|
343 |
+
background-position: -600px -225px;
|
344 |
+
}
|
345 |
+
|
346 |
+
/******************************************************************************/
|
347 |
+
/******************************** OTHER STYLES ******************************/
|
348 |
+
/******************************************************************************/
|
349 |
+
|
350 |
+
#thehole {
|
351 |
+
position: absolute;
|
352 |
+
left: 0;
|
353 |
+
top: 0;
|
354 |
+
width: 1px;
|
355 |
+
height: 1px;
|
356 |
+
border: 0;
|
357 |
+
opacity: 0;
|
358 |
+
-moz-opacity: 0;
|
359 |
+
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);
|
360 |
+
}
|
361 |
+
|
362 |
+
.locker, .locker-loader {
|
363 |
+
left: 0;
|
364 |
+
top: 0;
|
365 |
+
position: absolute;
|
366 |
+
}
|
367 |
+
|
368 |
+
.locker {
|
369 |
+
z-index: 1000;
|
370 |
+
background-color: white;
|
371 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
|
372 |
+
filter: alpha(opacity=80);
|
373 |
+
opacity: 0.8;
|
374 |
+
}
|
375 |
+
|
376 |
+
.locker-loader {
|
377 |
+
z-index: 1001;
|
378 |
+
background: url(../images/ajax-loader.gif) no-repeat center center;
|
379 |
+
}
|
380 |
+
|
381 |
+
.file-wrapper {
|
382 |
+
position: relative;
|
383 |
+
}
|
384 |
+
|
385 |
+
.file {
|
386 |
+
position: absolute;
|
387 |
+
top: 0;
|
388 |
+
left: 0;
|
389 |
+
right: 0;
|
390 |
+
bottom: 0;
|
391 |
+
opacity: 0;
|
392 |
+
-moz-opacity: 0;
|
393 |
+
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);
|
394 |
+
}
|
css/library.css
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#visualizer-icon {
|
2 |
+
background-image: url('../images/icon.png');
|
3 |
+
}
|
4 |
+
|
5 |
+
.visualizer-clearfix {
|
6 |
+
*zoom: 1;
|
7 |
+
}
|
8 |
+
|
9 |
+
.visualizer-clearfix:before,
|
10 |
+
.visualizer-clearfix:after {
|
11 |
+
display: table;
|
12 |
+
line-height: 0;
|
13 |
+
content: "";
|
14 |
+
}
|
15 |
+
|
16 |
+
.visualizer-clearfix:after {
|
17 |
+
clear: both;
|
18 |
+
}
|
19 |
+
|
20 |
+
#visualizer-types {
|
21 |
+
margin: 20px 0 10px;
|
22 |
+
}
|
23 |
+
|
24 |
+
#visualizer-library {
|
25 |
+
margin: 20px 0;
|
26 |
+
}
|
27 |
+
|
28 |
+
.loader {
|
29 |
+
position: absolute;
|
30 |
+
left: 50%;
|
31 |
+
top: 50%;
|
32 |
+
margin-left: -16px;
|
33 |
+
margin-top: -16px;
|
34 |
+
}
|
35 |
+
|
36 |
+
.visualizer-chart {
|
37 |
+
float: left;
|
38 |
+
padding: 5px;
|
39 |
+
margin: 0 24px 24px 0;
|
40 |
+
border: 1px solid #ddd;
|
41 |
+
-webkit-box-shadow: 0px 0px 8px #ddd;
|
42 |
+
box-shadow: 0px 0px 8px #ddd;
|
43 |
+
background-color: #efefef;
|
44 |
+
}
|
45 |
+
|
46 |
+
.visualizer-chart-canvas {
|
47 |
+
border: 1px solid #ddd;
|
48 |
+
background-color: white;
|
49 |
+
position: relative;
|
50 |
+
width: 347px;
|
51 |
+
height: 271px;
|
52 |
+
}
|
53 |
+
|
54 |
+
.visualizer-nochart-canvas {
|
55 |
+
background-image: url('../images/notfound.png?v=4');
|
56 |
+
background-repeat: repeat;
|
57 |
+
}
|
58 |
+
|
59 |
+
.visualizer-notfound {
|
60 |
+
text-align: center;
|
61 |
+
font-weight: bold;
|
62 |
+
font-size: 14px;
|
63 |
+
margin-top: -7px;
|
64 |
+
position: absolute;
|
65 |
+
top: 50%;
|
66 |
+
left: 0;
|
67 |
+
right: 0;
|
68 |
+
}
|
69 |
+
|
70 |
+
.visualizer-chart-action {
|
71 |
+
float: right;
|
72 |
+
display: block;
|
73 |
+
height: 16px;
|
74 |
+
width: 16px;
|
75 |
+
background-repeat: no-repeat;
|
76 |
+
background-image: url('../images/ui-icons.png');
|
77 |
+
margin: 2px 5px 0;
|
78 |
+
}
|
79 |
+
|
80 |
+
.visualizer-nochart-delete,
|
81 |
+
.visualizer-chart-delete {
|
82 |
+
background-position: -176px -96px;
|
83 |
+
}
|
84 |
+
|
85 |
+
.visualizer-nochart-clone,
|
86 |
+
.visualizer-chart-clone {
|
87 |
+
background-position: -176px -128px;
|
88 |
+
}
|
89 |
+
|
90 |
+
.visualizer-nochart-edit,
|
91 |
+
.visualizer-chart-edit {
|
92 |
+
background-position: -64px -112px;
|
93 |
+
}
|
94 |
+
|
95 |
+
.visualizer-nochart-clone,
|
96 |
+
.visualizer-nochart-delete,
|
97 |
+
.visualizer-nochart-edit {
|
98 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
|
99 |
+
filter: alpha(opacity=50);
|
100 |
+
opacity: 0.5
|
101 |
+
}
|
102 |
+
|
103 |
+
.visualizer-chart-footer {
|
104 |
+
margin-top: 4px;
|
105 |
+
}
|
106 |
+
|
107 |
+
.visualizer-chart-shortcode {
|
108 |
+
color: #aaa;
|
109 |
+
text-shadow: 0 1px 0 #fff;
|
110 |
+
cursor: pointer;
|
111 |
+
padding: 3px 0;
|
112 |
+
}
|
113 |
+
|
114 |
+
.visualizer-chart-shortcode::selection,
|
115 |
+
.visualizer-chart-shortcode::-moz-selection {
|
116 |
+
background-color: #a8d1ff;
|
117 |
+
color: black;
|
118 |
+
text-shadow: none;
|
119 |
+
}
|
120 |
+
|
121 |
+
.visualizer-list-item {
|
122 |
+
float: left;
|
123 |
+
margin-right: 20px;
|
124 |
+
}
|
125 |
+
|
126 |
+
.page-numbers {
|
127 |
+
padding: 5px 10px;
|
128 |
+
background-color: #aaa;
|
129 |
+
color: white !important;
|
130 |
+
text-decoration: none;
|
131 |
+
border-radius: 2px;
|
132 |
+
box-shadow: 0 0 5px #ccc;
|
133 |
+
font-weight: bold;
|
134 |
+
}
|
135 |
+
|
136 |
+
.page-numbers.current,
|
137 |
+
a.page-numbers:hover {
|
138 |
+
background-color: lightcoral;
|
139 |
+
box-shadow: 0 0 5px lightpink;
|
140 |
+
}
|
css/media.css
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#visualizer-library-view {
|
2 |
+
padding: 30px 10px 10px 30px;
|
3 |
+
}
|
4 |
+
|
5 |
+
.visualizer-library-filters {
|
6 |
+
margin-top: 18px !important;
|
7 |
+
margin-left: 14px !important;
|
8 |
+
}
|
9 |
+
|
10 |
+
.visualizer-clearfix {
|
11 |
+
*zoom: 1;
|
12 |
+
}
|
13 |
+
|
14 |
+
.visualizer-clearfix:before,
|
15 |
+
.visualizer-clearfix:after {
|
16 |
+
display: table;
|
17 |
+
line-height: 0;
|
18 |
+
content: "";
|
19 |
+
}
|
20 |
+
|
21 |
+
.visualizer-clearfix:after {
|
22 |
+
clear: both;
|
23 |
+
}
|
24 |
+
|
25 |
+
.visualizer-library-chart {
|
26 |
+
float: left;
|
27 |
+
margin: 0 20px 20px 0;
|
28 |
+
padding: 5px;
|
29 |
+
border: 1px solid #ddd;
|
30 |
+
-webkit-box-shadow: 0px 0px 8px #ddd;
|
31 |
+
box-shadow: 0px 0px 8px #ddd;
|
32 |
+
background-color: #efefef;
|
33 |
+
}
|
34 |
+
|
35 |
+
.visualizer-library-chart-canvas {
|
36 |
+
height: 187px;
|
37 |
+
width: 250px;
|
38 |
+
border: 1px solid #ddd;
|
39 |
+
background-color: white;
|
40 |
+
background-image: url('../images/ajax-loader.gif');
|
41 |
+
background-position: center center;
|
42 |
+
background-repeat: no-repeat;
|
43 |
+
}
|
44 |
+
|
45 |
+
.visualizer-library-nochart-canvas {
|
46 |
+
background-image: url('../images/notfound.png?v=4');
|
47 |
+
background-repeat: repeat;
|
48 |
+
position: relative;
|
49 |
+
}
|
50 |
+
|
51 |
+
.visualizer-library-notfound {
|
52 |
+
text-align: center;
|
53 |
+
font-weight: bold;
|
54 |
+
font-size: 14px;
|
55 |
+
margin-top: -7px;
|
56 |
+
position: absolute;
|
57 |
+
top: 50%;
|
58 |
+
left: 0;
|
59 |
+
right: 0;
|
60 |
+
}
|
61 |
+
|
62 |
+
.visualizer-library-chart-action {
|
63 |
+
float: right;
|
64 |
+
display: block;
|
65 |
+
height: 16px;
|
66 |
+
width: 16px;
|
67 |
+
background-repeat: no-repeat;
|
68 |
+
background-image: url('../images/ui-icons.png');
|
69 |
+
margin: 2px 5px 0;
|
70 |
+
}
|
71 |
+
|
72 |
+
.visualizer-library-nochart-delete,
|
73 |
+
.visualizer-library-chart-delete {
|
74 |
+
background-position: -176px -96px;
|
75 |
+
}
|
76 |
+
|
77 |
+
.visualizer-library-nochart-insert,
|
78 |
+
.visualizer-library-chart-insert {
|
79 |
+
background-position: -48px -48px;
|
80 |
+
}
|
81 |
+
|
82 |
+
.visualizer-library-nochart-delete,
|
83 |
+
.visualizer-library-nochart-insert {
|
84 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
|
85 |
+
filter: alpha(opacity=50);
|
86 |
+
opacity: 0.5
|
87 |
+
}
|
88 |
+
|
89 |
+
.visualizer-library-chart-footer {
|
90 |
+
margin-top: 4px;
|
91 |
+
}
|
92 |
+
|
93 |
+
.visualizer-library-chart-shortcode {
|
94 |
+
color: #aaa;
|
95 |
+
text-shadow: 0 1px 0 #fff;
|
96 |
+
cursor: pointer;
|
97 |
+
padding: 3px 0;
|
98 |
+
}
|
99 |
+
|
100 |
+
.visualizer-library-chart-shortcode::selection,
|
101 |
+
.visualizer-library-chart-shortcode::-moz-selection {
|
102 |
+
background-color: #a8d1ff;
|
103 |
+
color: black;
|
104 |
+
text-shadow: none;
|
105 |
+
}
|
106 |
+
|
107 |
+
#visualizer-library-pagination {
|
108 |
+
margin-right: 30px;
|
109 |
+
}
|
110 |
+
|
111 |
+
.visualizer-library-pagination-item {
|
112 |
+
float: left;
|
113 |
+
margin-left: 20px;
|
114 |
+
margin-top: 10px;
|
115 |
+
}
|
116 |
+
|
117 |
+
.visualizer-library-pagination-page {
|
118 |
+
padding: 5px 10px;
|
119 |
+
background-color: #aaa;
|
120 |
+
color: white !important;
|
121 |
+
text-decoration: none;
|
122 |
+
border-radius: 2px;
|
123 |
+
box-shadow: 0 0 5px #ccc;
|
124 |
+
font-weight: bold;
|
125 |
+
}
|
126 |
+
|
127 |
+
.visualizer-library-pagination-active > .visualizer-library-pagination-page,
|
128 |
+
a.visualizer-library-pagination-page:hover {
|
129 |
+
background-color: lightcoral;
|
130 |
+
box-shadow: 0 0 5px lightpink;
|
131 |
+
}
|
132 |
+
|
133 |
+
.locker, .locker-loader {
|
134 |
+
left: 0;
|
135 |
+
top: 0;
|
136 |
+
width: 100%;
|
137 |
+
height: 100%;
|
138 |
+
position: absolute;
|
139 |
+
}
|
140 |
+
|
141 |
+
.locker {
|
142 |
+
z-index: 1000;
|
143 |
+
background-color: white;
|
144 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
|
145 |
+
filter: alpha(opacity=80);
|
146 |
+
opacity: 0.8;
|
147 |
+
}
|
148 |
+
|
149 |
+
.locker-loader {
|
150 |
+
z-index: 1001;
|
151 |
+
background: url(../images/ajax-loader.gif) no-repeat center center;
|
152 |
+
}
|
humans.txt
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* TEAM */
|
2 |
+
Chef: Eugene Manuilov
|
3 |
+
Contact: eugene@manuilov.org
|
4 |
+
From: Kyiv, Ukraine
|
5 |
+
|
6 |
+
/* THANKS */
|
7 |
+
|
8 |
+
/* PLUGIN */
|
9 |
+
Created: 2013
|
10 |
+
Components: jQuery, Backbone.js, Underscore.js, Google Visualization API
|
11 |
+
IDE: NetBeans IDE 7.3.1 (Ubuntu)
|
12 |
+
VCS: Git (Bitbucket.org)
|
images/ajax-loader.gif
ADDED
Binary file
|
images/chart_types.png
ADDED
Binary file
|
images/chart_types_g.png
ADDED
Binary file
|
images/icon.png
ADDED
Binary file
|
images/notfound.png
ADDED
Binary file
|
images/ui-icons.png
ADDED
Binary file
|
index.php
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: WordPress Visualizer
|
4 |
+
Plugin URI: http://visualizer.madpixels.net
|
5 |
+
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.0.0
|
7 |
+
Author: Madpixels
|
8 |
+
Author URI: http://madpixels.net
|
9 |
+
License: GPL v2.0 or later
|
10 |
+
License URI: http://www.opensource.org/licenses/gpl-license.php
|
11 |
+
*/
|
12 |
+
|
13 |
+
// +----------------------------------------------------------------------+
|
14 |
+
// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
|
15 |
+
// +----------------------------------------------------------------------+
|
16 |
+
// | This program is free software; you can redistribute it and/or modify |
|
17 |
+
// | it under the terms of the GNU General Public License, version 2, as |
|
18 |
+
// | published by the Free Software Foundation. |
|
19 |
+
// | |
|
20 |
+
// | This program is distributed in the hope that it will be useful, |
|
21 |
+
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
22 |
+
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
23 |
+
// | GNU General Public License for more details. |
|
24 |
+
// | |
|
25 |
+
// | You should have received a copy of the GNU General Public License |
|
26 |
+
// | along with this program; if not, write to the Free Software |
|
27 |
+
// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
|
28 |
+
// | MA 02110-1301 USA |
|
29 |
+
// +----------------------------------------------------------------------+
|
30 |
+
// | Author: Eugene Manuilov <eugene@manuilov.org> |
|
31 |
+
// +----------------------------------------------------------------------+
|
32 |
+
|
33 |
+
// don't load the plugin, if it has been already loaded
|
34 |
+
if ( class_exists( 'Visualizer_Plugin', false ) ) {
|
35 |
+
return;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Automatically loads classes for the plugin. Checks a namespace and loads only
|
40 |
+
* approved classes.
|
41 |
+
*
|
42 |
+
* @since 1.0.0
|
43 |
+
*
|
44 |
+
* @param string $class The class name to autoload.
|
45 |
+
* @return boolean Returns TRUE if the class is located. Otherwise FALSE.
|
46 |
+
*/
|
47 |
+
function visualizer_autoloader( $class ) {
|
48 |
+
$namespaces = array( 'Visualizer' );
|
49 |
+
foreach ( $namespaces as $namespace ) {
|
50 |
+
if ( substr( $class, 0, strlen( $namespace ) ) == $namespace ) {
|
51 |
+
$filename = dirname( __FILE__ ) . str_replace( '_', DIRECTORY_SEPARATOR, "_classes_{$class}.php" );
|
52 |
+
if ( is_readable( $filename ) ) {
|
53 |
+
require $filename;
|
54 |
+
return true;
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
return false;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Instantiates the plugin and setup all modules.
|
64 |
+
*
|
65 |
+
* @since 1.0.0
|
66 |
+
*/
|
67 |
+
function visualizer_launch() {
|
68 |
+
// setup environment
|
69 |
+
define( 'VISUALIZER_BASEFILE', __FILE__ );
|
70 |
+
define( 'VISUALIZER_ABSURL', plugins_url( '/', __FILE__ ) );
|
71 |
+
define( 'VISUALIZER_ABSPATH', dirname( __FILE__ ) );
|
72 |
+
|
73 |
+
// don't load the plugin if cron job is running or doing autosave
|
74 |
+
$doing_autosave = defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE;
|
75 |
+
$doing_cron = defined( 'DOING_CRON' ) && DOING_CRON;
|
76 |
+
$doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
|
77 |
+
if ( $doing_autosave || $doing_cron ) {
|
78 |
+
return;
|
79 |
+
}
|
80 |
+
|
81 |
+
// instantiate the plugin
|
82 |
+
$plugin = Visualizer_Plugin::instance();
|
83 |
+
|
84 |
+
// set general modules
|
85 |
+
$plugin->setModule( Visualizer_Module_Setup::NAME );
|
86 |
+
|
87 |
+
if ( $doing_ajax ) {
|
88 |
+
// set ajax modules
|
89 |
+
$plugin->setModule( Visualizer_Module_Chart::NAME );
|
90 |
+
} else {
|
91 |
+
if ( is_admin() ) {
|
92 |
+
// set admin modules
|
93 |
+
$plugin->setModule( Visualizer_Module_Admin::NAME );
|
94 |
+
} else {
|
95 |
+
// set frontend modules
|
96 |
+
$plugin->setModule( Visualizer_Module_Frontend::NAME );
|
97 |
+
}
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
// register autoloader function
|
102 |
+
spl_autoload_register( 'visualizer_autoloader' );
|
103 |
+
|
104 |
+
// launch the plugin
|
105 |
+
visualizer_launch();
|
js/frame.js
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($) {
|
2 |
+
$(document).ready(function() {
|
3 |
+
$('.type-radio').change(function() {
|
4 |
+
$('.type-label-selected').removeClass('type-label-selected');
|
5 |
+
$(this).parent().addClass('type-label-selected');
|
6 |
+
});
|
7 |
+
|
8 |
+
$('.group-title').click(function() {
|
9 |
+
var parent = $(this).parent();
|
10 |
+
|
11 |
+
if (parent.hasClass('open')) {
|
12 |
+
parent.removeClass('open');
|
13 |
+
} else {
|
14 |
+
$('.group.open').removeClass('open');
|
15 |
+
parent.addClass('open');
|
16 |
+
}
|
17 |
+
});
|
18 |
+
|
19 |
+
$('#csv-file').change(function() {
|
20 |
+
if ($.trim($(this).val()) != '') {
|
21 |
+
$('#canvas').lock();
|
22 |
+
$('#csv-form').submit();
|
23 |
+
}
|
24 |
+
});
|
25 |
+
|
26 |
+
$('#thehole').load(function() {
|
27 |
+
$('#canvas').unlock();
|
28 |
+
});
|
29 |
+
|
30 |
+
$('.section-title').click(function() {
|
31 |
+
$(this).toggleClass('open').parent().find('.section-items').toggle();
|
32 |
+
});
|
33 |
+
|
34 |
+
$('.more-info').click(function() {
|
35 |
+
$(this).parent().find('.section-description:first').toggle();
|
36 |
+
return false;
|
37 |
+
});
|
38 |
+
});
|
39 |
+
})(jQuery);
|
40 |
+
|
41 |
+
(function($) {
|
42 |
+
$.fn.lock = function() {
|
43 |
+
$(this).each(function() {
|
44 |
+
var $this = $(this);
|
45 |
+
var position = $this.css('position');
|
46 |
+
|
47 |
+
if (!position) {
|
48 |
+
position = 'static';
|
49 |
+
}
|
50 |
+
|
51 |
+
switch(position) {
|
52 |
+
case 'absolute':
|
53 |
+
case 'relative':
|
54 |
+
break;
|
55 |
+
default:
|
56 |
+
$this.css('position', 'relative');
|
57 |
+
break;
|
58 |
+
}
|
59 |
+
$this.data('position', position);
|
60 |
+
|
61 |
+
var width = $this.width(),
|
62 |
+
height = $this.height();
|
63 |
+
|
64 |
+
var locker = $('<div class="locker"></div>');
|
65 |
+
locker.width(width).height(height);
|
66 |
+
|
67 |
+
var loader = $('<div class="locker-loader"></div>');
|
68 |
+
loader.width(width).height(height);
|
69 |
+
|
70 |
+
locker.append(loader);
|
71 |
+
$this.append(locker);
|
72 |
+
$(window).resize(function() {
|
73 |
+
$this.find('.locker,.locker-loader').width($this.width()).height($this.height());
|
74 |
+
});
|
75 |
+
});
|
76 |
+
|
77 |
+
return $(this);
|
78 |
+
}
|
79 |
+
|
80 |
+
$.fn.unlock = function() {
|
81 |
+
$(this).each(function() {
|
82 |
+
$(this).find('.locker').remove();
|
83 |
+
$(this).css('position', $(this).data('position'));
|
84 |
+
});
|
85 |
+
|
86 |
+
return $(this);
|
87 |
+
}
|
88 |
+
})(jQuery);
|
js/library.js
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(wpmv) {
|
2 |
+
var vm, vmv;
|
3 |
+
|
4 |
+
vm = visualizer.media = {};
|
5 |
+
vmv = vm.view = {};
|
6 |
+
|
7 |
+
vmv.Chart = wpmv.MediaFrame.extend({
|
8 |
+
initialize: function() {
|
9 |
+
var self = this;
|
10 |
+
|
11 |
+
_.defaults(self.options, {
|
12 |
+
action: '',
|
13 |
+
state: 'iframe:visualizer'
|
14 |
+
});
|
15 |
+
|
16 |
+
wpmv.MediaFrame.prototype.initialize.apply(self, arguments);
|
17 |
+
|
18 |
+
wpmv.settings.tabUrl = self.options.action;
|
19 |
+
self.createIframeStates();
|
20 |
+
},
|
21 |
+
|
22 |
+
open: function() {
|
23 |
+
wpmv.MediaFrame.prototype.open.apply(this, arguments);
|
24 |
+
this.$el.addClass('hide-menu');
|
25 |
+
}
|
26 |
+
});
|
27 |
+
})(wp.media.view);
|
28 |
+
|
29 |
+
(function($, vmv, vu) {
|
30 |
+
var resizeTimeout;
|
31 |
+
|
32 |
+
$.fn.adjust = function() {
|
33 |
+
var width = $('#visualizer-library').width(),
|
34 |
+
margin = width * 0.02;
|
35 |
+
|
36 |
+
width *= 0.305;
|
37 |
+
$(this).width(width - 14).height(width * 0.75).parent().css('margin-right', margin + 'px').css('margin-bottom', margin + 'px');
|
38 |
+
}
|
39 |
+
|
40 |
+
$('.visualizer-chart-canvas').adjust();
|
41 |
+
|
42 |
+
$(document).ready(function() {
|
43 |
+
$('.visualizer-chart-shortcode').click(function(e) {
|
44 |
+
var range, selection;
|
45 |
+
|
46 |
+
if (window.getSelection && document.createRange) {
|
47 |
+
selection = window.getSelection();
|
48 |
+
range = document.createRange();
|
49 |
+
range.selectNodeContents(e.target);
|
50 |
+
selection.removeAllRanges();
|
51 |
+
selection.addRange(range);
|
52 |
+
} else if (document.selection && document.body.createTextRange) {
|
53 |
+
range = document.body.createTextRange();
|
54 |
+
range.moveToElementText(e.target);
|
55 |
+
range.select();
|
56 |
+
}
|
57 |
+
});
|
58 |
+
|
59 |
+
$('.add-new-h2').click(function() {
|
60 |
+
var wnd = window,
|
61 |
+
view = new vmv.Chart({action: vu.create});
|
62 |
+
|
63 |
+
wnd.send_to_editor = function() {
|
64 |
+
wnd.location.href = vu.base;
|
65 |
+
};
|
66 |
+
view.open();
|
67 |
+
|
68 |
+
return false;
|
69 |
+
});
|
70 |
+
|
71 |
+
$('.visualizer-chart-edit').click(function() {
|
72 |
+
var wnd = window,
|
73 |
+
view = new vmv.Chart({action: vu.edit + '&chart=' + $(this).attr('data-chart')});
|
74 |
+
|
75 |
+
wnd.send_to_editor = function() {
|
76 |
+
wnd.location.reload();
|
77 |
+
};
|
78 |
+
|
79 |
+
view.open();
|
80 |
+
|
81 |
+
return false;
|
82 |
+
});
|
83 |
+
|
84 |
+
$(window).resize(function() {
|
85 |
+
clearTimeout(resizeTimeout);
|
86 |
+
resizeTimeout = setTimeout(function() {
|
87 |
+
$('.visualizer-chart-canvas').adjust();
|
88 |
+
}, 100);
|
89 |
+
});
|
90 |
+
});
|
91 |
+
})(jQuery, visualizer.media.view, visualizer.urls);
|
js/media.js
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(wpmv, g) {
|
2 |
+
var mediaFrame, wpmvtv;
|
3 |
+
|
4 |
+
wpmvtv = wpmv.toolbar.visualizer;
|
5 |
+
mediaFrame = wpmv.MediaFrame.Post;
|
6 |
+
|
7 |
+
g.load("visualization", "1", { packages: ["corechart", "geochart", "gauge"] });
|
8 |
+
|
9 |
+
wpmv.MediaFrame.Post = mediaFrame.extend({
|
10 |
+
initialize: function() {
|
11 |
+
var self = this;
|
12 |
+
|
13 |
+
mediaFrame.prototype.initialize.apply(self, arguments);
|
14 |
+
|
15 |
+
self.states.add([
|
16 |
+
new wp.media.controller.Visualizer({
|
17 |
+
id: 'visualizer',
|
18 |
+
menu: 'default',
|
19 |
+
title: wpmv.l10n.visualizer.controller.title,
|
20 |
+
priority: 200,
|
21 |
+
type: 'link',
|
22 |
+
src: wpmv.l10n.visualizer.buildurl
|
23 |
+
})
|
24 |
+
]);
|
25 |
+
|
26 |
+
self.on('router:create:visualizer', self.createRouter, self);
|
27 |
+
self.on('router:render:visualizer', self.visualizerRouter, self);
|
28 |
+
|
29 |
+
self.on('content:create:library', self.contentCreateLibrary, self);
|
30 |
+
self.on('content:create:builder', self.iframeContent, self);
|
31 |
+
},
|
32 |
+
|
33 |
+
visualizerRouter: function(view) {
|
34 |
+
view.set({
|
35 |
+
builder: {
|
36 |
+
text: wpmv.l10n.visualizer.routers.create,
|
37 |
+
priority: 40
|
38 |
+
},
|
39 |
+
library: {
|
40 |
+
text: wpmv.l10n.visualizer.routers.library,
|
41 |
+
priority: 20
|
42 |
+
}
|
43 |
+
});
|
44 |
+
},
|
45 |
+
|
46 |
+
contentCreateLibrary: function(region) {
|
47 |
+
var self = this;
|
48 |
+
|
49 |
+
self.toolbar.set(new wpmvtv.Library({controller: self}));
|
50 |
+
self.$el.removeClass('hide-toolbar');
|
51 |
+
|
52 |
+
region.view = new wpmv.visualizer.Library({
|
53 |
+
controller: self,
|
54 |
+
collection: self.state().library
|
55 |
+
});
|
56 |
+
}
|
57 |
+
});
|
58 |
+
})(wp.media.view, google);
|
js/media/collection.js
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(wpmm) {
|
2 |
+
wpmm.visualizer.Charts = Backbone.Collection.extend({
|
3 |
+
model: wpmm.visualizer.Chart,
|
4 |
+
|
5 |
+
sync: function(method, model, options) {
|
6 |
+
if ('read' === method) {
|
7 |
+
options = options || {};
|
8 |
+
options.type = 'GET';
|
9 |
+
options.data = _.extend( options.data || {}, {
|
10 |
+
action: wp.media.view.l10n.visualizer.actions.get_charts
|
11 |
+
});
|
12 |
+
|
13 |
+
return wp.media.ajax( options );
|
14 |
+
} else {
|
15 |
+
return Backbone.sync.apply( this, arguments );
|
16 |
+
}
|
17 |
+
}
|
18 |
+
});
|
19 |
+
})(wp.media.model);
|
js/media/controller.js
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(wpm) {
|
2 |
+
var wpmmv, wpmc;
|
3 |
+
|
4 |
+
wpmc = wpm.controller;
|
5 |
+
wpmmv = wpm.model.visualizer;
|
6 |
+
|
7 |
+
wpmc.Visualizer = wpmc.State.extend({
|
8 |
+
defaults: {
|
9 |
+
toolbar: 'visualizer',
|
10 |
+
content: 'library',
|
11 |
+
sidebar: 'visualizer',
|
12 |
+
router: 'visualizer'
|
13 |
+
},
|
14 |
+
|
15 |
+
initialize: function() {
|
16 |
+
this.library = new wpmmv.Charts();
|
17 |
+
}
|
18 |
+
});
|
19 |
+
})(wp.media);
|
js/media/model.js
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($, wpmm, wpmvlv) {
|
2 |
+
wpmm.visualizer = {};
|
3 |
+
|
4 |
+
wpmm.visualizer.Chart = Backbone.Model.extend({
|
5 |
+
sync: function(method, model, options) {
|
6 |
+
if ('delete' == method) {
|
7 |
+
options = options || {};
|
8 |
+
options.data = _.extend( options.data || {}, {
|
9 |
+
action: wpmvlv.actions.delete_chart,
|
10 |
+
chart: model.get('id'),
|
11 |
+
nonce: wpmvlv.nonce
|
12 |
+
});
|
13 |
+
|
14 |
+
return wp.media.ajax( options );
|
15 |
+
} else {
|
16 |
+
return;
|
17 |
+
}
|
18 |
+
}
|
19 |
+
});
|
20 |
+
})(jQuery, wp.media.model, wp.media.view.l10n.visualizer);
|
js/media/toolbar.js
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(wpmv, wpmvt) {
|
2 |
+
var wpmvvl, wpmvtv, wpmvlvb;
|
3 |
+
|
4 |
+
wpmvvl = wpmv.visualizer.Library;
|
5 |
+
wpmvlvb = wpmv.l10n.visualizer.button;
|
6 |
+
|
7 |
+
wpmv.toolbar = wpmv.toolbar || {};
|
8 |
+
wpmvtv = wpmv.toolbar.visualizer = {};
|
9 |
+
|
10 |
+
/**
|
11 |
+
* =========================================================================
|
12 |
+
* Library Toolbar
|
13 |
+
* =========================================================================
|
14 |
+
*/
|
15 |
+
wpmvtv.Library = wpmvt.extend({
|
16 |
+
initialize: function() {
|
17 |
+
var self = this;
|
18 |
+
|
19 |
+
_.defaults(self.options, {
|
20 |
+
close: false,
|
21 |
+
items: {
|
22 |
+
type_filter: new wpmvvl.Types({
|
23 |
+
controller: self.controller,
|
24 |
+
priority: -100
|
25 |
+
}),
|
26 |
+
pagination: new wpmvvl.Pagination({
|
27 |
+
controller: self.controller,
|
28 |
+
priority: 100
|
29 |
+
})
|
30 |
+
}
|
31 |
+
});
|
32 |
+
|
33 |
+
wpmvt.prototype.initialize.apply(self, arguments);
|
34 |
+
}
|
35 |
+
});
|
36 |
+
})(wp.media.view, wp.media.view.Toolbar);
|
js/media/view.js
ADDED
@@ -0,0 +1,433 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($, wpm) {
|
2 |
+
var libraryWidth, libraryHeight, wpmv, wpmV, wpmvv, wpmvvl, wpmvvb, l10n;
|
3 |
+
|
4 |
+
wpmv = wpm.view;
|
5 |
+
wpmV = wpm.View;
|
6 |
+
wpmvv = wpmv.visualizer = {};
|
7 |
+
l10n = wpmv.l10n.visualizer;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* =========================================================================
|
11 |
+
* COMMON
|
12 |
+
* =========================================================================
|
13 |
+
*/
|
14 |
+
|
15 |
+
wpmvv.Chart = wpmV.extend({
|
16 |
+
className: 'visualizer-library-chart-canvas',
|
17 |
+
|
18 |
+
constructor: function(options) {
|
19 |
+
this.id = 'visualizer-chart-' + options.model.get('id');
|
20 |
+
wpmV.apply(this, arguments);
|
21 |
+
},
|
22 |
+
|
23 |
+
render: function() {
|
24 |
+
var self, model, chart, gv, type, series, data, table, settings, i, j, row, date;
|
25 |
+
|
26 |
+
self = this;
|
27 |
+
gv = google.visualization;
|
28 |
+
model = self.model;
|
29 |
+
|
30 |
+
self.$el
|
31 |
+
.width(self.options.width)
|
32 |
+
.height(self.options.height)
|
33 |
+
.css('background-image', 'none');
|
34 |
+
|
35 |
+
type = model.get('type');
|
36 |
+
series = model.get('series');
|
37 |
+
data = model.get('data');
|
38 |
+
settings = model.get('settings');
|
39 |
+
|
40 |
+
table = new gv.DataTable({cols: series});
|
41 |
+
chart = type == 'gauge' ? 'Gauge' : type.charAt(0).toUpperCase() + type.slice(1) + 'Chart';
|
42 |
+
chart = new gv[chart](self.el);
|
43 |
+
|
44 |
+
switch (type) {
|
45 |
+
case 'pie':
|
46 |
+
if (settings.slices) {
|
47 |
+
for (i in settings.slices) {
|
48 |
+
if (settings.slices[i]['color'] == '') {
|
49 |
+
delete settings.slices[i]['color'];
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
53 |
+
break;
|
54 |
+
case 'line':
|
55 |
+
case 'bar':
|
56 |
+
case 'column':
|
57 |
+
case 'area':
|
58 |
+
case 'scatter':
|
59 |
+
case 'candlestick':
|
60 |
+
if (settings.series) {
|
61 |
+
for (i in settings.series) {
|
62 |
+
if (settings.series[i]['color'] == '') {
|
63 |
+
delete settings.series[i]['color'];
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
break;
|
68 |
+
case 'geo':
|
69 |
+
if (settings.region != undefined && settings.region.replace(/^\s+|\s+$/g, '') == '') {
|
70 |
+
settings['region'] = 'world';
|
71 |
+
}
|
72 |
+
break;
|
73 |
+
case 'gauge':
|
74 |
+
break;
|
75 |
+
default:
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
|
79 |
+
for (i = 0; i < data.length; i++) {
|
80 |
+
row = [];
|
81 |
+
for (j = 0; j < series.length; j++) {
|
82 |
+
if (series[j].type == 'date' || series[j].type == 'datetime') {
|
83 |
+
date = new Date(data[i][j]);
|
84 |
+
data[i][j] = null;
|
85 |
+
if (Object.prototype.toString.call(date) === "[object Date]") {
|
86 |
+
if (!isNaN(date.getTime())) {
|
87 |
+
data[i][j] = date;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
}
|
91 |
+
row.push(data[i][j]);
|
92 |
+
}
|
93 |
+
table.addRow(row);
|
94 |
+
}
|
95 |
+
|
96 |
+
chart.draw(table, settings);
|
97 |
+
}
|
98 |
+
});
|
99 |
+
|
100 |
+
/**
|
101 |
+
* =========================================================================
|
102 |
+
* LIBRARY
|
103 |
+
* =========================================================================
|
104 |
+
*/
|
105 |
+
|
106 |
+
wpmvvl = wpmvv.Library = wpmV.extend({
|
107 |
+
id: 'visualizer-library-view',
|
108 |
+
className: 'visualizer-clearfix',
|
109 |
+
template: wpm.template('visualizer-library-empty'),
|
110 |
+
|
111 |
+
initialize: function() {
|
112 |
+
var self = this;
|
113 |
+
|
114 |
+
_.defaults(self.options, {
|
115 |
+
filter: 'all',
|
116 |
+
page: 1
|
117 |
+
});
|
118 |
+
|
119 |
+
self.controller.on('visualizer:library:filter', self.onFilterChanged, self);
|
120 |
+
self.controller.on('visualizer:library:page', self.onPageChanged, self);
|
121 |
+
self.collection.on('reset', self.renderCollection, self);
|
122 |
+
|
123 |
+
self.resetCollection();
|
124 |
+
},
|
125 |
+
|
126 |
+
onFilterChanged: function(filter) {
|
127 |
+
this.options.filter = filter;
|
128 |
+
this.options.page = 1;
|
129 |
+
this.resetCollection();
|
130 |
+
},
|
131 |
+
|
132 |
+
onPageChanged: function(page) {
|
133 |
+
this.options.page = page;
|
134 |
+
this.resetCollection();
|
135 |
+
},
|
136 |
+
|
137 |
+
render: function() {},
|
138 |
+
|
139 |
+
renderCollection: function() {
|
140 |
+
var self = this;
|
141 |
+
|
142 |
+
self.views.dispose();
|
143 |
+
|
144 |
+
if (self.collection.length > 0) {
|
145 |
+
self.$el.html('');
|
146 |
+
self.collection.each(self.addChart, self);
|
147 |
+
} else {
|
148 |
+
self.$el.html(self.template({}));
|
149 |
+
}
|
150 |
+
},
|
151 |
+
|
152 |
+
addChart: function(chart) {
|
153 |
+
var self = this,
|
154 |
+
view = new wpmvvl.Chart({ model: chart });
|
155 |
+
|
156 |
+
self.$el.append(view.$el);
|
157 |
+
self.views.set('#visualizer-chart-' + chart.get('id'), view, { silent: true });
|
158 |
+
view.render();
|
159 |
+
},
|
160 |
+
|
161 |
+
resetCollection: function() {
|
162 |
+
var self = this,
|
163 |
+
controller = self.controller,
|
164 |
+
content = controller.$el.find(controller.content.selector);
|
165 |
+
|
166 |
+
content.lock();
|
167 |
+
self.collection.fetch({
|
168 |
+
silent: false,
|
169 |
+
data: {
|
170 |
+
filter: self.options.filter,
|
171 |
+
page: self.options.page
|
172 |
+
},
|
173 |
+
statusCode: {
|
174 |
+
200: function(response) {
|
175 |
+
var paginationView = controller.toolbar.get('toolbar').get('pagination');
|
176 |
+
|
177 |
+
if (self.options.page > response.total) {
|
178 |
+
self.options.page = response.total;
|
179 |
+
self.resetCollection();
|
180 |
+
} else {
|
181 |
+
paginationView.options.page = self.options.page;
|
182 |
+
paginationView.options.total = response.total || 1;
|
183 |
+
paginationView.render();
|
184 |
+
}
|
185 |
+
|
186 |
+
content.unlock();
|
187 |
+
}
|
188 |
+
}
|
189 |
+
});
|
190 |
+
}
|
191 |
+
});
|
192 |
+
|
193 |
+
wpmvvl.Chart = wpmV.extend({
|
194 |
+
className: 'visualizer-library-chart',
|
195 |
+
template: wpm.template('visualizer-library-chart'),
|
196 |
+
|
197 |
+
events: {
|
198 |
+
'click .visualizer-library-chart-delete': 'deleteChart',
|
199 |
+
'click .visualizer-library-chart-insert': 'insertChart',
|
200 |
+
'click .visualizer-library-chart-shortcode': 'selectShortcode'
|
201 |
+
},
|
202 |
+
|
203 |
+
initialize: function() {
|
204 |
+
var self = this;
|
205 |
+
|
206 |
+
if (!libraryWidth && !libraryHeight) {
|
207 |
+
libraryWidth = $('#visualizer-library-view').width() / 3 - 40;
|
208 |
+
libraryHeight = libraryWidth * 3 / 4;
|
209 |
+
|
210 |
+
libraryWidth = Math.floor(libraryWidth);
|
211 |
+
libraryHeight = Math.floor(libraryHeight);
|
212 |
+
}
|
213 |
+
|
214 |
+
self._view = new wpmvv.Chart({
|
215 |
+
model: self.model,
|
216 |
+
width: libraryWidth,
|
217 |
+
height: libraryHeight
|
218 |
+
});
|
219 |
+
|
220 |
+
self.$el.html(self.template(self.model.toJSON())).prepend(self._view.$el);
|
221 |
+
self.views.set('#' + self._view.id, self._view, { silent: true });
|
222 |
+
},
|
223 |
+
|
224 |
+
render: function() {
|
225 |
+
this._view.render();
|
226 |
+
},
|
227 |
+
|
228 |
+
deleteChart: function() {
|
229 |
+
var self = this;
|
230 |
+
|
231 |
+
if (showNotice.warn()) {
|
232 |
+
self.model.destroy({
|
233 |
+
wait: true,
|
234 |
+
success: function() {
|
235 |
+
self.views.parent.resetCollection();
|
236 |
+
}
|
237 |
+
});
|
238 |
+
}
|
239 |
+
},
|
240 |
+
|
241 |
+
insertChart: function() {
|
242 |
+
wpm.editor.insert('[visualizer id="' + this.model.get('id') + '"]');
|
243 |
+
},
|
244 |
+
|
245 |
+
selectShortcode: function(e) {
|
246 |
+
var range, selection;
|
247 |
+
|
248 |
+
if (window.getSelection && document.createRange) {
|
249 |
+
selection = window.getSelection();
|
250 |
+
range = document.createRange();
|
251 |
+
range.selectNodeContents(e.target);
|
252 |
+
selection.removeAllRanges();
|
253 |
+
selection.addRange(range);
|
254 |
+
} else if (document.selection && document.body.createTextRange) {
|
255 |
+
range = document.body.createTextRange();
|
256 |
+
range.moveToElementText(e.target);
|
257 |
+
range.select();
|
258 |
+
}
|
259 |
+
}
|
260 |
+
});
|
261 |
+
|
262 |
+
wpmvvl.Types = wpmV.extend({
|
263 |
+
tagName: 'select',
|
264 |
+
className: 'visualizer-library-filters',
|
265 |
+
|
266 |
+
events: {
|
267 |
+
change: 'onFilterChange'
|
268 |
+
},
|
269 |
+
|
270 |
+
initialize: function() {
|
271 |
+
var self = this;
|
272 |
+
|
273 |
+
self.createFilters();
|
274 |
+
self.$el.html(_.chain(self.filters).map(function(filter) {
|
275 |
+
return {
|
276 |
+
el: self.make('option', {value: filter.key}, filter.text),
|
277 |
+
priority: filter.priority || 50
|
278 |
+
};
|
279 |
+
}).sortBy('priority').pluck('el').value());
|
280 |
+
},
|
281 |
+
|
282 |
+
createFilters: function() {
|
283 |
+
var self = this;
|
284 |
+
|
285 |
+
self.filters = {};
|
286 |
+
_.each(['all', 'pie', 'line', 'area', 'bar', 'column', 'geo', 'scatter', 'gauge', 'candlestick'], function(type, i) {
|
287 |
+
self.filters[type] = {
|
288 |
+
text: l10n.library.filters[type],
|
289 |
+
key: type,
|
290 |
+
priority: (i + 1) * 10
|
291 |
+
};
|
292 |
+
});
|
293 |
+
},
|
294 |
+
|
295 |
+
onFilterChange: function() {
|
296 |
+
this.controller.trigger('visualizer:library:filter', this.el.value);
|
297 |
+
}
|
298 |
+
});
|
299 |
+
|
300 |
+
wpmvvl.Pagination = wpmV.extend({
|
301 |
+
id: 'visualizer-library-pagination',
|
302 |
+
tagName: 'ul',
|
303 |
+
|
304 |
+
events: {
|
305 |
+
'click a.visualizer-library-pagination-page': 'onPageChange'
|
306 |
+
},
|
307 |
+
|
308 |
+
initialize: function() {
|
309 |
+
_.defaults(this.options, {
|
310 |
+
total: 1,
|
311 |
+
page: 1
|
312 |
+
});
|
313 |
+
},
|
314 |
+
|
315 |
+
render: function() {
|
316 |
+
var self, items;
|
317 |
+
|
318 |
+
self = this;
|
319 |
+
if (self.options.page <= 1 && self.options.total <= 1) {
|
320 |
+
self.$el.html('');
|
321 |
+
return;
|
322 |
+
}
|
323 |
+
|
324 |
+
items = self._pagination(self.options.page, self.options.total, 7);
|
325 |
+
|
326 |
+
self.$el.html(_.chain(items).map(function(item) {
|
327 |
+
var content, className;
|
328 |
+
|
329 |
+
content = item == '...' || item == self.options.page
|
330 |
+
? self.make('span', { class: 'visualizer-library-pagination-page' }, item)
|
331 |
+
: self.make('a', { class: 'visualizer-library-pagination-page', href: 'javascript:;', 'data-page': item }, item);
|
332 |
+
|
333 |
+
className = item == self.options.page
|
334 |
+
? 'visualizer-library-pagination-item visualizer-library-pagination-active'
|
335 |
+
: 'visualizer-library-pagination-item';
|
336 |
+
|
337 |
+
return self.make('li', { class: className }, content);
|
338 |
+
}).value());
|
339 |
+
},
|
340 |
+
|
341 |
+
_pagination: function(current, total, max) {
|
342 |
+
var i, tmp, pagenation = [];
|
343 |
+
|
344 |
+
if ( total <= max ) {
|
345 |
+
for ( i = 1; i <= total; i++ ) {
|
346 |
+
pagenation.push(i);
|
347 |
+
}
|
348 |
+
} else {
|
349 |
+
tmp = current - Math.floor( max / 2 );
|
350 |
+
|
351 |
+
if ( max % 2 == 0 ) {
|
352 |
+
tmp++;
|
353 |
+
}
|
354 |
+
|
355 |
+
if ( tmp < 1 ) {
|
356 |
+
tmp = 1;
|
357 |
+
}
|
358 |
+
|
359 |
+
if ( tmp + max > total ) {
|
360 |
+
tmp = total - max + 1;
|
361 |
+
}
|
362 |
+
|
363 |
+
for ( i = 1; i <= max; i++ ) {
|
364 |
+
pagenation.push(tmp++);
|
365 |
+
}
|
366 |
+
|
367 |
+
if ( pagenation[0] != 1 ) {
|
368 |
+
pagenation[0] = 1;
|
369 |
+
pagenation[1] = '...';
|
370 |
+
}
|
371 |
+
|
372 |
+
if ( pagenation[max - 1] != total ) {
|
373 |
+
pagenation[max - 1] = total;
|
374 |
+
pagenation[max - 2] = '...';
|
375 |
+
}
|
376 |
+
}
|
377 |
+
|
378 |
+
return pagenation;
|
379 |
+
},
|
380 |
+
|
381 |
+
onPageChange: function(e) {
|
382 |
+
this.controller.trigger('visualizer:library:page', $(e.target).data('page'));
|
383 |
+
}
|
384 |
+
});
|
385 |
+
})(jQuery, wp.media);
|
386 |
+
|
387 |
+
(function($) {
|
388 |
+
$.fn.lock = function() {
|
389 |
+
$(this).each(function() {
|
390 |
+
var locker = $('<div class="locker"></div>'),
|
391 |
+
loader = $('<div class="locker-loader"></div>'),
|
392 |
+
$this = $(this),
|
393 |
+
position = $this.css('position');
|
394 |
+
|
395 |
+
if ($this.find('.locker').length > 0) {
|
396 |
+
return;
|
397 |
+
}
|
398 |
+
|
399 |
+
if (!position) {
|
400 |
+
position = 'static';
|
401 |
+
}
|
402 |
+
|
403 |
+
$this.css('overflow', 'hidden');
|
404 |
+
switch(position) {
|
405 |
+
case 'absolute':
|
406 |
+
case 'relative':
|
407 |
+
break;
|
408 |
+
default:
|
409 |
+
$this.css('position', 'relative');
|
410 |
+
break;
|
411 |
+
}
|
412 |
+
$this.data('position', position);
|
413 |
+
|
414 |
+
locker.css('top', $this.scrollTop() + 'px').append(loader);
|
415 |
+
$this.append(locker);
|
416 |
+
});
|
417 |
+
|
418 |
+
return $(this);
|
419 |
+
}
|
420 |
+
|
421 |
+
$.fn.unlock = function() {
|
422 |
+
$(this).each(function() {
|
423 |
+
var $this = $(this);
|
424 |
+
|
425 |
+
$this.css({
|
426 |
+
position: $this.data('position'),
|
427 |
+
overflow: 'auto'
|
428 |
+
}).find('.locker').remove();
|
429 |
+
});
|
430 |
+
|
431 |
+
return $(this);
|
432 |
+
}
|
433 |
+
})(jQuery);
|
js/preview.js
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($, v) {
|
2 |
+
var timeout;
|
3 |
+
|
4 |
+
$(document).ready(function() {
|
5 |
+
function updateChart() {
|
6 |
+
clearTimeout(timeout);
|
7 |
+
timeout = setTimeout(function() {
|
8 |
+
var settings = $('#settings-form').serializeObject();
|
9 |
+
|
10 |
+
delete settings['width'];
|
11 |
+
delete settings['height'];
|
12 |
+
|
13 |
+
v.charts.canvas.settings = settings;
|
14 |
+
v.render();
|
15 |
+
}, 1000);
|
16 |
+
}
|
17 |
+
|
18 |
+
$('.control-text').change(updateChart).keyup(updateChart);
|
19 |
+
$('.control-select').change(updateChart);
|
20 |
+
$('.color-picker-hex').wpColorPicker({
|
21 |
+
change: updateChart,
|
22 |
+
clear: updateChart
|
23 |
+
});
|
24 |
+
});
|
25 |
+
})(jQuery, visualizer);
|
26 |
+
|
27 |
+
(function($) {
|
28 |
+
$.fn.serializeObject = function() {
|
29 |
+
var self = this,
|
30 |
+
json = {},
|
31 |
+
push_counters = {},
|
32 |
+
patterns = {
|
33 |
+
"validate": /^[a-zA-Z][a-zA-Z0-9_]*(?:\[(?:\d*|[a-zA-Z0-9_]+)\])*$/,
|
34 |
+
"key": /[a-zA-Z0-9_]+|(?=\[\])/g,
|
35 |
+
"push": /^$/,
|
36 |
+
"fixed": /^\d+$/,
|
37 |
+
"named": /^[a-zA-Z0-9_]+$/
|
38 |
+
};
|
39 |
+
|
40 |
+
this.build = function(base, key, value) {
|
41 |
+
base[key] = value;
|
42 |
+
return base;
|
43 |
+
};
|
44 |
+
|
45 |
+
this.push_counter = function(key) {
|
46 |
+
if (push_counters[key] === undefined) {
|
47 |
+
push_counters[key] = 0;
|
48 |
+
}
|
49 |
+
return push_counters[key]++;
|
50 |
+
};
|
51 |
+
|
52 |
+
$.each($(this).serializeArray(), function() {
|
53 |
+
// skip invalid keys
|
54 |
+
if (!patterns.validate.test(this.name)) {
|
55 |
+
return;
|
56 |
+
}
|
57 |
+
|
58 |
+
var k,
|
59 |
+
keys = this.name.match(patterns.key),
|
60 |
+
merge = this.value,
|
61 |
+
reverse_key = this.name;
|
62 |
+
|
63 |
+
while ((k = keys.pop()) !== undefined) {
|
64 |
+
// adjust reverse_key
|
65 |
+
reverse_key = reverse_key.replace(new RegExp("\\[" + k + "\\]$"), '');
|
66 |
+
|
67 |
+
if (k.match(patterns.push)) {
|
68 |
+
// push
|
69 |
+
merge = self.build([], self.push_counter(reverse_key), merge);
|
70 |
+
} else if (k.match(patterns.fixed)) {
|
71 |
+
// fixed
|
72 |
+
merge = self.build([], k, merge);
|
73 |
+
} else if (k.match(patterns.named)) {
|
74 |
+
// named
|
75 |
+
merge = self.build({}, k, merge);
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
json = $.extend(true, json, merge);
|
80 |
+
});
|
81 |
+
|
82 |
+
return json;
|
83 |
+
};
|
84 |
+
})(jQuery);
|
js/render.js
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(v, g) {
|
2 |
+
var gv;
|
3 |
+
|
4 |
+
v.objects = {};
|
5 |
+
|
6 |
+
v.renderChart = function(id) {
|
7 |
+
var chart, render, container, series, data, table, settings, i, j, row, date;
|
8 |
+
|
9 |
+
chart = v.charts[id];
|
10 |
+
series = chart.series;
|
11 |
+
data = chart.data;
|
12 |
+
settings = chart.settings;
|
13 |
+
|
14 |
+
container = document.getElementById(id);
|
15 |
+
table = new gv.DataTable({cols: series});
|
16 |
+
|
17 |
+
render = v.objects[id] || null;
|
18 |
+
if (!render) {
|
19 |
+
render = chart.type == 'gauge'
|
20 |
+
? 'Gauge'
|
21 |
+
: chart.type.charAt(0).toUpperCase() + chart.type.slice(1) + 'Chart';
|
22 |
+
|
23 |
+
render = new gv[render](container);
|
24 |
+
}
|
25 |
+
|
26 |
+
switch (v.charts[id].type) {
|
27 |
+
case 'pie':
|
28 |
+
if (settings.slices) {
|
29 |
+
for (i in settings.slices) {
|
30 |
+
if (settings.slices[i]['color'] == '') {
|
31 |
+
delete settings.slices[i]['color'];
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
35 |
+
break;
|
36 |
+
case 'line':
|
37 |
+
case 'bar':
|
38 |
+
case 'column':
|
39 |
+
case 'area':
|
40 |
+
case 'scatter':
|
41 |
+
case 'candlestick':
|
42 |
+
if (settings.series) {
|
43 |
+
for (i in settings.series) {
|
44 |
+
if (settings.series[i]['color'] == '') {
|
45 |
+
delete settings.series[i]['color'];
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
49 |
+
break;
|
50 |
+
case 'geo':
|
51 |
+
if (settings.region != undefined && settings.region.replace(/^\s+|\s+$/g, '') == '') {
|
52 |
+
settings['region'] = 'world';
|
53 |
+
}
|
54 |
+
break;
|
55 |
+
case 'gauge':
|
56 |
+
break;
|
57 |
+
default:
|
58 |
+
return;
|
59 |
+
}
|
60 |
+
|
61 |
+
for (i = 0; i < data.length; i++) {
|
62 |
+
row = [];
|
63 |
+
for (j = 0; j < series.length; j++) {
|
64 |
+
if (series[j].type == 'date' || series[j].type == 'datetime') {
|
65 |
+
date = new Date(data[i][j]);
|
66 |
+
data[i][j] = null;
|
67 |
+
if (Object.prototype.toString.call(date) === "[object Date]") {
|
68 |
+
if (!isNaN(date.getTime())) {
|
69 |
+
data[i][j] = date;
|
70 |
+
}
|
71 |
+
}
|
72 |
+
}
|
73 |
+
row.push(data[i][j]);
|
74 |
+
}
|
75 |
+
table.addRow(row);
|
76 |
+
}
|
77 |
+
|
78 |
+
render.draw(table, settings);
|
79 |
+
};
|
80 |
+
|
81 |
+
v.render = function() {
|
82 |
+
for (var id in (v.charts || {})) {
|
83 |
+
v.renderChart(id);
|
84 |
+
}
|
85 |
+
};
|
86 |
+
|
87 |
+
g.load("visualization", "1", {packages: ["corechart", "geochart", "gauge"]});
|
88 |
+
g.setOnLoadCallback(function() {
|
89 |
+
gv = g.visualization;
|
90 |
+
v.render();
|
91 |
+
});
|
92 |
+
})(visualizer, google);
|
93 |
+
|
94 |
+
(function($, v) {
|
95 |
+
var resizeTimeout;
|
96 |
+
|
97 |
+
$(document).ready(function() {
|
98 |
+
$(window).resize(function() {
|
99 |
+
clearTimeout(resizeTimeout);
|
100 |
+
resizeTimeout = setTimeout(v.render, 100);
|
101 |
+
});
|
102 |
+
});
|
103 |
+
})(jQuery, visualizer);
|
languages/visualizer-en_US.mo
ADDED
Binary file
|
languages/visualizer-en_US.po
ADDED
@@ -0,0 +1,878 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Visualizer\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2013-07-20 15:53+0300\n"
|
6 |
+
"PO-Revision-Date: 2013-07-20 15:53+0300\n"
|
7 |
+
"Last-Translator: Eugene Manuilov <eugene@manuilov.org>\n"
|
8 |
+
"Language-Team: Eugene Manuilov <eugene@manuilov.org>\n"
|
9 |
+
"Language: en_US\n"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Poedit-Basepath: ./../\n"
|
14 |
+
"X-Poedit-KeywordsList: __;_e;esc_html_e;esc_html__;esc_attr_e;esc_attr__\n"
|
15 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
16 |
+
"X-Generator: Poedit 1.5.4\n"
|
17 |
+
"X-Poedit-SearchPath-0: classes/Visualizer\n"
|
18 |
+
|
19 |
+
#: classes/Visualizer/Render/Library.php:63
|
20 |
+
#: classes/Visualizer/Render/Templates.php:69
|
21 |
+
msgid "Delete"
|
22 |
+
msgstr "Delete"
|
23 |
+
|
24 |
+
#: classes/Visualizer/Render/Library.php:64
|
25 |
+
msgid "Clone"
|
26 |
+
msgstr "Clone"
|
27 |
+
|
28 |
+
#: classes/Visualizer/Render/Library.php:65
|
29 |
+
msgid "Edit"
|
30 |
+
msgstr "Edit"
|
31 |
+
|
32 |
+
#: classes/Visualizer/Render/Library.php:67
|
33 |
+
#: classes/Visualizer/Render/Templates.php:72
|
34 |
+
msgid "Click to select"
|
35 |
+
msgstr "Click to select"
|
36 |
+
|
37 |
+
#: classes/Visualizer/Render/Library.php:118
|
38 |
+
#: classes/Visualizer/Render/Templates.php:86
|
39 |
+
msgid "No charts found"
|
40 |
+
msgstr "No charts found"
|
41 |
+
|
42 |
+
#: classes/Visualizer/Render/Library.php:145
|
43 |
+
msgid "Visualizer Library"
|
44 |
+
msgstr "Visualizer Library"
|
45 |
+
|
46 |
+
#: classes/Visualizer/Render/Library.php:146
|
47 |
+
msgid "Add New"
|
48 |
+
msgstr "Add New"
|
49 |
+
|
50 |
+
#: classes/Visualizer/Render/Templates.php:70
|
51 |
+
msgid "Insert"
|
52 |
+
msgstr "Insert"
|
53 |
+
|
54 |
+
#: classes/Visualizer/Render/Sidebar.php:101
|
55 |
+
msgid "Right of the chart"
|
56 |
+
msgstr "Right of the chart"
|
57 |
+
|
58 |
+
#: classes/Visualizer/Render/Sidebar.php:102
|
59 |
+
msgid "Above the chart"
|
60 |
+
msgstr "Above the chart"
|
61 |
+
|
62 |
+
#: classes/Visualizer/Render/Sidebar.php:103
|
63 |
+
msgid "Below the chart"
|
64 |
+
msgstr "Below the chart"
|
65 |
+
|
66 |
+
#: classes/Visualizer/Render/Sidebar.php:104
|
67 |
+
msgid "Inside the chart"
|
68 |
+
msgstr "Inside the chart"
|
69 |
+
|
70 |
+
#: classes/Visualizer/Render/Sidebar.php:105
|
71 |
+
msgid "Omit the legend"
|
72 |
+
msgstr "Omit the legend"
|
73 |
+
|
74 |
+
#: classes/Visualizer/Render/Sidebar.php:110
|
75 |
+
msgid "Aligned to the start of the allocated area"
|
76 |
+
msgstr "Aligned to the start of the allocated area"
|
77 |
+
|
78 |
+
#: classes/Visualizer/Render/Sidebar.php:111
|
79 |
+
msgid "Centered in the allocated area"
|
80 |
+
msgstr "Centered in the allocated area"
|
81 |
+
|
82 |
+
#: classes/Visualizer/Render/Sidebar.php:112
|
83 |
+
msgid "Aligned to the end of the allocated area"
|
84 |
+
msgstr "Aligned to the end of the allocated area"
|
85 |
+
|
86 |
+
#: classes/Visualizer/Render/Sidebar.php:117
|
87 |
+
msgid "Yes"
|
88 |
+
msgstr "Yes"
|
89 |
+
|
90 |
+
#: classes/Visualizer/Render/Sidebar.php:118
|
91 |
+
msgid "No"
|
92 |
+
msgstr "No"
|
93 |
+
|
94 |
+
#: classes/Visualizer/Render/Sidebar.php:131
|
95 |
+
msgid "Chart Title"
|
96 |
+
msgstr "Chart Title"
|
97 |
+
|
98 |
+
#: classes/Visualizer/Render/Sidebar.php:134
|
99 |
+
msgid "Text to display above the chart."
|
100 |
+
msgstr "Text to display above the chart."
|
101 |
+
|
102 |
+
#: classes/Visualizer/Render/Sidebar.php:146
|
103 |
+
msgid "General Settings"
|
104 |
+
msgstr "General Settings"
|
105 |
+
|
106 |
+
#: classes/Visualizer/Render/Sidebar.php:148
|
107 |
+
msgid "Configure title, font styles and legend positioning settings for the chart."
|
108 |
+
msgstr "Configure title, font styles and legend positioning settings for the chart."
|
109 |
+
|
110 |
+
#: classes/Visualizer/Render/Sidebar.php:154
|
111 |
+
msgid "Font Family And Size"
|
112 |
+
msgstr "Font Family And Size"
|
113 |
+
|
114 |
+
#: classes/Visualizer/Render/Sidebar.php:180
|
115 |
+
msgid "The default font family and size for all text in the chart."
|
116 |
+
msgstr "The default font family and size for all text in the chart."
|
117 |
+
|
118 |
+
#: classes/Visualizer/Render/Sidebar.php:185
|
119 |
+
msgid "Legend"
|
120 |
+
msgstr "Legend"
|
121 |
+
|
122 |
+
#: classes/Visualizer/Render/Sidebar.php:187
|
123 |
+
msgid "Position"
|
124 |
+
msgstr "Position"
|
125 |
+
|
126 |
+
#: classes/Visualizer/Render/Sidebar.php:191
|
127 |
+
msgid "Determines where to place the legend, compared to the chart area."
|
128 |
+
msgstr "Determines where to place the legend, compared to the chart area."
|
129 |
+
|
130 |
+
#: classes/Visualizer/Render/Sidebar.php:195
|
131 |
+
msgid "Alignment"
|
132 |
+
msgstr "Alignment"
|
133 |
+
|
134 |
+
#: classes/Visualizer/Render/Sidebar.php:199
|
135 |
+
msgid "Determines the alignment of the legend."
|
136 |
+
msgstr "Determines the alignment of the legend."
|
137 |
+
|
138 |
+
#: classes/Visualizer/Render/Sidebar.php:213
|
139 |
+
msgid "Layout & Chart Area"
|
140 |
+
msgstr "Layout & Chart Area"
|
141 |
+
|
142 |
+
#: classes/Visualizer/Render/Sidebar.php:214
|
143 |
+
msgid "Layout"
|
144 |
+
msgstr "Layout"
|
145 |
+
|
146 |
+
#: classes/Visualizer/Render/Sidebar.php:215
|
147 |
+
msgid "Configure the total size of the chart. Two formats are supported: a number, or a number followed by %. A simple number is a value in pixels; a number followed by % is a percentage."
|
148 |
+
msgstr "Configure the total size of the chart. Two formats are supported: a number, or a number followed by %. A simple number is a value in pixels; a number followed by % is a percentage."
|
149 |
+
|
150 |
+
#: classes/Visualizer/Render/Sidebar.php:219
|
151 |
+
msgid "Width And Height Of Chart"
|
152 |
+
msgstr "Width And Height Of Chart"
|
153 |
+
|
154 |
+
#: classes/Visualizer/Render/Sidebar.php:233
|
155 |
+
msgid "Determines the total width and height of the chart."
|
156 |
+
msgstr "Determines the total width and height of the chart."
|
157 |
+
|
158 |
+
#: classes/Visualizer/Render/Sidebar.php:239
|
159 |
+
msgid "Configure the background color for the main area of the chart and the chart border width and color."
|
160 |
+
msgstr "Configure the background color for the main area of the chart and the chart border width and color."
|
161 |
+
|
162 |
+
#: classes/Visualizer/Render/Sidebar.php:242
|
163 |
+
msgid "Stroke Width"
|
164 |
+
msgstr "Stroke Width"
|
165 |
+
|
166 |
+
#: classes/Visualizer/Render/Sidebar.php:245
|
167 |
+
msgid "The chart border width in pixels."
|
168 |
+
msgstr "The chart border width in pixels."
|
169 |
+
|
170 |
+
#: classes/Visualizer/Render/Sidebar.php:250
|
171 |
+
msgid "Stroke Color"
|
172 |
+
msgstr "Stroke Color"
|
173 |
+
|
174 |
+
#: classes/Visualizer/Render/Sidebar.php:257
|
175 |
+
msgid "Background Color"
|
176 |
+
msgstr "Background Color"
|
177 |
+
|
178 |
+
#: classes/Visualizer/Render/Sidebar.php:264
|
179 |
+
msgid "Chart Area"
|
180 |
+
msgstr "Chart Area"
|
181 |
+
|
182 |
+
#: classes/Visualizer/Render/Sidebar.php:265
|
183 |
+
msgid "Configure the placement and size of the chart area (where the chart itself is drawn, excluding axis and legends). Two formats are supported: a number, or a number followed by %. A simple number is a value in pixels; a number followed by % is a percentage."
|
184 |
+
msgstr "Configure the placement and size of the chart area (where the chart itself is drawn, excluding axis and legends). Two formats are supported: a number, or a number followed by %. A simple number is a value in pixels; a number followed by % is a percentage."
|
185 |
+
|
186 |
+
#: classes/Visualizer/Render/Sidebar.php:269
|
187 |
+
msgid "Left And Top Margins"
|
188 |
+
msgstr "Left And Top Margins"
|
189 |
+
|
190 |
+
#: classes/Visualizer/Render/Sidebar.php:283
|
191 |
+
msgid "Determines how far to draw the chart from the left and top borders."
|
192 |
+
msgstr "Determines how far to draw the chart from the left and top borders."
|
193 |
+
|
194 |
+
#: classes/Visualizer/Render/Sidebar.php:289
|
195 |
+
msgid "Width And Height Of Chart Area"
|
196 |
+
msgstr "Width And Height Of Chart Area"
|
197 |
+
|
198 |
+
#: classes/Visualizer/Render/Sidebar.php:303
|
199 |
+
msgid "Determines the width and hight of the chart area."
|
200 |
+
msgstr "Determines the width and hight of the chart area."
|
201 |
+
|
202 |
+
#: classes/Visualizer/Render/Sidebar.php:354
|
203 |
+
msgid "Hex Value"
|
204 |
+
msgstr "Hex Value"
|
205 |
+
|
206 |
+
#: classes/Visualizer/Render/Page/Data.php:62
|
207 |
+
#: classes/Visualizer/Render/Page/Data.php:73
|
208 |
+
msgid "Upload CSV file"
|
209 |
+
msgstr "Upload CSV file"
|
210 |
+
|
211 |
+
#: classes/Visualizer/Render/Page/Data.php:65
|
212 |
+
msgid "Select and upload your data CSV file here. The first row of the CSV file should contain the column headings. If you are unsure about how to format your data CSV then please take a look at this sample:"
|
213 |
+
msgstr "Select and upload your data CSV file here. The first row of the CSV file should contain the column headings. If you are unsure about how to format your data CSV then please take a look at this sample:"
|
214 |
+
|
215 |
+
#: classes/Visualizer/Render/Page/Data.php:90
|
216 |
+
#: classes/Visualizer/Render/Page/Settings.php:56
|
217 |
+
msgid "Back"
|
218 |
+
msgstr "Back"
|
219 |
+
|
220 |
+
#: classes/Visualizer/Render/Page/Data.php:93
|
221 |
+
#: classes/Visualizer/Render/Page/Types.php:84
|
222 |
+
msgid "Next"
|
223 |
+
msgstr "Next"
|
224 |
+
|
225 |
+
#: classes/Visualizer/Render/Sidebar/Columnar.php:44
|
226 |
+
msgid "Bars Settings"
|
227 |
+
msgstr "Bars Settings"
|
228 |
+
|
229 |
+
#: classes/Visualizer/Render/Sidebar/Columnar.php:47
|
230 |
+
msgid "Is Stacked"
|
231 |
+
msgstr "Is Stacked"
|
232 |
+
|
233 |
+
#: classes/Visualizer/Render/Sidebar/Columnar.php:51
|
234 |
+
msgid "If set to yes, series elements are stacked."
|
235 |
+
msgstr "If set to yes, series elements are stacked."
|
236 |
+
|
237 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:82
|
238 |
+
msgid "Straight line without curve"
|
239 |
+
msgstr "Straight line without curve"
|
240 |
+
|
241 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:83
|
242 |
+
msgid "The angles of the line will be smoothed"
|
243 |
+
msgstr "The angles of the line will be smoothed"
|
244 |
+
|
245 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:96
|
246 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:173
|
247 |
+
msgid "Line Width"
|
248 |
+
msgstr "Line Width"
|
249 |
+
|
250 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:99
|
251 |
+
msgid "Data line width in pixels. Use zero to hide all lines and show only the points."
|
252 |
+
msgstr "Data line width in pixels. Use zero to hide all lines and show only the points."
|
253 |
+
|
254 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:104
|
255 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:181
|
256 |
+
msgid "Point Size"
|
257 |
+
msgstr "Point Size"
|
258 |
+
|
259 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:107
|
260 |
+
msgid "Diameter of displayed points in pixels. Use zero to hide all points."
|
261 |
+
msgstr "Diameter of displayed points in pixels. Use zero to hide all points."
|
262 |
+
|
263 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:113
|
264 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:190
|
265 |
+
msgid "Curve Type"
|
266 |
+
msgstr "Curve Type"
|
267 |
+
|
268 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:117
|
269 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:169
|
270 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:194
|
271 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:269
|
272 |
+
#: classes/Visualizer/Render/Sidebar/Type/Candlestick.php:141
|
273 |
+
msgid "Determines whether the series has to be presented in the legend or not."
|
274 |
+
msgstr "Determines whether the series has to be presented in the legend or not."
|
275 |
+
|
276 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:123
|
277 |
+
#: classes/Visualizer/Render/Sidebar/Type/Candlestick.php:61
|
278 |
+
msgid "Focus Target"
|
279 |
+
msgstr "Focus Target"
|
280 |
+
|
281 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:128
|
282 |
+
#: classes/Visualizer/Render/Sidebar/Type/Candlestick.php:66
|
283 |
+
msgid "Focus on a single data point."
|
284 |
+
msgstr "Focus on a single data point."
|
285 |
+
|
286 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:129
|
287 |
+
#: classes/Visualizer/Render/Sidebar/Type/Candlestick.php:67
|
288 |
+
msgid "Focus on a grouping of all data points along the major axis."
|
289 |
+
msgstr "Focus on a grouping of all data points along the major axis."
|
290 |
+
|
291 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:131
|
292 |
+
#: classes/Visualizer/Render/Sidebar/Type/Candlestick.php:69
|
293 |
+
msgid "The type of the entity that receives focus on mouse hover. Also affects which entity is selected by mouse click."
|
294 |
+
msgstr "The type of the entity that receives focus on mouse hover. Also affects which entity is selected by mouse click."
|
295 |
+
|
296 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:144
|
297 |
+
msgid "Lines Settings"
|
298 |
+
msgstr "Lines Settings"
|
299 |
+
|
300 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:161
|
301 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:261
|
302 |
+
#: classes/Visualizer/Render/Sidebar/Type/Candlestick.php:133
|
303 |
+
msgid "Visible In Legend"
|
304 |
+
msgstr "Visible In Legend"
|
305 |
+
|
306 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:176
|
307 |
+
msgid "Overrides the global line width value for this series."
|
308 |
+
msgstr "Overrides the global line width value for this series."
|
309 |
+
|
310 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:184
|
311 |
+
msgid "Overrides the global point size value for this series."
|
312 |
+
msgstr "Overrides the global point size value for this series."
|
313 |
+
|
314 |
+
#: classes/Visualizer/Render/Sidebar/Linear.php:199
|
315 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:273
|
316 |
+
#: classes/Visualizer/Render/Sidebar/Type/Candlestick.php:145
|
317 |
+
msgid "Color"
|
318 |
+
msgstr "Color"
|
319 |
+
|
320 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:83
|
321 |
+
msgid "Outside the chart"
|
322 |
+
msgstr "Outside the chart"
|
323 |
+
|
324 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:84
|
325 |
+
msgid "None"
|
326 |
+
msgstr "None"
|
327 |
+
|
328 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:99
|
329 |
+
msgid "Chart Title Position"
|
330 |
+
msgstr "Chart Title Position"
|
331 |
+
|
332 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:103
|
333 |
+
msgid "Where to place the chart title, compared to the chart area."
|
334 |
+
msgstr "Where to place the chart title, compared to the chart area."
|
335 |
+
|
336 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:117
|
337 |
+
msgid "Identical Direction"
|
338 |
+
msgstr "Identical Direction"
|
339 |
+
|
340 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:118
|
341 |
+
msgid "Reverse Direction"
|
342 |
+
msgstr "Reverse Direction"
|
343 |
+
|
344 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:121
|
345 |
+
msgid "Horizontal & Vertical Axes"
|
346 |
+
msgstr "Horizontal & Vertical Axes"
|
347 |
+
|
348 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:124
|
349 |
+
msgid "Axes Titles Position"
|
350 |
+
msgstr "Axes Titles Position"
|
351 |
+
|
352 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:128
|
353 |
+
msgid "Determines where to place the axis titles, compared to the chart area."
|
354 |
+
msgstr "Determines where to place the axis titles, compared to the chart area."
|
355 |
+
|
356 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:132
|
357 |
+
msgid "Horizontal Axis"
|
358 |
+
msgstr "Horizontal Axis"
|
359 |
+
|
360 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:134
|
361 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:183
|
362 |
+
msgid "Axis Title"
|
363 |
+
msgstr "Axis Title"
|
364 |
+
|
365 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:137
|
366 |
+
msgid "The title of the horizontal axis."
|
367 |
+
msgstr "The title of the horizontal axis."
|
368 |
+
|
369 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:141
|
370 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:190
|
371 |
+
msgid "Text Position"
|
372 |
+
msgstr "Text Position"
|
373 |
+
|
374 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:145
|
375 |
+
msgid "Position of the horizontal axis text, relative to the chart area."
|
376 |
+
msgstr "Position of the horizontal axis text, relative to the chart area."
|
377 |
+
|
378 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:149
|
379 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:198
|
380 |
+
msgid "Direction"
|
381 |
+
msgstr "Direction"
|
382 |
+
|
383 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:153
|
384 |
+
msgid "The direction in which the values along the horizontal axis grow."
|
385 |
+
msgstr "The direction in which the values along the horizontal axis grow."
|
386 |
+
|
387 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:158
|
388 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:207
|
389 |
+
msgid "Grid Lines Count"
|
390 |
+
msgstr "Grid Lines Count"
|
391 |
+
|
392 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:161
|
393 |
+
msgid "The number of horizontal gridlines inside the chart area. Minimum value is 2. Specify -1 to automatically compute the number of gridlines."
|
394 |
+
msgstr "The number of horizontal gridlines inside the chart area. Minimum value is 2. Specify -1 to automatically compute the number of gridlines."
|
395 |
+
|
396 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:166
|
397 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:215
|
398 |
+
msgid "Grid Lines Color"
|
399 |
+
msgstr "Grid Lines Color"
|
400 |
+
|
401 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:174
|
402 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:223
|
403 |
+
msgid "Base Line Color"
|
404 |
+
msgstr "Base Line Color"
|
405 |
+
|
406 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:181
|
407 |
+
msgid "Vertical Axis"
|
408 |
+
msgstr "Vertical Axis"
|
409 |
+
|
410 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:186
|
411 |
+
msgid "The title of the vertical axis."
|
412 |
+
msgstr "The title of the vertical axis."
|
413 |
+
|
414 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:194
|
415 |
+
msgid "Position of the vertical axis text, relative to the chart area."
|
416 |
+
msgstr "Position of the vertical axis text, relative to the chart area."
|
417 |
+
|
418 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:202
|
419 |
+
msgid "The direction in which the values along the vertical axis grow."
|
420 |
+
msgstr "The direction in which the values along the vertical axis grow."
|
421 |
+
|
422 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:210
|
423 |
+
msgid "The number of vertical gridlines inside the chart area. Minimum value is 2. Specify -1 to automatically compute the number of gridlines."
|
424 |
+
msgstr "The number of vertical gridlines inside the chart area. Minimum value is 2. Specify -1 to automatically compute the number of gridlines."
|
425 |
+
|
426 |
+
#: classes/Visualizer/Render/Sidebar/Graph.php:240
|
427 |
+
msgid "Series Settings"
|
428 |
+
msgstr "Series Settings"
|
429 |
+
|
430 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:58
|
431 |
+
msgid "Pie Settings"
|
432 |
+
msgstr "Pie Settings"
|
433 |
+
|
434 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:61
|
435 |
+
msgid "Is 3D"
|
436 |
+
msgstr "Is 3D"
|
437 |
+
|
438 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:65
|
439 |
+
msgid "If set to yes, displays a three-dimensional chart."
|
440 |
+
msgstr "If set to yes, displays a three-dimensional chart."
|
441 |
+
|
442 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:69
|
443 |
+
msgid "Reverse Categories"
|
444 |
+
msgstr "Reverse Categories"
|
445 |
+
|
446 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:73
|
447 |
+
msgid "If set to yes, will draw slices counterclockwise."
|
448 |
+
msgstr "If set to yes, will draw slices counterclockwise."
|
449 |
+
|
450 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:77
|
451 |
+
msgid "Slice Text"
|
452 |
+
msgstr "Slice Text"
|
453 |
+
|
454 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:82
|
455 |
+
msgid "The percentage of the slice size out of the total"
|
456 |
+
msgstr "The percentage of the slice size out of the total"
|
457 |
+
|
458 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:83
|
459 |
+
msgid "The quantitative value of the slice"
|
460 |
+
msgstr "The quantitative value of the slice"
|
461 |
+
|
462 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:84
|
463 |
+
msgid "The name of the slice"
|
464 |
+
msgstr "The name of the slice"
|
465 |
+
|
466 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:85
|
467 |
+
msgid "No text is displayed"
|
468 |
+
msgstr "No text is displayed"
|
469 |
+
|
470 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:87
|
471 |
+
msgid "The content of the text displayed on the slice."
|
472 |
+
msgstr "The content of the text displayed on the slice."
|
473 |
+
|
474 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:91
|
475 |
+
msgid "Slice Border Color"
|
476 |
+
msgstr "Slice Border Color"
|
477 |
+
|
478 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:108
|
479 |
+
msgid "Residue Settings"
|
480 |
+
msgstr "Residue Settings"
|
481 |
+
|
482 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:111
|
483 |
+
msgid "Visibility Threshold"
|
484 |
+
msgstr "Visibility Threshold"
|
485 |
+
|
486 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:114
|
487 |
+
msgid "The slice relative part, below which a slice will not show individually. All slices that have not passed this threshold will be combined to a single slice, whose size is the sum of all their sizes. Default is not to show individually any slice which is smaller than half a degree."
|
488 |
+
msgstr "The slice relative part, below which a slice will not show individually. All slices that have not passed this threshold will be combined to a single slice, whose size is the sum of all their sizes. Default is not to show individually any slice which is smaller than half a degree."
|
489 |
+
|
490 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:119
|
491 |
+
msgid "Residue Slice Label"
|
492 |
+
msgstr "Residue Slice Label"
|
493 |
+
|
494 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:122
|
495 |
+
msgid "A label for the combination slice that holds all slices below slice visibility threshold."
|
496 |
+
msgstr "A label for the combination slice that holds all slices below slice visibility threshold."
|
497 |
+
|
498 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:123
|
499 |
+
msgid "Other"
|
500 |
+
msgstr "Other"
|
501 |
+
|
502 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:127
|
503 |
+
msgid "Residue Slice Color"
|
504 |
+
msgstr "Residue Slice Color"
|
505 |
+
|
506 |
+
#: classes/Visualizer/Render/Sidebar/Type/Pie.php:144
|
507 |
+
msgid "Slices Colors"
|
508 |
+
msgstr "Slices Colors"
|
509 |
+
|
510 |
+
#: classes/Visualizer/Render/Sidebar/Type/Candlestick.php:58
|
511 |
+
msgid "Candles Settings"
|
512 |
+
msgstr "Candles Settings"
|
513 |
+
|
514 |
+
#: classes/Visualizer/Render/Sidebar/Type/Candlestick.php:73
|
515 |
+
msgid "Failing Candles"
|
516 |
+
msgstr "Failing Candles"
|
517 |
+
|
518 |
+
#: classes/Visualizer/Render/Sidebar/Type/Candlestick.php:78
|
519 |
+
msgid "The stroke width of falling candles."
|
520 |
+
msgstr "The stroke width of falling candles."
|
521 |
+
|
522 |
+
#: classes/Visualizer/Render/Sidebar/Type/Candlestick.php:90
|
523 |
+
#: classes/Visualizer/Render/Sidebar/Type/Candlestick.php:114
|
524 |
+
msgid "Fill Color"
|
525 |
+
msgstr "Fill Color"
|
526 |
+
|
527 |
+
#: classes/Visualizer/Render/Sidebar/Type/Candlestick.php:97
|
528 |
+
msgid "Rising Candles"
|
529 |
+
msgstr "Rising Candles"
|
530 |
+
|
531 |
+
#: classes/Visualizer/Render/Sidebar/Type/Candlestick.php:102
|
532 |
+
msgid "The stroke width of rising candles."
|
533 |
+
msgstr "The stroke width of rising candles."
|
534 |
+
|
535 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:63
|
536 |
+
msgid "Min And Max Values"
|
537 |
+
msgstr "Min And Max Values"
|
538 |
+
|
539 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:77
|
540 |
+
msgid "The maximal and minimal values of the gauge."
|
541 |
+
msgstr "The maximal and minimal values of the gauge."
|
542 |
+
|
543 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:82
|
544 |
+
msgid "Minor Ticks"
|
545 |
+
msgstr "Minor Ticks"
|
546 |
+
|
547 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:85
|
548 |
+
msgid "The number of minor tick section in each major tick section."
|
549 |
+
msgstr "The number of minor tick section in each major tick section."
|
550 |
+
|
551 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:101
|
552 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:126
|
553 |
+
msgid "Green Color"
|
554 |
+
msgstr "Green Color"
|
555 |
+
|
556 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:103
|
557 |
+
msgid "Configure the green section of the gauge chart."
|
558 |
+
msgstr "Configure the green section of the gauge chart."
|
559 |
+
|
560 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:107
|
561 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:149
|
562 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:191
|
563 |
+
msgid "From And To Range"
|
564 |
+
msgstr "From And To Range"
|
565 |
+
|
566 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:121
|
567 |
+
msgid "The lowest and highest values for a range marked by a green color."
|
568 |
+
msgstr "The lowest and highest values for a range marked by a green color."
|
569 |
+
|
570 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:143
|
571 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:168
|
572 |
+
msgid "Yellow Color"
|
573 |
+
msgstr "Yellow Color"
|
574 |
+
|
575 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:145
|
576 |
+
msgid "Configure the yellow section of the gauge chart."
|
577 |
+
msgstr "Configure the yellow section of the gauge chart."
|
578 |
+
|
579 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:163
|
580 |
+
msgid "The lowest and highest values for a range marked by a yellow color."
|
581 |
+
msgstr "The lowest and highest values for a range marked by a yellow color."
|
582 |
+
|
583 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:185
|
584 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:210
|
585 |
+
msgid "Red Color"
|
586 |
+
msgstr "Red Color"
|
587 |
+
|
588 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:187
|
589 |
+
msgid "Configure the red section of the gauge chart."
|
590 |
+
msgstr "Configure the red section of the gauge chart."
|
591 |
+
|
592 |
+
#: classes/Visualizer/Render/Sidebar/Type/Gauge.php:205
|
593 |
+
msgid "The lowest and highest values for a range marked by a red color."
|
594 |
+
msgstr "The lowest and highest values for a range marked by a red color."
|
595 |
+
|
596 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:58
|
597 |
+
msgid "Map Settings"
|
598 |
+
msgstr "Map Settings"
|
599 |
+
|
600 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:59
|
601 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:71
|
602 |
+
msgid "Region"
|
603 |
+
msgstr "Region"
|
604 |
+
|
605 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:61
|
606 |
+
msgid "Configure the region area to display on the map. (Surrounding areas will be displayed as well.) Can be one of the following:"
|
607 |
+
msgstr "Configure the region area to display on the map. (Surrounding areas will be displayed as well.) Can be one of the following:"
|
608 |
+
|
609 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:63
|
610 |
+
msgid "'world' - A map of the entire world."
|
611 |
+
msgstr "'world' - A map of the entire world."
|
612 |
+
|
613 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:64
|
614 |
+
#, php-format
|
615 |
+
msgid "A continent or a sub-continent, specified by its %s code, e.g., '011' for Western Africa."
|
616 |
+
msgstr "A continent or a sub-continent, specified by its %s code, e.g., '011' for Western Africa."
|
617 |
+
|
618 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:65
|
619 |
+
#, php-format
|
620 |
+
msgid "A country, specified by its %s code, e.g., 'AU' for Australia."
|
621 |
+
msgstr "A country, specified by its %s code, e.g., 'AU' for Australia."
|
622 |
+
|
623 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:66
|
624 |
+
#, php-format
|
625 |
+
msgid "A state in the United States, specified by its %s code, e.g., 'US-AL' for Alabama. Note that the resolution option must be set to either 'provinces' or 'metros'."
|
626 |
+
msgstr "A state in the United States, specified by its %s code, e.g., 'US-AL' for Alabama. Note that the resolution option must be set to either 'provinces' or 'metros'."
|
627 |
+
|
628 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:79
|
629 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:91
|
630 |
+
msgid "Resolution"
|
631 |
+
msgstr "Resolution"
|
632 |
+
|
633 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:82
|
634 |
+
msgid "The resolution of the map borders. Choose one of the following values:"
|
635 |
+
msgstr "The resolution of the map borders. Choose one of the following values:"
|
636 |
+
|
637 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:84
|
638 |
+
msgid "'countries' - Supported for all regions, except for US state regions."
|
639 |
+
msgstr "'countries' - Supported for all regions, except for US state regions."
|
640 |
+
|
641 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:85
|
642 |
+
msgid "'provinces' - Supported only for country regions and US state regions. Not supported for all countries; please test a country to see whether this option is supported."
|
643 |
+
msgstr "'provinces' - Supported only for country regions and US state regions. Not supported for all countries; please test a country to see whether this option is supported."
|
644 |
+
|
645 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:86
|
646 |
+
msgid "'metros' - Supported for the US country region and US state regions only."
|
647 |
+
msgstr "'metros' - Supported for the US country region and US state regions only."
|
648 |
+
|
649 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:96
|
650 |
+
msgid "Countries"
|
651 |
+
msgstr "Countries"
|
652 |
+
|
653 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:97
|
654 |
+
msgid "Provinces"
|
655 |
+
msgstr "Provinces"
|
656 |
+
|
657 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:98
|
658 |
+
msgid "Metros"
|
659 |
+
msgstr "Metros"
|
660 |
+
|
661 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:104
|
662 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:116
|
663 |
+
msgid "Display Mode"
|
664 |
+
msgstr "Display Mode"
|
665 |
+
|
666 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:107
|
667 |
+
msgid "Determines which type of map this is. The following values are supported:"
|
668 |
+
msgstr "Determines which type of map this is. The following values are supported:"
|
669 |
+
|
670 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:109
|
671 |
+
msgid "'auto' - Choose based on the format of the data."
|
672 |
+
msgstr "'auto' - Choose based on the format of the data."
|
673 |
+
|
674 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:110
|
675 |
+
msgid "'regions' - This is a region map."
|
676 |
+
msgstr "'regions' - This is a region map."
|
677 |
+
|
678 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:111
|
679 |
+
msgid "'markers' - This is a marker map."
|
680 |
+
msgstr "'markers' - This is a marker map."
|
681 |
+
|
682 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:121
|
683 |
+
msgid "Auto"
|
684 |
+
msgstr "Auto"
|
685 |
+
|
686 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:122
|
687 |
+
msgid "Regions"
|
688 |
+
msgstr "Regions"
|
689 |
+
|
690 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:123
|
691 |
+
msgid "Markers"
|
692 |
+
msgstr "Markers"
|
693 |
+
|
694 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:139
|
695 |
+
msgid "Color Axis"
|
696 |
+
msgstr "Color Axis"
|
697 |
+
|
698 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:141
|
699 |
+
msgid "Configure color axis gradient scale, minimum and maximun values and a color of the dateless regions."
|
700 |
+
msgstr "Configure color axis gradient scale, minimum and maximun values and a color of the dateless regions."
|
701 |
+
|
702 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:145
|
703 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:209
|
704 |
+
msgid "Minimum And Maximum Values"
|
705 |
+
msgstr "Minimum And Maximum Values"
|
706 |
+
|
707 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:159
|
708 |
+
msgid "Determines the minimum and maximum values of color axis."
|
709 |
+
msgstr "Determines the minimum and maximum values of color axis."
|
710 |
+
|
711 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:164
|
712 |
+
msgid "Minimum Value"
|
713 |
+
msgstr "Minimum Value"
|
714 |
+
|
715 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:171
|
716 |
+
msgid "Intermediate Value"
|
717 |
+
msgstr "Intermediate Value"
|
718 |
+
|
719 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:178
|
720 |
+
msgid "Maximum Value"
|
721 |
+
msgstr "Maximum Value"
|
722 |
+
|
723 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:185
|
724 |
+
msgid "Dateless Region"
|
725 |
+
msgstr "Dateless Region"
|
726 |
+
|
727 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:203
|
728 |
+
msgid "Size Axis"
|
729 |
+
msgstr "Size Axis"
|
730 |
+
|
731 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:205
|
732 |
+
msgid "Configure how values are associated with bubble size, minimum and maximun values and marker opacity setting."
|
733 |
+
msgstr "Configure how values are associated with bubble size, minimum and maximun values and marker opacity setting."
|
734 |
+
|
735 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:223
|
736 |
+
msgid "Determines the minimum and maximum values of size axis."
|
737 |
+
msgstr "Determines the minimum and maximum values of size axis."
|
738 |
+
|
739 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:229
|
740 |
+
msgid "Minimum And Maximum Marker Radius"
|
741 |
+
msgstr "Minimum And Maximum Marker Radius"
|
742 |
+
|
743 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:243
|
744 |
+
msgid "Determines the radius of the smallest and largest possible bubbles, in pixels."
|
745 |
+
msgstr "Determines the radius of the smallest and largest possible bubbles, in pixels."
|
746 |
+
|
747 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:248
|
748 |
+
msgid "Marker Opacity"
|
749 |
+
msgstr "Marker Opacity"
|
750 |
+
|
751 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:251
|
752 |
+
msgid "The opacity of the markers, where 0.0 is fully transparent and 1.0 is fully opaque."
|
753 |
+
msgstr "The opacity of the markers, where 0.0 is fully transparent and 1.0 is fully opaque."
|
754 |
+
|
755 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:267
|
756 |
+
msgid "Magnifying Glass"
|
757 |
+
msgstr "Magnifying Glass"
|
758 |
+
|
759 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:269
|
760 |
+
msgid "Configure magnifying glass settings, which appears, when the user lingers over a cluttered marker. Note: this feature is not supported in browsers that do not support SVG, i.e. Internet Explorer version 8 or earlier."
|
761 |
+
msgstr "Configure magnifying glass settings, which appears, when the user lingers over a cluttered marker. Note: this feature is not supported in browsers that do not support SVG, i.e. Internet Explorer version 8 or earlier."
|
762 |
+
|
763 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:272
|
764 |
+
msgid "Enabled"
|
765 |
+
msgstr "Enabled"
|
766 |
+
|
767 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:276
|
768 |
+
msgid "If yes, when the user lingers over a cluttered marker, a magnifiying glass will be opened."
|
769 |
+
msgstr "If yes, when the user lingers over a cluttered marker, a magnifiying glass will be opened."
|
770 |
+
|
771 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:280
|
772 |
+
msgid "Zoom Factor"
|
773 |
+
msgstr "Zoom Factor"
|
774 |
+
|
775 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:283
|
776 |
+
msgid "The zoom factor of the magnifying glass. Can be any number greater than 0."
|
777 |
+
msgstr "The zoom factor of the magnifying glass. Can be any number greater than 0."
|
778 |
+
|
779 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:298
|
780 |
+
msgid "Layout Settings"
|
781 |
+
msgstr "Layout Settings"
|
782 |
+
|
783 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:323
|
784 |
+
msgid "Keep Aspect Ratio"
|
785 |
+
msgstr "Keep Aspect Ratio"
|
786 |
+
|
787 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:327
|
788 |
+
msgid "If yes, the map will be drawn at the largest size that can fit inside the chart area at its natural aspect ratio. If only one of the width and height options is specified, the other one will be calculated according to the aspect ratio."
|
789 |
+
msgstr "If yes, the map will be drawn at the largest size that can fit inside the chart area at its natural aspect ratio. If only one of the width and height options is specified, the other one will be calculated according to the aspect ratio."
|
790 |
+
|
791 |
+
#: classes/Visualizer/Render/Sidebar/Type/Geo.php:328
|
792 |
+
msgid "If no, the map will be stretched to the exact size of the chart as specified by the width and height options."
|
793 |
+
msgstr "If no, the map will be stretched to the exact size of the chart as specified by the width and height options."
|
794 |
+
|
795 |
+
#: classes/Visualizer/Module/Admin.php:78
|
796 |
+
msgid "All"
|
797 |
+
msgstr "All"
|
798 |
+
|
799 |
+
#: classes/Visualizer/Module/Admin.php:79
|
800 |
+
msgid "Pie"
|
801 |
+
msgstr "Pie"
|
802 |
+
|
803 |
+
#: classes/Visualizer/Module/Admin.php:80
|
804 |
+
msgid "Line"
|
805 |
+
msgstr "Line"
|
806 |
+
|
807 |
+
#: classes/Visualizer/Module/Admin.php:81
|
808 |
+
msgid "Area"
|
809 |
+
msgstr "Area"
|
810 |
+
|
811 |
+
#: classes/Visualizer/Module/Admin.php:82
|
812 |
+
msgid "Geo"
|
813 |
+
msgstr "Geo"
|
814 |
+
|
815 |
+
#: classes/Visualizer/Module/Admin.php:83
|
816 |
+
msgid "Bar"
|
817 |
+
msgstr "Bar"
|
818 |
+
|
819 |
+
#: classes/Visualizer/Module/Admin.php:84
|
820 |
+
msgid "Column"
|
821 |
+
msgstr "Column"
|
822 |
+
|
823 |
+
#: classes/Visualizer/Module/Admin.php:85
|
824 |
+
msgid "Gauge"
|
825 |
+
msgstr "Gauge"
|
826 |
+
|
827 |
+
#: classes/Visualizer/Module/Admin.php:86
|
828 |
+
msgid "Scatter"
|
829 |
+
msgstr "Scatter"
|
830 |
+
|
831 |
+
#: classes/Visualizer/Module/Admin.php:87
|
832 |
+
msgid "Candelstick"
|
833 |
+
msgstr "Candelstick"
|
834 |
+
|
835 |
+
#: classes/Visualizer/Module/Admin.php:128
|
836 |
+
msgid "Visualizations"
|
837 |
+
msgstr "Visualizations"
|
838 |
+
|
839 |
+
#: classes/Visualizer/Module/Admin.php:131
|
840 |
+
msgid "From Library"
|
841 |
+
msgstr "From Library"
|
842 |
+
|
843 |
+
#: classes/Visualizer/Module/Admin.php:132
|
844 |
+
msgid "Create New"
|
845 |
+
msgstr "Create New"
|
846 |
+
|
847 |
+
#: classes/Visualizer/Module/Admin.php:316
|
848 |
+
msgid "Library"
|
849 |
+
msgstr "Library"
|
850 |
+
|
851 |
+
#: classes/Visualizer/Module/Admin.php:338
|
852 |
+
msgid "Knowledge Base"
|
853 |
+
msgstr "Knowledge Base"
|
854 |
+
|
855 |
+
#: classes/Visualizer/Module/Admin.php:343
|
856 |
+
msgid "Community"
|
857 |
+
msgstr "Community"
|
858 |
+
|
859 |
+
#: classes/Visualizer/Module/Chart.php:369
|
860 |
+
msgid "Save Chart"
|
861 |
+
msgstr "Save Chart"
|
862 |
+
|
863 |
+
#: classes/Visualizer/Module/Chart.php:370
|
864 |
+
msgid "Create Chart"
|
865 |
+
msgstr "Create Chart"
|
866 |
+
|
867 |
+
#: classes/Visualizer/Module/Chart.php:372
|
868 |
+
msgid "Insert Chart"
|
869 |
+
msgstr "Insert Chart"
|
870 |
+
|
871 |
+
#: classes/Visualizer/Module/Chart.php:401
|
872 |
+
msgid "CSV file with chart data was not uploaded. Please, try again."
|
873 |
+
msgstr "CSV file with chart data was not uploaded. Please, try again."
|
874 |
+
|
875 |
+
#: classes/Visualizer/Module/Chart.php:415
|
876 |
+
msgid "CSV file is broken or incorrect. Please, try again."
|
877 |
+
msgstr "CSV file is broken or incorrect. Please, try again."
|
878 |
+
|
readme.txt
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Visualizer ===
|
2 |
+
Contributors: madpixels, straightforward
|
3 |
+
Donate link:
|
4 |
+
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
|
5 |
+
Requires at least: 3.5
|
6 |
+
Tested up to: 3.5.2
|
7 |
+
Stable tag: 1.0.0
|
8 |
+
License: GPL v2.0 or later
|
9 |
+
License URI: http://www.opensource.org/licenses/gpl-license.php
|
10 |
+
|
11 |
+
A simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
WordPress Visualizer plugin is a simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages.
|
16 |
+
|
17 |
+
The plugin uses Google Visualization API to render charts, which support cross-browser compatibility (adopting VML for older IE versions) and cross-platform portability to iOS and new Android releases.
|
18 |
+
|
19 |
+
### 9 Chart types ###
|
20 |
+
The plugin provides a variety of charts that are optimized to address your data visualization needs. It is line chart, area chart, bar chart, column chart, pie chart, geo chart, gauge chart, candlestick chart and scatter chart. These charts are based on pure HTML5/SVG technology (adopting VML for old IE versions), so no extra plugins are required. Adding these charts to your page can be done in a few simple steps.
|
21 |
+
|
22 |
+
### Flexible and customizable ###
|
23 |
+
Make the charts your own. Configure an extensive set of options to perfectly match the look and feel of your website. You can use Google Chart Tools with their default setting - all customization is optional and the basic setup is launch-ready. However, charts can be easily customizable in case your webpage adopts a style which is at odds with provided defaults. Every chart exposes a number of options that customize its look and feel.
|
24 |
+
|
25 |
+
### HTML5/SVG ###
|
26 |
+
Charts are rendered using HTML5/SVG technology to provide cross-browser compatibility (including VML for older IE versions) and cross platform portability to iPhones, iPads and Android. Your users will never have to mess with extra plugins or any software. If they have a web browser, they can see your charts.
|
27 |
+
|
28 |
+
*above descriptions were partially taken from Google Visualization API site*
|
29 |
+
|
30 |
+
== Installation ==
|
31 |
+
|
32 |
+
1. Upload the files to the `/wp-content/plugins/visualizer/` directory.
|
33 |
+
1. Activate the plugin through the 'Plugins' menu in WordPress.
|
34 |
+
|
35 |
+
== Screenshots ==
|
36 |
+
|
37 |
+
1. Chart type selection
|
38 |
+
2. Chart data uploading
|
39 |
+
3. Chart options editing
|
40 |
+
4. Charts media library
|
41 |
+
5. Charts library
|
42 |
+
|
43 |
+
== Changelog ==
|
44 |
+
|
45 |
+
= 1.0.0 =
|
46 |
+
* The first version of the plugin was implemented.
|
47 |
+
|
48 |
+
== Usage ==
|
49 |
+
|
50 |
+
The plugin is very simple in use. To create a chart you just need to complete three steps wizard, which walks you through chart type selection, data uploading and settings configuration screens.
|
51 |
+
|
52 |
+
= Create Chart =
|
53 |
+
|
54 |
+
1. Create or edit existing post/page;
|
55 |
+
1. Click on "Add Media" button above post/page content editor;
|
56 |
+
1. Go to "Visualizations" menu item at left sidebar;
|
57 |
+
1. Click on "Create New" at the top of popup, below "Visualization" title;
|
58 |
+
1. Chart type selection sheet appears. Select a chart type and click on "Next" button at the right bottom corner;
|
59 |
+
1. Data uploading screen appears. Expand "Upload CSV file" section at right sidebar. Upload your CSV file. You can find a link on a sample in the text above "Upload CSV file" button;
|
60 |
+
1. After you've uploaded your csv file, click on "Next" button and go to settings screen;
|
61 |
+
1. At this screen you can configure appropriate settings and change a look of your chart;
|
62 |
+
1. When you have finished, click on "Insert Chart" button and save your post/page. That's all, your chart will appear at front end.
|
samples/area.csv
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Month,Bolivia,Ecuador,Madagascar,Papua New Guinea,Rwanda
|
2 |
+
date,number,number,number,number,number
|
3 |
+
2004/05,165,938,522,998,450
|
4 |
+
2005/06,135,1120,599,1268,288
|
5 |
+
2006/07,157,1167,587,807,397
|
6 |
+
2007/08,139,1110,615,968,215
|
7 |
+
2008/09,136,691,629,1026,366
|
samples/bar.csv
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Year,Austria,Bulgaria,Denmark,Greece
|
2 |
+
string,number,number,number,number
|
3 |
+
2003,1336060,400361,1001582,997974
|
4 |
+
2004,1538156,366849,1119450,941795
|
5 |
+
2005,1576579,440514,993360,930593
|
6 |
+
2006,1600652,434552,1004163,897127
|
7 |
+
2007,1968113,393032,979198,1080887
|
8 |
+
2008,1901067,517206,916965,1056036
|
samples/candlestick.csv
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Date,GBP/USD,,,
|
2 |
+
date,number,number,number,number
|
3 |
+
2013-07-10,20,28,38,45
|
4 |
+
2013-07-11,31,38,55,66
|
5 |
+
2013-07-12,50,55,77,80
|
6 |
+
2013-07-13,50,77,66,77
|
7 |
+
2013-07-14,15,66,22,68
|
samples/column.csv
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
City,Population in 2012,Population in 2011,Population in 2010
|
2 |
+
string,number,number,number
|
3 |
+
Milan,1324110,907563,607906
|
4 |
+
Naples,959574,1324110,1137128
|
5 |
+
Turin,907563,959574,1080181
|
6 |
+
Palermo,655875,371282,907563
|
7 |
+
Genoa,607906,580181,707563
|
8 |
+
Bologna,380181,655875,480181
|
9 |
+
Florence,371282,607906,655875
|
samples/gauge.csv
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
System,Loading
|
2 |
+
string,number
|
3 |
+
Memory,80
|
4 |
+
CPU,55
|
5 |
+
Network,68
|
samples/geo.csv
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Country,Popularity
|
2 |
+
string,number
|
3 |
+
Germany,200
|
4 |
+
United States,300
|
5 |
+
Brazil,400
|
6 |
+
Canada,500
|
7 |
+
France,600
|
8 |
+
RU,700
|
samples/line.csv
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
x,Cats,Blanket1,Blanket2
|
2 |
+
string,number,number,number
|
3 |
+
A,1,1,0.5
|
4 |
+
B,2,0.5,1
|
5 |
+
C,4,1,0.5
|
6 |
+
D,8,0.5,1
|
7 |
+
E,7,1,0.5
|
8 |
+
F,7,0.5,1
|
9 |
+
G,8,1,0.5
|
10 |
+
H,4,0.5,1
|
11 |
+
I,2,1,0.5
|
12 |
+
J,3.5,0.5,1
|
13 |
+
K,3,1,0.5
|
14 |
+
L,3.5,0.5,1
|
15 |
+
M,1,1,0.5
|
16 |
+
N,1,0.5,1
|
samples/pie.csv
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Task,Hours per Day
|
2 |
+
string,number
|
3 |
+
Work,11
|
4 |
+
Eat,2
|
5 |
+
Commute,2
|
6 |
+
Watch TV,2
|
7 |
+
Sleep,7
|
samples/scatter.csv
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Dispersion,Male,Female
|
2 |
+
number,number,number
|
3 |
+
10,75,54
|
4 |
+
20,,64
|
5 |
+
33,22,23
|
6 |
+
55,16,
|
7 |
+
14,61,
|
8 |
+
48,3,52
|