| @@ -18,8 +18,10 @@ | ||
| 18 | 18 | // | MA 02110-1301 USA | |
| 19 | 19 | // +----------------------------------------------------------------------+ |
| 20 | 20 | // | Author: Eugene Manuilov <eugene@manuilov.org> | |
| 21 | 21 | // +----------------------------------------------------------------------+ |
| 22 | + | |
| 23 | + | |
| 22 | 24 | /** |
| 23 | 25 | * Base class for sidebar settings of linear based charts. |
| 24 | 26 | * |
| 25 | 27 | * @category Visualizer |
| @@ -76,54 +78,14 @@ | ||
| 76 | 78 | $this->_includeFocusTarget = true; |
| 77 | 79 | |
| 78 | 80 | $this->_curveTypes = array( |
| 79 | 81 | '' => '', |
| 80 | - 'none' => esc_html__( 'Straight line without curve', 'visualizer' ), | |
| 81 | - 'function' => esc_html__( 'The angles of the line will be smoothed', 'visualizer' ), | |
| 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 ), | |
| 82 | 84 | ); |
| 83 | 85 | } |
| 84 | 86 | |
| 85 | 87 | /** |
| 86 | - * Renders general settings block for horizontal axis settings. | |
| 87 | - * | |
| 88 | - * @since 1.4.0 | |
| 89 | - * | |
| 90 | - * @access protected | |
| 91 | - */ | |
| 92 | - protected function _renderHorizontalAxisGeneralSettings() { | |
| 93 | - parent::_renderHorizontalAxisGeneralSettings(); | |
| 94 | - | |
| 95 | - self::_renderColorPickerItem( | |
| 96 | - esc_html__( 'Axis Text Color', 'visualizer' ), | |
| 97 | - 'hAxis[textStyle]', | |
| 98 | - isset( $this->hAxis['textStyle'] ) ? $this->hAxis['textStyle'] : null, | |
| 99 | - '#000' | |
| 100 | - ); | |
| 101 | - | |
| 102 | - $this->_renderHorizontalAxisFormatField(); | |
| 103 | - } | |
| 104 | - | |
| 105 | - /** | |
| 106 | - * Renders general settings block for vertical axis settings. | |
| 107 | - * | |
| 108 | - * @since 1.4.0 | |
| 109 | - * | |
| 110 | - * @access protected | |
| 111 | - */ | |
| 112 | - protected function _renderVerticalAxisGeneralSettings() { | |
| 113 | - parent::_renderVerticalAxisGeneralSettings(); | |
| 114 | - | |
| 115 | - self::_renderColorPickerItem( | |
| 116 | - esc_html__( 'Axis Text Color', 'visualizer' ), | |
| 117 | - 'vAxis[textStyle]', | |
| 118 | - isset( $this->vAxis['textStyle'] ) ? $this->vAxis['textStyle'] : null, | |
| 119 | - '#000' | |
| 120 | - ); | |
| 121 | - | |
| 122 | - $this->_renderVerticalAxisFormatField(); | |
| 123 | - } | |
| 124 | - | |
| 125 | - /** | |
| 126 | 88 | * Renders line settings items. |
| 127 | 89 | * |
| 128 | 90 | * @since 1.0.0 |
| 129 | 91 | * |
| @@ -129,89 +91,47 @@ | ||
| 129 | 91 | * |
| 130 | 92 | * @access protected |
| 131 | 93 | */ |
| 132 | 94 | protected function _renderLineSettingsItems() { |
| 133 | - echo '<div class="viz-section-item">'; | |
| 134 | - echo '<a class="more-info" href="javascript:;">[?]</a>'; | |
| 135 | - echo '<b>', esc_html__( 'Line Width And Point Size', 'visualizer' ), '</b>'; | |
| 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 | + ); | |
| 136 | 102 | |
| 137 | - echo '<table class="viz-section-table" cellspacing="0" cellpadding="0" border="0">'; | |
| 138 | - echo '<tr>'; | |
| 139 | - echo '<td class="viz-section-table-column">'; | |
| 140 | - echo '<input type="text" name="lineWidth" class="control-text" value="', esc_attr( $this->lineWidth ), '" placeholder="2">'; | |
| 141 | - echo '</td>'; | |
| 142 | - echo '<td class="viz-section-table-column">'; | |
| 143 | - echo '<input type="text" name="pointSize" class="control-text" value="', esc_attr( $this->pointSize ), '" placeholder="0">'; | |
| 144 | - echo '</td>'; | |
| 145 | - echo '</tr>'; | |
| 146 | - echo '</table>'; | |
| 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 | + ); | |
| 147 | 110 | |
| 148 | - echo '<p class="viz-section-description">'; | |
| 149 | - esc_html_e( 'Data line width and diameter of displayed points in pixels. Use zero to hide all lines or points.', 'visualizer' ); | |
| 150 | - echo '</p>'; | |
| 151 | - echo '</div>'; | |
| 152 | - | |
| 153 | 111 | if ( $this->_includeCurveTypes ) { |
| 154 | 112 | self::_renderSelectItem( |
| 155 | - esc_html__( 'Curve Type', 'visualizer' ), | |
| 113 | + esc_html__( 'Curve Type', Visualizer_Plugin::NAME ), | |
| 156 | 114 | 'curveType', |
| 157 | 115 | $this->curveType, |
| 158 | 116 | $this->_curveTypes, |
| 159 | - esc_html__( 'Determines whether the series has to be presented in the legend or not.', 'visualizer' ) | |
| 117 | + esc_html__( 'Determines whether the series has to be presented in the legend or not.', Visualizer_Plugin::NAME ) | |
| 160 | 118 | ); |
| 161 | 119 | } |
| 162 | 120 | |
| 163 | - echo '<div class="viz-section-delimiter"></div>'; | |
| 164 | - | |
| 165 | 121 | if ( $this->_includeFocusTarget ) { |
| 166 | 122 | self::_renderSelectItem( |
| 167 | - esc_html__( 'Focus Target', 'visualizer' ), | |
| 123 | + esc_html__( 'Focus Target', Visualizer_Plugin::NAME ), | |
| 168 | 124 | 'focusTarget', |
| 169 | 125 | $this->focusTarget, |
| 170 | 126 | array( |
| 171 | 127 | '' => '', |
| 172 | - 'datum' => esc_html__( 'Focus on a single data point.', 'visualizer' ), | |
| 173 | - 'category' => esc_html__( 'Focus on a grouping of all data points along the major axis.', 'visualizer' ), | |
| 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 ), | |
| 174 | 130 | ), |
| 175 | - esc_html__( 'The type of the entity that receives focus on mouse hover. Also affects which entity is selected by mouse click.', 'visualizer' ) | |
| 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 ) | |
| 176 | 132 | ); |
| 177 | 133 | } |
| 178 | - | |
| 179 | - self::_renderSelectItem( | |
| 180 | - esc_html__( 'Selection Mode', 'visualizer' ), | |
| 181 | - 'selectionMode', | |
| 182 | - $this->selectionMode, | |
| 183 | - array( | |
| 184 | - '' => '', | |
| 185 | - 'single' => esc_html__( 'Single data point', 'visualizer' ), | |
| 186 | - 'multiple' => esc_html__( 'Multiple data points', 'visualizer' ), | |
| 187 | - ), | |
| 188 | - esc_html__( 'Determines how many data points an user can select on a chart.', 'visualizer' ) | |
| 189 | - ); | |
| 190 | - | |
| 191 | - self::_renderSelectItem( | |
| 192 | - esc_html__( 'Aggregation Target', 'visualizer' ), | |
| 193 | - 'aggregationTarget', | |
| 194 | - $this->aggregationTarget, | |
| 195 | - array( | |
| 196 | - '' => '', | |
| 197 | - 'category' => esc_html__( 'Group selected data by x-value', 'visualizer' ), | |
| 198 | - 'series' => esc_html__( 'Group selected data by series', 'visualizer' ), | |
| 199 | - 'auto' => esc_html__( 'Group selected data by x-value if all selections have the same x-value, and by series otherwise', 'visualizer' ), | |
| 200 | - 'none' => esc_html__( 'Show only one tooltip per selection', 'visualizer' ), | |
| 201 | - ), | |
| 202 | - 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' ) | |
| 203 | - ); | |
| 204 | - | |
| 205 | - echo '<div class="viz-section-delimiter"></div>'; | |
| 206 | - | |
| 207 | - self::_renderTextItem( | |
| 208 | - esc_html__( 'Point Opacity', 'visualizer' ), | |
| 209 | - 'dataOpacity', | |
| 210 | - $this->dataOpacity, | |
| 211 | - esc_html__( 'The transparency of data points, with 1.0 being completely opaque and 0.0 fully transparent.', 'visualizer' ), | |
| 212 | - '1.0' | |
| 213 | - ); | |
| 214 | 134 | } |
| 215 | 135 | |
| 216 | 136 | /** |
| 217 | 137 | * Renders lines settings. |
| @@ -220,9 +140,9 @@ | ||
| 220 | 140 | * |
| 221 | 141 | * @access protected |
| 222 | 142 | */ |
| 223 | 143 | protected function _renderLineSettings() { |
| 224 | - self::_renderGroupStart( esc_html__( 'Lines Settings', 'visualizer' ) ); | |
| 144 | + self::_renderGroupStart( esc_html__( 'Lines Settings', Visualizer_Plugin::NAME ) ); | |
| 225 | 145 | self::_renderSectionStart(); |
| 226 | 146 | $this->_renderLineSettingsItems(); |
| 227 | 147 | self::_renderSectionEnd(); |
| 228 | 148 | self::_renderGroupEnd(); |
| @@ -237,61 +157,50 @@ | ||
| 237 | 157 | * @param int $index The series index. |
| 238 | 158 | */ |
| 239 | 159 | protected function _renderSeries( $index ) { |
| 240 | 160 | self::_renderSelectItem( |
| 241 | - esc_html__( 'Visible In Legend', 'visualizer' ), | |
| 161 | + esc_html__( 'Visible In Legend', Visualizer_Plugin::NAME ), | |
| 242 | 162 | 'series[' . $index . '][visibleInLegend]', |
| 243 | - isset( $this->series[ $index ]['visibleInLegend'] ) ? $this->series[ $index ]['visibleInLegend'] : '', | |
| 163 | + isset( $this->series[$index]['visibleInLegend'] ) ? $this->series[$index]['visibleInLegend'] : '', | |
| 244 | 164 | array( |
| 245 | 165 | '' => '', |
| 246 | - '0' => esc_html__( 'No', 'visualizer' ), | |
| 247 | - '1' => esc_html__( 'Yes', 'visualizer' ), | |
| 166 | + '0' => esc_html__( 'No', Visualizer_Plugin::NAME ), | |
| 167 | + '1' => esc_html__( 'Yes', Visualizer_Plugin::NAME ), | |
| 248 | 168 | ), |
| 249 | - esc_html__( 'Determines whether the series has to be presented in the legend or not.', 'visualizer' ) | |
| 169 | + esc_html__( 'Determines whether the series has to be presented in the legend or not.', Visualizer_Plugin::NAME ) | |
| 250 | 170 | ); |
| 251 | 171 | |
| 252 | - echo '<div class="viz-section-item">'; | |
| 253 | - echo '<a class="more-info" href="javascript:;">[?]</a>'; | |
| 254 | - echo '<b>', esc_html__( 'Line Width And Point Size', 'visualizer' ), '</b>'; | |
| 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 | + ); | |
| 255 | 179 | |
| 256 | - echo '<table class="viz-section-table" cellspacing="0" cellpadding="0" border="0">'; | |
| 257 | - echo '<tr>'; | |
| 258 | - echo '<td class="viz-section-table-column">'; | |
| 259 | - $line_width = isset( $this->series[ $index ]['lineWidth'] ) ? $this->series[ $index ]['lineWidth'] : ''; | |
| 260 | - echo '<input type="text" name="series[', $index, '][lineWidth]" class="control-text series-linewidth" value="', esc_attr( $line_width ), '" placeholder="2">'; | |
| 261 | - echo '</td>'; | |
| 262 | - echo '<td class="viz-section-table-column">'; | |
| 263 | - $point_size = isset( $this->series[ $index ]['pointSize'] ) ? $this->series[ $index ]['pointSize'] : ''; | |
| 264 | - echo '<input type="text" name="series[', $index, '][pointSize]" class="control-text" value="', esc_attr( $point_size ), '" placeholder="0">'; | |
| 265 | - echo '</td>'; | |
| 266 | - echo '</tr>'; | |
| 267 | - echo '</table>'; | |
| 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 | + ); | |
| 268 | 187 | |
| 269 | - echo '<p class="viz-section-description">'; | |
| 270 | - esc_html_e( 'Overrides the global line width and point size values for this series.', 'visualizer' ); | |
| 271 | - echo '</p>'; | |
| 272 | - echo '</div>'; | |
| 273 | - | |
| 274 | - $this->_renderFormatField( $index ); | |
| 275 | - | |
| 276 | 188 | if ( $this->_includeCurveTypes ) { |
| 277 | 189 | self::_renderSelectItem( |
| 278 | - esc_html__( 'Curve Type', 'visualizer' ), | |
| 190 | + esc_html__( 'Curve Type', Visualizer_Plugin::NAME ), | |
| 279 | 191 | 'series[' . $index . '][curveType]', |
| 280 | - isset( $this->series[ $index ]['curveType'] ) ? $this->series[ $index ]['curveType'] : '', | |
| 192 | + isset( $this->series[$index]['curveType'] ) ? $this->series[$index]['curveType'] : '', | |
| 281 | 193 | $this->_curveTypes, |
| 282 | - esc_html__( 'Determines whether the series has to be presented in the legend or not.', 'visualizer' ) | |
| 194 | + esc_html__( 'Determines whether the series has to be presented in the legend or not.', Visualizer_Plugin::NAME ) | |
| 283 | 195 | ); |
| 284 | 196 | } |
| 285 | 197 | |
| 286 | 198 | self::_renderColorPickerItem( |
| 287 | - esc_html__( 'Color', 'visualizer' ), | |
| 199 | + esc_html__( 'Color', Visualizer_Plugin::NAME ), | |
| 288 | 200 | 'series[' . $index . '][color]', |
| 289 | - isset( $this->series[ $index ]['color'] ) ? $this->series[ $index ]['color'] : null, | |
| 201 | + isset( $this->series[$index]['color'] ) ? $this->series[$index]['color'] : null, | |
| 290 | 202 | null |
| 291 | 203 | ); |
| 292 | - | |
| 293 | - $this->_renderRoleField( $index ); | |
| 294 | - | |
| 295 | 204 | } |
| 296 | 205 | |
| 297 | -} | |
| 206 | +} | |