PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 1.4.1
Visualizer – Tables & Charts Manager with Built-in AI Generator v1.4.1
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.4.1, at classes/Visualizer/Render/Sidebar/Linear.php

313 lines 11.3 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 _renderHorizontalAxisGeneratSettings() {
95 parent::_renderHorizontalAxisGeneratSettings();
96
97 self::_renderTextItem(
98 esc_html__( 'Number Format', Visualizer_Plugin::NAME ),
99 'hAxis[format]',
100 isset( $this->hAxis['format'] ) ? $this->hAxis['format'] : '',
101 sprintf(
102 '%s<br><br>%s<br><br>%s',
103 esc_html__( 'Enter custom format pattern to apply to horizontal axis labels.', Visualizer_Plugin::NAME ),
104 sprintf(
105 esc_html__( 'For number axis labels, this is a subset of the decimal formatting %sICU pattern set%s. For instance, $#,###.## will display values $1,234.56 for value 1234.56. Pay attention that if you use #%% percentage format then your values will be multiplied by 100.', Visualizer_Plugin::NAME ),
106 '<a href="http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details" target="_blank">',
107 '</a>'
108 ),
109 sprintf(
110 esc_html__( 'For date axis labels, this is a subset of the date formatting %sICU date and time format%s.', Visualizer_Plugin::NAME ),
111 '<a href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax" target="_blank">',
112 '</a>'
113 )
114 )
115 );
116 }
117
118 /**
119 * Renders general settings block for vertical axis settings.
120 *
121 * @since 1.4.0
122 *
123 * @access protected
124 */
125 protected function _renderVerticalAxisGeneralSettings() {
126 parent::_renderVerticalAxisGeneralSettings();
127
128 self::_renderTextItem(
129 esc_html__( 'Number Format', Visualizer_Plugin::NAME ),
130 'vAxis[format]',
131 isset( $this->vAxis['format'] ) ? $this->vAxis['format'] : '',
132 sprintf(
133 '%s<br><br>%s',
134 esc_html__( 'Enter custom format pattern to apply to vertical axis labels.', Visualizer_Plugin::NAME ),
135 sprintf(
136 esc_html__( 'For number axis labels, this is a subset of the decimal formatting %sICU pattern set%s. For instance, $#,###.## will display values $1,234.56 for value 1234.56. Pay attention that if you use #%% percentage format then your values will be multiplied by 100.', Visualizer_Plugin::NAME ),
137 '<a href="http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details" target="_blank">',
138 '</a>'
139 )
140 )
141 );
142 }
143
144 /**
145 * Renders line settings items.
146 *
147 * @since 1.0.0
148 *
149 * @access protected
150 */
151 protected function _renderLineSettingsItems() {
152 echo '<div class="section-item">';
153 echo '<a class="more-info" href="javascript:;">[?]</a>';
154 echo '<b>', esc_html__( 'Line Width And Point 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 '<input type="text" name="lineWidth" class="control-text" value="', esc_attr( $this->lineWidth ), '" placeholder="2">';
160 echo '</td>';
161 echo '<td class="section-table-column">';
162 echo '<input type="text" name="pointSize" class="control-text" value="', esc_attr( $this->pointSize ), '" placeholder="0">';
163 echo '</td>';
164 echo '</tr>';
165 echo '</table>';
166
167 echo '<p class="section-description">';
168 esc_html_e( 'Data line width and diameter of displayed points in pixels. Use zero to hide all lines or points.', Visualizer_Plugin::NAME );
169 echo '</p>';
170 echo '</div>';
171
172 if ( $this->_includeCurveTypes ) {
173 self::_renderSelectItem(
174 esc_html__( 'Curve Type', Visualizer_Plugin::NAME ),
175 'curveType',
176 $this->curveType,
177 $this->_curveTypes,
178 esc_html__( 'Determines whether the series has to be presented in the legend or not.', Visualizer_Plugin::NAME )
179 );
180 }
181
182 echo '<div class="section-delimiter"></div>';
183
184 if ( $this->_includeFocusTarget ) {
185 self::_renderSelectItem(
186 esc_html__( 'Focus Target', Visualizer_Plugin::NAME ),
187 'focusTarget',
188 $this->focusTarget,
189 array(
190 '' => '',
191 'datum' => esc_html__( 'Focus on a single data point.', Visualizer_Plugin::NAME ),
192 'category' => esc_html__( 'Focus on a grouping of all data points along the major axis.', Visualizer_Plugin::NAME ),
193 ),
194 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 )
195 );
196 }
197
198 self::_renderSelectItem(
199 esc_html__( 'Selection Mode', Visualizer_Plugin::NAME ),
200 'selectionMode',
201 $this->selectionMode,
202 array(
203 '' => '',
204 'single' => esc_html__( 'Single data point', Visualizer_Plugin::NAME ),
205 'multiple' => esc_html__( 'Multiple data points', Visualizer_Plugin::NAME ),
206 ),
207 esc_html__( 'Determines how many data points an user can select on a chart.', Visualizer_Plugin::NAME )
208 );
209
210 self::_renderSelectItem(
211 esc_html__( 'Aggregation Target', Visualizer_Plugin::NAME ),
212 'aggregationTarget',
213 $this->aggregationTarget,
214 array(
215 '' => '',
216 'category' => esc_html__( 'Group selected data by x-value', Visualizer_Plugin::NAME ),
217 'series' => esc_html__( 'Group selected data by series', Visualizer_Plugin::NAME ),
218 'auto' => esc_html__( 'Group selected data by x-value if all selections have the same x-value, and by series otherwise', Visualizer_Plugin::NAME ),
219 'none' => esc_html__( 'Show only one tooltip per selection', Visualizer_Plugin::NAME ),
220 ),
221 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 )
222 );
223
224 echo '<div class="section-delimiter"></div>';
225
226 self::_renderTextItem(
227 esc_html__( 'Point Opacity', Visualizer_Plugin::NAME ),
228 'dataOpacity',
229 $this->dataOpacity,
230 esc_html__( 'The transparency of data points, with 1.0 being completely opaque and 0.0 fully transparent.', Visualizer_Plugin::NAME ),
231 '1.0'
232 );
233 }
234
235 /**
236 * Renders lines settings.
237 *
238 * @since 1.0.0
239 *
240 * @access protected
241 */
242 protected function _renderLineSettings() {
243 self::_renderGroupStart( esc_html__( 'Lines Settings', Visualizer_Plugin::NAME ) );
244 self::_renderSectionStart();
245 $this->_renderLineSettingsItems();
246 self::_renderSectionEnd();
247 self::_renderGroupEnd();
248 }
249
250 /**
251 * Renders concreate series settings.
252 *
253 * @since 1.0.0
254 *
255 * @access protected
256 * @param int $index The series index.
257 */
258 protected function _renderSeries( $index ) {
259 self::_renderSelectItem(
260 esc_html__( 'Visible In Legend', Visualizer_Plugin::NAME ),
261 'series[' . $index . '][visibleInLegend]',
262 isset( $this->series[$index]['visibleInLegend'] ) ? $this->series[$index]['visibleInLegend'] : '',
263 array(
264 '' => '',
265 '0' => esc_html__( 'No', Visualizer_Plugin::NAME ),
266 '1' => esc_html__( 'Yes', Visualizer_Plugin::NAME ),
267 ),
268 esc_html__( 'Determines whether the series has to be presented in the legend or not.', Visualizer_Plugin::NAME )
269 );
270
271 echo '<div class="section-item">';
272 echo '<a class="more-info" href="javascript:;">[?]</a>';
273 echo '<b>', esc_html__( 'Line Width And Point Size', Visualizer_Plugin::NAME ), '</b>';
274
275 echo '<table class="section-table" cellspacing="0" cellpadding="0" border="0">';
276 echo '<tr>';
277 echo '<td class="section-table-column">';
278 $line_width = isset( $this->series[$index]['lineWidth'] ) ? $this->series[$index]['lineWidth'] : '';
279 echo '<input type="text" name="series[', $index, '][lineWidth]" class="control-text" value="', esc_attr( $line_width ), '" placeholder="2">';
280 echo '</td>';
281 echo '<td class="section-table-column">';
282 $point_size = isset( $this->series[$index]['pointSize'] ) ? $this->series[$index]['pointSize'] : '';
283 echo '<input type="text" name="series[', $index, '][pointSize]" class="control-text" value="', esc_attr( $point_size ), '" placeholder="0">';
284 echo '</td>';
285 echo '</tr>';
286 echo '</table>';
287
288 echo '<p class="section-description">';
289 esc_html_e( 'Overrides the global line width and point size values for this series.', Visualizer_Plugin::NAME );
290 echo '</p>';
291 echo '</div>';
292
293 $this->_renderFormatField( $index );
294
295 if ( $this->_includeCurveTypes ) {
296 self::_renderSelectItem(
297 esc_html__( 'Curve Type', Visualizer_Plugin::NAME ),
298 'series[' . $index . '][curveType]',
299 isset( $this->series[$index]['curveType'] ) ? $this->series[$index]['curveType'] : '',
300 $this->_curveTypes,
301 esc_html__( 'Determines whether the series has to be presented in the legend or not.', Visualizer_Plugin::NAME )
302 );
303 }
304
305 self::_renderColorPickerItem(
306 esc_html__( 'Color', Visualizer_Plugin::NAME ),
307 'series[' . $index . '][color]',
308 isset( $this->series[$index]['color'] ) ? $this->series[$index]['color'] : null,
309 null
310 );
311 }
312
313 }