PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 1.6.6
Visualizer – Tables & Charts Manager with Built-in AI Generator v1.6.6
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 3.10.4 All 148 releases
visualizer / classes / Visualizer / Render / Sidebar / Linear.php

Linear.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 1.6.6, at classes/Visualizer/Render/Sidebar/Linear.php

296 lines 10.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 general settings block for horizontal axis settings.
89 *
90 * @since 1.4.0
91 *
92 * @access protected
93 */
94 protected function _renderHorizontalAxisGeneralSettings() {
95 parent::_renderHorizontalAxisGeneralSettings();
96
97 self::_renderColorPickerItem(
98 esc_html__( 'Axis Text Color', Visualizer_Plugin::NAME ),
99 'vAxis[textStyle]',
100 isset( $this->vAxis['textStyle'] ) ? $this->vAxis['textStyle'] : null,
101 '#000'
102 );
103
104 $this->_renderHorizontalAxisFormatField();
105 }
106
107 /**
108 * Renders general settings block for vertical axis settings.
109 *
110 * @since 1.4.0
111 *
112 * @access protected
113 */
114 protected function _renderVerticalAxisGeneralSettings() {
115 parent::_renderVerticalAxisGeneralSettings();
116
117 self::_renderColorPickerItem(
118 esc_html__( 'Axis Text Color', Visualizer_Plugin::NAME ),
119 'hAxis[textStyle]',
120 isset( $this->hAxis['textStyle'] ) ? $this->hAxis['textStyle'] : null,
121 '#000'
122 );
123
124 $this->_renderVerticalAxisFormatField();
125 }
126
127 /**
128 * Renders line settings items.
129 *
130 * @since 1.0.0
131 *
132 * @access protected
133 */
134 protected function _renderLineSettingsItems() {
135 echo '<div class="section-item">';
136 echo '<a class="more-info" href="javascript:;">[?]</a>';
137 echo '<b>', esc_html__( 'Line Width And Point Size', Visualizer_Plugin::NAME ), '</b>';
138
139 echo '<table class="section-table" cellspacing="0" cellpadding="0" border="0">';
140 echo '<tr>';
141 echo '<td class="section-table-column">';
142 echo '<input type="text" name="lineWidth" class="control-text" value="', esc_attr( $this->lineWidth ), '" placeholder="2">';
143 echo '</td>';
144 echo '<td class="section-table-column">';
145 echo '<input type="text" name="pointSize" class="control-text" value="', esc_attr( $this->pointSize ), '" placeholder="0">';
146 echo '</td>';
147 echo '</tr>';
148 echo '</table>';
149
150 echo '<p class="section-description">';
151 esc_html_e( 'Data line width and diameter of displayed points in pixels. Use zero to hide all lines or points.', Visualizer_Plugin::NAME );
152 echo '</p>';
153 echo '</div>';
154
155 if ( $this->_includeCurveTypes ) {
156 self::_renderSelectItem(
157 esc_html__( 'Curve Type', Visualizer_Plugin::NAME ),
158 'curveType',
159 $this->curveType,
160 $this->_curveTypes,
161 esc_html__( 'Determines whether the series has to be presented in the legend or not.', Visualizer_Plugin::NAME )
162 );
163 }
164
165 echo '<div class="section-delimiter"></div>';
166
167 if ( $this->_includeFocusTarget ) {
168 self::_renderSelectItem(
169 esc_html__( 'Focus Target', Visualizer_Plugin::NAME ),
170 'focusTarget',
171 $this->focusTarget,
172 array(
173 '' => '',
174 'datum' => esc_html__( 'Focus on a single data point.', Visualizer_Plugin::NAME ),
175 'category' => esc_html__( 'Focus on a grouping of all data points along the major axis.', Visualizer_Plugin::NAME ),
176 ),
177 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 )
178 );
179 }
180
181 self::_renderSelectItem(
182 esc_html__( 'Selection Mode', Visualizer_Plugin::NAME ),
183 'selectionMode',
184 $this->selectionMode,
185 array(
186 '' => '',
187 'single' => esc_html__( 'Single data point', Visualizer_Plugin::NAME ),
188 'multiple' => esc_html__( 'Multiple data points', Visualizer_Plugin::NAME ),
189 ),
190 esc_html__( 'Determines how many data points an user can select on a chart.', Visualizer_Plugin::NAME )
191 );
192
193 self::_renderSelectItem(
194 esc_html__( 'Aggregation Target', Visualizer_Plugin::NAME ),
195 'aggregationTarget',
196 $this->aggregationTarget,
197 array(
198 '' => '',
199 'category' => esc_html__( 'Group selected data by x-value', Visualizer_Plugin::NAME ),
200 'series' => esc_html__( 'Group selected data by series', Visualizer_Plugin::NAME ),
201 'auto' => esc_html__( 'Group selected data by x-value if all selections have the same x-value, and by series otherwise', Visualizer_Plugin::NAME ),
202 'none' => esc_html__( 'Show only one tooltip per selection', Visualizer_Plugin::NAME ),
203 ),
204 esc_html__( 'Determines how multiple data selections are rolled up into tooltips. To make it working you need to set multiple selection mode and tooltip trigger to display it when an user selects an element.', Visualizer_Plugin::NAME )
205 );
206
207 echo '<div class="section-delimiter"></div>';
208
209 self::_renderTextItem(
210 esc_html__( 'Point Opacity', Visualizer_Plugin::NAME ),
211 'dataOpacity',
212 $this->dataOpacity,
213 esc_html__( 'The transparency of data points, with 1.0 being completely opaque and 0.0 fully transparent.', Visualizer_Plugin::NAME ),
214 '1.0'
215 );
216 }
217
218 /**
219 * Renders lines settings.
220 *
221 * @since 1.0.0
222 *
223 * @access protected
224 */
225 protected function _renderLineSettings() {
226 self::_renderGroupStart( esc_html__( 'Lines Settings', Visualizer_Plugin::NAME ) );
227 self::_renderSectionStart();
228 $this->_renderLineSettingsItems();
229 self::_renderSectionEnd();
230 self::_renderGroupEnd();
231 }
232
233 /**
234 * Renders concreate series settings.
235 *
236 * @since 1.0.0
237 *
238 * @access protected
239 * @param int $index The series index.
240 */
241 protected function _renderSeries( $index ) {
242 self::_renderSelectItem(
243 esc_html__( 'Visible In Legend', Visualizer_Plugin::NAME ),
244 'series[' . $index . '][visibleInLegend]',
245 isset( $this->series[$index]['visibleInLegend'] ) ? $this->series[$index]['visibleInLegend'] : '',
246 array(
247 '' => '',
248 '0' => esc_html__( 'No', Visualizer_Plugin::NAME ),
249 '1' => esc_html__( 'Yes', Visualizer_Plugin::NAME ),
250 ),
251 esc_html__( 'Determines whether the series has to be presented in the legend or not.', Visualizer_Plugin::NAME )
252 );
253
254 echo '<div class="section-item">';
255 echo '<a class="more-info" href="javascript:;">[?]</a>';
256 echo '<b>', esc_html__( 'Line Width And Point Size', Visualizer_Plugin::NAME ), '</b>';
257
258 echo '<table class="section-table" cellspacing="0" cellpadding="0" border="0">';
259 echo '<tr>';
260 echo '<td class="section-table-column">';
261 $line_width = isset( $this->series[$index]['lineWidth'] ) ? $this->series[$index]['lineWidth'] : '';
262 echo '<input type="text" name="series[', $index, '][lineWidth]" class="control-text" value="', esc_attr( $line_width ), '" placeholder="2">';
263 echo '</td>';
264 echo '<td class="section-table-column">';
265 $point_size = isset( $this->series[$index]['pointSize'] ) ? $this->series[$index]['pointSize'] : '';
266 echo '<input type="text" name="series[', $index, '][pointSize]" class="control-text" value="', esc_attr( $point_size ), '" placeholder="0">';
267 echo '</td>';
268 echo '</tr>';
269 echo '</table>';
270
271 echo '<p class="section-description">';
272 esc_html_e( 'Overrides the global line width and point size values for this series.', Visualizer_Plugin::NAME );
273 echo '</p>';
274 echo '</div>';
275
276 $this->_renderFormatField( $index );
277
278 if ( $this->_includeCurveTypes ) {
279 self::_renderSelectItem(
280 esc_html__( 'Curve Type', Visualizer_Plugin::NAME ),
281 'series[' . $index . '][curveType]',
282 isset( $this->series[$index]['curveType'] ) ? $this->series[$index]['curveType'] : '',
283 $this->_curveTypes,
284 esc_html__( 'Determines whether the series has to be presented in the legend or not.', Visualizer_Plugin::NAME )
285 );
286 }
287
288 self::_renderColorPickerItem(
289 esc_html__( 'Color', Visualizer_Plugin::NAME ),
290 'series[' . $index . '][color]',
291 isset( $this->series[$index]['color'] ) ? $this->series[$index]['color'] : null,
292 null
293 );
294 }
295
296 }