| @@ -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 settigns of graph based charts. |
| 24 | 26 | * |
| 25 | 27 | * @category Visualizer |
| @@ -28,9 +30,9 @@ | ||
| 28 | 30 | * |
| 29 | 31 | * @since 1.0.0 |
| 30 | 32 | * @abstract |
| 31 | 33 | */ |
| 32 | -abstract class Visualizer_Render_Sidebar_Graph extends Visualizer_Render_Sidebar_Google { | |
| 34 | +abstract class Visualizer_Render_Sidebar_Graph extends Visualizer_Render_Sidebar { | |
| 33 | 35 | |
| 34 | 36 | /** |
| 35 | 37 | * Determines whether we need to render vertical gridlines options or not. |
| 36 | 38 | * |
| @@ -76,11 +78,11 @@ | ||
| 76 | 78 | $this->_horizontalGridLines = true; |
| 77 | 79 | |
| 78 | 80 | $this->_positions = array( |
| 79 | 81 | '' => '', |
| 80 | - 'in' => esc_html__( 'Inside the chart', 'visualizer' ), | |
| 81 | - 'out' => esc_html__( 'Outside the chart', 'visualizer' ), | |
| 82 | - 'none' => esc_html__( 'None', 'visualizer' ), | |
| 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 ), | |
| 83 | 85 | ); |
| 84 | 86 | } |
| 85 | 87 | |
| 86 | 88 | /** |
| @@ -90,124 +92,32 @@ | ||
| 90 | 92 | * |
| 91 | 93 | * @access protected |
| 92 | 94 | */ |
| 93 | 95 | protected function _renderChartTitleSettings() { |
| 94 | - self::_renderTextItem( | |
| 95 | - esc_html__( 'Chart Title', 'visualizer' ), | |
| 96 | - 'title', | |
| 97 | - $this->title, | |
| 98 | - esc_html__( 'Text to display above the chart.', 'visualizer' ) | |
| 99 | - ); | |
| 96 | + parent::_renderChartTitleSettings(); | |
| 100 | 97 | |
| 101 | 98 | self::_renderSelectItem( |
| 102 | - esc_html__( 'Chart Title Position', 'visualizer' ), | |
| 99 | + esc_html__( 'Chart Title Position', Visualizer_Plugin::NAME ), | |
| 103 | 100 | 'titlePosition', |
| 104 | 101 | $this->titlePosition, |
| 105 | 102 | $this->_positions, |
| 106 | - esc_html__( 'Where to place the chart title, compared to the chart area.', 'visualizer' ) | |
| 103 | + esc_html__( 'Where to place the chart title, compared to the chart area.', Visualizer_Plugin::NAME ) | |
| 107 | 104 | ); |
| 108 | 105 | |
| 109 | - self::_renderColorPickerItem( | |
| 110 | - esc_html__( 'Chart Title Color', 'visualizer' ), | |
| 111 | - 'titleTextStyle[color]', | |
| 112 | - isset( $this->titleTextStyle['color'] ) ? $this->titleTextStyle['color'] : null, | |
| 113 | - '#000' | |
| 114 | - ); | |
| 106 | + echo '<div class="section-delimiter"></div>'; | |
| 115 | 107 | |
| 116 | - echo '<div class="viz-section-delimiter"></div>'; | |
| 117 | - | |
| 118 | 108 | self::_renderSelectItem( |
| 119 | - esc_html__( 'Axes Titles Position', 'visualizer' ), | |
| 109 | + esc_html__( 'Axes Titles Position', Visualizer_Plugin::NAME ), | |
| 120 | 110 | 'axisTitlesPosition', |
| 121 | 111 | $this->axisTitlesPosition, |
| 122 | 112 | $this->_positions, |
| 123 | - esc_html__( 'Determines where to place the axis titles, compared to the chart area.', 'visualizer' ) | |
| 113 | + esc_html__( 'Determines where to place the axis titles, compared to the chart area.', Visualizer_Plugin::NAME ) | |
| 124 | 114 | ); |
| 125 | 115 | |
| 126 | - echo '<div class="viz-section-delimiter"></div>'; | |
| 127 | - | |
| 128 | - self::_renderTextAreaItem( | |
| 129 | - esc_html__( 'Chart Description', 'visualizer' ), | |
| 130 | - 'description', | |
| 131 | - $this->description, | |
| 132 | - sprintf( | |
| 133 | - // translators: %1$s - HTML link tag, %2$s - HTML closing link tag. | |
| 134 | - esc_html__( 'Description to display in the structured data schema as explained %1$shere%2$s', 'visualizer' ), | |
| 135 | - '<a href="https://developers.google.com/search/docs/data-types/dataset#dataset" target="_blank">', | |
| 136 | - '</a>' | |
| 137 | - ) | |
| 138 | - ); | |
| 116 | + echo '<div class="section-delimiter"></div>'; | |
| 139 | 117 | } |
| 140 | 118 | |
| 141 | 119 | /** |
| 142 | - * Renders general settings block for horizontal axis settings. | |
| 143 | - * | |
| 144 | - * @since 1.4.0 | |
| 145 | - * | |
| 146 | - * @access protected | |
| 147 | - */ | |
| 148 | - protected function _renderHorizontalAxisGeneralSettings() { | |
| 149 | - self::_renderTextItem( | |
| 150 | - esc_html__( 'Axis Title', 'visualizer' ), | |
| 151 | - 'hAxis[title]', | |
| 152 | - isset( $this->hAxis['title'] ) ? $this->hAxis['title'] : '', | |
| 153 | - esc_html__( 'The title of the horizontal axis.', 'visualizer' ) | |
| 154 | - ); | |
| 155 | - | |
| 156 | - self::_renderSelectItem( | |
| 157 | - esc_html__( 'Slanted Text', 'visualizer' ), | |
| 158 | - 'hAxis[slantedText]', | |
| 159 | - isset( $this->hAxis['slantedText'] ) ? $this->hAxis['slantedText'] : false, | |
| 160 | - array( | |
| 161 | - false => 'False', | |
| 162 | - true => 'True', | |
| 163 | - ), | |
| 164 | - '', | |
| 165 | - false | |
| 166 | - ); | |
| 167 | - | |
| 168 | - self::_renderTextItem( | |
| 169 | - esc_html__( 'Slanted Text Angle', 'visualizer' ), | |
| 170 | - 'hAxis[slantedTextAngle]', | |
| 171 | - isset( $this->hAxis['slantedTextAngle'] ) ? $this->hAxis['slantedTextAngle'] : 45, | |
| 172 | - '', | |
| 173 | - 45, | |
| 174 | - 'number', | |
| 175 | - array( | |
| 176 | - 'min' => 1, | |
| 177 | - 'step' => 15, | |
| 178 | - ) | |
| 179 | - ); | |
| 180 | - | |
| 181 | - self::_renderSelectItem( | |
| 182 | - esc_html__( 'Text Position', 'visualizer' ), | |
| 183 | - 'hAxis[textPosition]', | |
| 184 | - isset( $this->hAxis['textPosition'] ) ? $this->hAxis['textPosition'] : '', | |
| 185 | - $this->_positions, | |
| 186 | - esc_html__( 'Position of the horizontal axis text, relative to the chart area.', 'visualizer' ) | |
| 187 | - ); | |
| 188 | - | |
| 189 | - self::_renderSelectItem( | |
| 190 | - esc_html__( 'Direction', 'visualizer' ), | |
| 191 | - 'hAxis[direction]', | |
| 192 | - isset( $this->hAxis['direction'] ) ? $this->hAxis['direction'] : '', | |
| 193 | - array( | |
| 194 | - '' => '', | |
| 195 | - '1' => esc_html__( 'Default Direction', 'visualizer' ), | |
| 196 | - '-1' => esc_html__( 'Reverse Direction', 'visualizer' ), | |
| 197 | - ), | |
| 198 | - esc_html__( 'The direction in which the values along the horizontal axis grow.', 'visualizer' ) | |
| 199 | - ); | |
| 200 | - | |
| 201 | - self::_renderColorPickerItem( | |
| 202 | - esc_html__( 'Base Line Color', 'visualizer' ), | |
| 203 | - 'vAxis[baselineColor]', | |
| 204 | - isset( $this->vAxis['baselineColor'] ) ? $this->vAxis['baselineColor'] : null, | |
| 205 | - '#000' | |
| 206 | - ); | |
| 207 | - } | |
| 208 | - | |
| 209 | - /** | |
| 210 | 120 | * Renders horizontal axis settings. |
| 211 | 121 | * |
| 212 | 122 | * @since 1.2.0 |
| 213 | 123 | * |
| @@ -213,113 +123,99 @@ | ||
| 213 | 123 | * |
| 214 | 124 | * @access protected |
| 215 | 125 | */ |
| 216 | 126 | protected function _renderHorizontalAxisSettings() { |
| 217 | - self::_renderGroupStart( esc_html__( 'Horizontal Axis Settings', 'visualizer' ) ); | |
| 218 | - self::_renderSectionStart( esc_html__( 'General Settings', 'visualizer' ), false ); | |
| 219 | - $this->_renderHorizontalAxisGeneralSettings(); | |
| 220 | - self::_renderSectionEnd(); | |
| 221 | - if ( $this->_horizontalGridLines ) { | |
| 222 | - self::_renderSectionStart( esc_html__( 'Grid Lines', 'visualizer' ), false ); | |
| 223 | - self::_renderTextItem( | |
| 224 | - esc_html__( 'Count', 'visualizer' ), | |
| 225 | - 'hAxis[gridlines][count]', | |
| 226 | - isset( $this->hAxis['gridlines']['count'] ) ? $this->hAxis['gridlines']['count'] : '', | |
| 227 | - esc_html__( 'The approximate number of horizontal gridlines inside the chart area. You can specify a value of -1 to automatically compute the number of gridlines, 0 or 1 to draw no gridlines, or 2 or more to only draw gridline. Any number greater than 2 will be used to compute the minSpacing between gridlines.', 'visualizer' ), | |
| 228 | - 5, | |
| 229 | - 'number', | |
| 230 | - array( 'min' => -1, 'max' => 1000, 'step' => 1 ) | |
| 231 | - ); | |
| 127 | + self::_renderGroupStart( esc_html__( 'Horizontal Axis Settings', Visualizer_Plugin::NAME ) ); | |
| 128 | + self::_renderSectionStart( esc_html__( 'General Settings', Visualizer_Plugin::NAME ), false ); | |
| 129 | + self::_renderTextItem( | |
| 130 | + esc_html__( 'Axis Title', Visualizer_Plugin::NAME ), | |
| 131 | + 'hAxis[title]', | |
| 132 | + isset( $this->hAxis['title'] ) ? $this->hAxis['title'] : '', | |
| 133 | + esc_html__( 'The title of the horizontal axis.', Visualizer_Plugin::NAME ) | |
| 134 | + ); | |
| 232 | 135 | |
| 233 | - self::_renderColorPickerItem( | |
| 234 | - esc_html__( 'Color', 'visualizer' ), | |
| 235 | - 'hAxis[gridlines][color]', | |
| 236 | - isset( $this->hAxis['gridlines']['color'] ) ? $this->hAxis['gridlines']['color'] : null, | |
| 237 | - '#ccc' | |
| 238 | - ); | |
| 239 | - self::_renderSectionEnd(); | |
| 136 | + self::_renderSelectItem( | |
| 137 | + esc_html__( 'Text Position', Visualizer_Plugin::NAME ), | |
| 138 | + 'vAxis[textPosition]', | |
| 139 | + isset( $this->vAxis['textPosition'] ) ? $this->vAxis['textPosition'] : '', | |
| 140 | + $this->_positions, | |
| 141 | + esc_html__( 'Position of the horizontal axis text, relative to the chart area.', Visualizer_Plugin::NAME ) | |
| 142 | + ); | |
| 240 | 143 | |
| 241 | - self::_renderSectionStart( esc_html__( 'Minor Grid Lines', 'visualizer' ), false ); | |
| 242 | - self::_renderTextItem( | |
| 243 | - esc_html__( 'Count', 'visualizer' ), | |
| 244 | - 'hAxis[minorGridlines][count]', | |
| 245 | - isset( $this->hAxis['minorGridlines']['count'] ) ? $this->hAxis['minorGridlines']['count'] : '', | |
| 246 | - esc_html__( 'Specify 0 to disable the minor gridlines.', 'visualizer' ), | |
| 247 | - 0, | |
| 248 | - 'number', | |
| 249 | - array( 'min' => 0, 'step' => 1 ) | |
| 250 | - ); | |
| 144 | + self::_renderSelectItem( | |
| 145 | + esc_html__( 'Direction', Visualizer_Plugin::NAME ), | |
| 146 | + 'hAxis[direction]', | |
| 147 | + isset( $this->hAxis['direction'] ) ? $this->hAxis['direction'] : '', | |
| 148 | + array( | |
| 149 | + '' => '', | |
| 150 | + '1' => esc_html__( 'Identical Direction', Visualizer_Plugin::NAME ), | |
| 151 | + '-1' => esc_html__( 'Reverse Direction', Visualizer_Plugin::NAME ), | |
| 152 | + ), | |
| 153 | + esc_html__( 'The direction in which the values along the horizontal axis grow.', Visualizer_Plugin::NAME ) | |
| 154 | + ); | |
| 251 | 155 | |
| 252 | - self::_renderColorPickerItem( | |
| 253 | - esc_html__( 'Color', 'visualizer' ), | |
| 254 | - 'hAxis[minorGridlines][color]', | |
| 255 | - isset( $this->hAxis['minorGridlines']['color'] ) ? $this->hAxis['minorGridlines']['color'] : null, | |
| 256 | - null | |
| 257 | - ); | |
| 156 | + self::_renderColorPickerItem( | |
| 157 | + esc_html__( 'Base Line Color', Visualizer_Plugin::NAME ), | |
| 158 | + 'vAxis[baselineColor]', | |
| 159 | + isset( $this->vAxis['baselineColor'] ) ? $this->vAxis['baselineColor'] : null, | |
| 160 | + '#000' | |
| 161 | + ); | |
| 258 | 162 | self::_renderSectionEnd(); |
| 259 | - } | |
| 260 | 163 | |
| 261 | - if ( $this->_horizontalGridLines ) { | |
| 262 | - self::_renderSectionStart( esc_html__( 'View Window', 'visualizer' ), false ); | |
| 263 | - self::_renderTextItem( | |
| 264 | - esc_html__( 'Maximum Value', 'visualizer' ), | |
| 265 | - 'hAxis[viewWindow][max]', | |
| 266 | - isset( $this->hAxis['viewWindow']['max'] ) ? $this->hAxis['viewWindow']['max'] : '', | |
| 267 | - 'The maximum vertical data value to render.' | |
| 268 | - ); | |
| 164 | + if ( $this->_horizontalGridLines ) { | |
| 165 | + self::_renderSectionStart( esc_html__( 'Grid Lines', Visualizer_Plugin::NAME ), false ); | |
| 166 | + self::_renderTextItem( | |
| 167 | + esc_html__( 'Count', Visualizer_Plugin::NAME ), | |
| 168 | + 'vAxis[gridlines][count]', | |
| 169 | + isset( $this->vAxis['gridlines']['count'] ) ? $this->vAxis['gridlines']['count'] : '', | |
| 170 | + 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 ), | |
| 171 | + 5 | |
| 172 | + ); | |
| 269 | 173 | |
| 270 | - self::_renderTextItem( | |
| 271 | - esc_html__( 'Minimum Value', 'visualizer' ), | |
| 272 | - 'hAxis[viewWindow][min]', | |
| 273 | - isset( $this->hAxis['viewWindow']['min'] ) ? $this->hAxis['viewWindow']['min'] : '', | |
| 274 | - 'The minimum vertical data value to render.' | |
| 275 | - ); | |
| 276 | - self::_renderSectionEnd(); | |
| 277 | - } | |
| 278 | - self::_renderGroupEnd(); | |
| 279 | - } | |
| 174 | + self::_renderColorPickerItem( | |
| 175 | + esc_html__( 'Color', Visualizer_Plugin::NAME ), | |
| 176 | + 'vAxis[gridlines][color]', | |
| 177 | + isset( $this->vAxis['gridlines']['color'] ) ? $this->vAxis['gridlines']['color'] : null, | |
| 178 | + '#ccc' | |
| 179 | + ); | |
| 180 | + self::_renderSectionEnd(); | |
| 280 | 181 | |
| 281 | - /** | |
| 282 | - * Renders general settings block for vertical axis settings. | |
| 283 | - * | |
| 284 | - * @since 1.4.0 | |
| 285 | - * | |
| 286 | - * @access protected | |
| 287 | - */ | |
| 288 | - protected function _renderVerticalAxisGeneralSettings() { | |
| 289 | - self::_renderTextItem( | |
| 290 | - esc_html__( 'Axis Title', 'visualizer' ), | |
| 291 | - 'vAxis[title]', | |
| 292 | - isset( $this->vAxis['title'] ) ? $this->vAxis['title'] : '', | |
| 293 | - esc_html__( 'The title of the vertical axis.', 'visualizer' ) | |
| 294 | - ); | |
| 182 | + self::_renderSectionStart( esc_html__( 'Minor Grid Lines', Visualizer_Plugin::NAME ), false ); | |
| 183 | + self::_renderTextItem( | |
| 184 | + esc_html__( 'Count', Visualizer_Plugin::NAME ), | |
| 185 | + 'vAxis[minorGridlines][count]', | |
| 186 | + isset( $this->vAxis['minorGridlines']['count'] ) ? $this->vAxis['minorGridlines']['count'] : '', | |
| 187 | + esc_html__( 'The number of horizontal minor gridlines between two regular gridlines.', Visualizer_Plugin::NAME ), | |
| 188 | + 0 | |
| 189 | + ); | |
| 295 | 190 | |
| 296 | - self::_renderSelectItem( | |
| 297 | - esc_html__( 'Text Position', 'visualizer' ), | |
| 298 | - 'vAxis[textPosition]', | |
| 299 | - isset( $this->vAxis['textPosition'] ) ? $this->vAxis['textPosition'] : '', | |
| 300 | - $this->_positions, | |
| 301 | - esc_html__( 'Position of the vertical axis text, relative to the chart area.', 'visualizer' ) | |
| 302 | - ); | |
| 191 | + self::_renderColorPickerItem( | |
| 192 | + esc_html__( 'Color', Visualizer_Plugin::NAME ), | |
| 193 | + 'vAxis[minorGridlines][color]', | |
| 194 | + isset( $this->vAxis['minorGridlines']['color'] ) ? $this->vAxis['minorGridlines']['color'] : null, | |
| 195 | + null | |
| 196 | + ); | |
| 197 | + self::_renderSectionEnd(); | |
| 198 | + } | |
| 303 | 199 | |
| 304 | - self::_renderSelectItem( | |
| 305 | - esc_html__( 'Direction', 'visualizer' ), | |
| 306 | - 'vAxis[direction]', | |
| 307 | - isset( $this->vAxis['direction'] ) ? $this->vAxis['direction'] : '', | |
| 308 | - array( | |
| 309 | - '' => '', | |
| 310 | - '1' => esc_html__( 'Default Direction', 'visualizer' ), | |
| 311 | - '-1' => esc_html__( 'Reverse Direction', 'visualizer' ), | |
| 312 | - ), | |
| 313 | - esc_html__( 'The direction in which the values along the vertical axis grow.', 'visualizer' ) | |
| 314 | - ); | |
| 200 | + if ( $this->_verticalGridLines ) { | |
| 201 | + self::_renderSectionStart( esc_html__( 'View Window', Visualizer_Plugin::NAME ), false ); | |
| 202 | + self::_renderTextItem( | |
| 203 | + esc_html__( 'Maximum Value', Visualizer_Plugin::NAME ), | |
| 204 | + 'hAxis[viewWindow][max]', | |
| 205 | + isset( $this->hAxis['viewWindow']['max'] ) ? $this->hAxis['viewWindow']['max'] : '', | |
| 206 | + 'The maximum vertical data value to render.' | |
| 207 | + ); | |
| 315 | 208 | |
| 316 | - self::_renderColorPickerItem( | |
| 317 | - esc_html__( 'Base Line Color', 'visualizer' ), | |
| 318 | - 'hAxis[baselineColor]', | |
| 319 | - isset( $this->hAxis['baselineColor'] ) ? $this->hAxis['baselineColor'] : null, | |
| 320 | - '#000' | |
| 321 | - ); | |
| 209 | + self::_renderTextItem( | |
| 210 | + esc_html__( 'Minimum Value', Visualizer_Plugin::NAME ), | |
| 211 | + 'hAxis[viewWindow][min]', | |
| 212 | + isset( $this->hAxis['viewWindow']['min'] ) ? $this->hAxis['viewWindow']['min'] : '', | |
| 213 | + 'The minimum vertical data value to render.' | |
| 214 | + ); | |
| 215 | + self::_renderSectionEnd(); | |
| 216 | + } | |
| 217 | + self::_renderGroupEnd(); | |
| 322 | 218 | } |
| 323 | 219 | |
| 324 | 220 | /** |
| 325 | 221 | * Renders vertical axis settings. |
| @@ -328,70 +224,98 @@ | ||
| 328 | 224 | * |
| 329 | 225 | * @access protected |
| 330 | 226 | */ |
| 331 | 227 | protected function _renderVerticalAxisSettings() { |
| 332 | - self::_renderGroupStart( esc_html__( 'Vertical Axis Settings', 'visualizer' ) ); | |
| 333 | - self::_renderSectionStart( esc_html__( 'General Settings', 'visualizer' ), false ); | |
| 334 | - $this->_renderVerticalAxisGeneralSettings(); | |
| 228 | + self::_renderGroupStart( esc_html__( 'Vertical Axis Settings', Visualizer_Plugin::NAME ) ); | |
| 229 | + self::_renderSectionStart( esc_html__( 'General Settings', Visualizer_Plugin::NAME ), false ); | |
| 230 | + self::_renderTextItem( | |
| 231 | + esc_html__( 'Axis Title', Visualizer_Plugin::NAME ), | |
| 232 | + 'vAxis[title]', | |
| 233 | + isset( $this->vAxis['title'] ) ? $this->vAxis['title'] : '', | |
| 234 | + esc_html__( 'The title of the vertical axis.', Visualizer_Plugin::NAME ) | |
| 235 | + ); | |
| 236 | + | |
| 237 | + self::_renderSelectItem( | |
| 238 | + esc_html__( 'Text Position', Visualizer_Plugin::NAME ), | |
| 239 | + 'hAxis[textPosition]', | |
| 240 | + isset( $this->hAxis['textPosition'] ) ? $this->hAxis['textPosition'] : '', | |
| 241 | + $this->_positions, | |
| 242 | + esc_html__( 'Position of the vertical axis text, relative to the chart area.', Visualizer_Plugin::NAME ) | |
| 243 | + ); | |
| 244 | + | |
| 245 | + self::_renderSelectItem( | |
| 246 | + esc_html__( 'Direction', Visualizer_Plugin::NAME ), | |
| 247 | + 'vAxis[direction]', | |
| 248 | + isset( $this->vAxis['direction'] ) ? $this->vAxis['direction'] : '', | |
| 249 | + array( | |
| 250 | + '' => '', | |
| 251 | + '1' => esc_html__( 'Identical Direction', Visualizer_Plugin::NAME ), | |
| 252 | + '-1' => esc_html__( 'Reverse Direction', Visualizer_Plugin::NAME ), | |
| 253 | + ), | |
| 254 | + esc_html__( 'The direction in which the values along the vertical axis grow.', Visualizer_Plugin::NAME ) | |
| 255 | + ); | |
| 256 | + | |
| 257 | + self::_renderColorPickerItem( | |
| 258 | + esc_html__( 'Base Line Color', Visualizer_Plugin::NAME ), | |
| 259 | + 'hAxis[baselineColor]', | |
| 260 | + isset( $this->hAxis['baselineColor'] ) ? $this->hAxis['baselineColor'] : null, | |
| 261 | + '#000' | |
| 262 | + ); | |
| 335 | 263 | self::_renderSectionEnd(); |
| 336 | 264 | |
| 337 | - if ( $this->_verticalGridLines ) { | |
| 338 | - self::_renderSectionStart( esc_html__( 'Grid Lines', 'visualizer' ), false ); | |
| 339 | - self::_renderTextItem( | |
| 340 | - esc_html__( 'Count', 'visualizer' ), | |
| 341 | - 'vAxis[gridlines][count]', | |
| 342 | - isset( $this->vAxis['gridlines']['count'] ) ? $this->vAxis['gridlines']['count'] : '', | |
| 343 | - esc_html__( 'The approximate number of vertical gridlines inside the chart area. You can specify a value of -1 to automatically compute the number of gridlines, 0 or 1 to draw no gridlines, or 2 or more to only draw gridline. Any number greater than 2 will be used to compute the minSpacing between gridlines.', 'visualizer' ), | |
| 344 | - 5, | |
| 345 | - 'number', | |
| 346 | - array( 'min' => -1, 'max' => 1000, 'step' => 1 ) | |
| 347 | - ); | |
| 265 | + if ( $this->_verticalGridLines ) { | |
| 266 | + self::_renderSectionStart( esc_html__( 'Grid Lines', Visualizer_Plugin::NAME ), false ); | |
| 267 | + self::_renderTextItem( | |
| 268 | + esc_html__( 'Count', Visualizer_Plugin::NAME ), | |
| 269 | + 'hAxis[gridlines][count]', | |
| 270 | + isset( $this->hAxis['gridlines']['count'] ) ? $this->hAxis['gridlines']['count'] : '', | |
| 271 | + 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 ), | |
| 272 | + 5 | |
| 273 | + ); | |
| 348 | 274 | |
| 349 | - self::_renderColorPickerItem( | |
| 350 | - esc_html__( 'Color', 'visualizer' ), | |
| 351 | - 'vAxis[gridlines][color]', | |
| 352 | - isset( $this->vAxis['gridlines']['color'] ) ? $this->vAxis['gridlines']['color'] : null, | |
| 353 | - '#ccc' | |
| 354 | - ); | |
| 355 | - self::_renderSectionEnd(); | |
| 275 | + self::_renderColorPickerItem( | |
| 276 | + esc_html__( 'Color', Visualizer_Plugin::NAME ), | |
| 277 | + 'hAxis[gridlines][color]', | |
| 278 | + isset( $this->hAxis['gridlines']['color'] ) ? $this->hAxis['gridlines']['color'] : null, | |
| 279 | + '#ccc' | |
| 280 | + ); | |
| 281 | + self::_renderSectionEnd(); | |
| 356 | 282 | |
| 357 | - self::_renderSectionStart( esc_html__( 'Minor Grid Lines', 'visualizer' ), false ); | |
| 358 | - self::_renderTextItem( | |
| 359 | - esc_html__( 'Count', 'visualizer' ), | |
| 360 | - 'vAxis[minorGridlines][count]', | |
| 361 | - isset( $this->vAxis['minorGridlines']['count'] ) ? $this->vAxis['minorGridlines']['count'] : '', | |
| 362 | - esc_html__( 'Specify 0 to disable the minor gridlines.', 'visualizer' ), | |
| 363 | - 0, | |
| 364 | - 'number', | |
| 365 | - array( 'min' => 0, 'step' => 1 ) | |
| 366 | - ); | |
| 283 | + self::_renderSectionStart( esc_html__( 'Minor Grid Lines', Visualizer_Plugin::NAME ), false ); | |
| 284 | + self::_renderTextItem( | |
| 285 | + esc_html__( 'Count', Visualizer_Plugin::NAME ), | |
| 286 | + 'hAxis[minorGridlines][count]', | |
| 287 | + isset( $this->hAxis['minorGridlines']['count'] ) ? $this->hAxis['minorGridlines']['count'] : '', | |
| 288 | + esc_html__( 'The number of vertical minor gridlines between two regular gridlines.', Visualizer_Plugin::NAME ), | |
| 289 | + 0 | |
| 290 | + ); | |
| 367 | 291 | |
| 368 | - self::_renderColorPickerItem( | |
| 369 | - esc_html__( 'Color', 'visualizer' ), | |
| 370 | - 'vAxis[minorGridlines][color]', | |
| 371 | - isset( $this->vAxis['minorGridlines']['color'] ) ? $this->vAxis['minorGridlines']['color'] : null, | |
| 372 | - null | |
| 373 | - ); | |
| 374 | - self::_renderSectionEnd(); | |
| 375 | - } | |
| 292 | + self::_renderColorPickerItem( | |
| 293 | + esc_html__( 'Color', Visualizer_Plugin::NAME ), | |
| 294 | + 'hAxis[minorGridlines][color]', | |
| 295 | + isset( $this->hAxis['minorGridlines']['color'] ) ? $this->hAxis['minorGridlines']['color'] : null, | |
| 296 | + null | |
| 297 | + ); | |
| 298 | + self::_renderSectionEnd(); | |
| 299 | + } | |
| 376 | 300 | |
| 377 | - if ( $this->_verticalGridLines ) { | |
| 378 | - self::_renderSectionStart( esc_html__( 'View Window', 'visualizer' ), false ); | |
| 379 | - self::_renderTextItem( | |
| 380 | - esc_html__( 'Maximum Value', 'visualizer' ), | |
| 381 | - 'vAxis[viewWindow][max]', | |
| 382 | - isset( $this->vAxis['viewWindow']['max'] ) ? $this->vAxis['viewWindow']['max'] : '', | |
| 383 | - 'The maximum vertical data value to render.' | |
| 384 | - ); | |
| 301 | + if ( $this->_horizontalGridLines ) { | |
| 302 | + self::_renderSectionStart( esc_html__( 'View Window', Visualizer_Plugin::NAME ), false ); | |
| 303 | + self::_renderTextItem( | |
| 304 | + esc_html__( 'Maximum Value', Visualizer_Plugin::NAME ), | |
| 305 | + 'vAxis[viewWindow][max]', | |
| 306 | + isset( $this->vAxis['viewWindow']['max'] ) ? $this->vAxis['viewWindow']['max'] : '', | |
| 307 | + 'The maximum vertical data value to render.' | |
| 308 | + ); | |
| 385 | 309 | |
| 386 | - self::_renderTextItem( | |
| 387 | - esc_html__( 'Minimum Value', 'visualizer' ), | |
| 388 | - 'vAxis[viewWindow][min]', | |
| 389 | - isset( $this->vAxis['viewWindow']['min'] ) ? $this->vAxis['viewWindow']['min'] : '', | |
| 390 | - 'The minimum vertical data value to render.' | |
| 391 | - ); | |
| 392 | - self::_renderSectionEnd(); | |
| 393 | - } | |
| 310 | + self::_renderTextItem( | |
| 311 | + esc_html__( 'Minimum Value', Visualizer_Plugin::NAME ), | |
| 312 | + 'vAxis[viewWindow][min]', | |
| 313 | + isset( $this->vAxis['viewWindow']['min'] ) ? $this->vAxis['viewWindow']['min'] : '', | |
| 314 | + 'The minimum vertical data value to render.' | |
| 315 | + ); | |
| 316 | + self::_renderSectionEnd(); | |
| 317 | + } | |
| 394 | 318 | self::_renderGroupEnd(); |
| 395 | 319 | } |
| 396 | 320 | |
| 397 | 321 | /** |
| @@ -413,20 +337,16 @@ | ||
| 413 | 337 | * |
| 414 | 338 | * @access protected |
| 415 | 339 | */ |
| 416 | 340 | protected function _renderSeriesSettings() { |
| 417 | - self::_renderGroupStart( esc_html__( 'Series Settings', 'visualizer' ) ); | |
| 418 | - self::_renderSectionStart(); | |
| 419 | - self::_renderSectionDescription( esc_html__( 'If you have just updated/modified the chart data, you may need to save it before the new data reflects in the settings.', 'visualizer' ), 'viz-info-msg' ); | |
| 420 | - self::_renderSectionEnd(); | |
| 421 | - | |
| 422 | - for ( $i = 1, $cnt = count( $this->__series ); $i < $cnt; $i++ ) { | |
| 423 | - if ( ! empty( $this->__series[ $i ]['label'] ) ) { | |
| 424 | - self::_renderSectionStart( esc_html( $this->__series[ $i ]['label'] ), false ); | |
| 425 | - $this->_renderSeries( $i - 1 ); | |
| 426 | - self::_renderSectionEnd(); | |
| 341 | + self::_renderGroupStart( esc_html__( 'Series Settings', Visualizer_Plugin::NAME ) ); | |
| 342 | + for ( $i = 1, $cnt = count( $this->__series ); $i < $cnt; $i++ ) { | |
| 343 | + if ( !empty( $this->__series[$i]['label'] ) ) { | |
| 344 | + self::_renderSectionStart( esc_html( $this->__series[$i]['label'] ), false ); | |
| 345 | + $this->_renderSeries( $i - 1 ); | |
| 346 | + self::_renderSectionEnd(); | |
| 347 | + } | |
| 427 | 348 | } |
| 428 | - } | |
| 429 | 349 | self::_renderGroupEnd(); |
| 430 | 350 | } |
| 431 | 351 | |
| 432 | 352 | /** |
| @@ -438,89 +358,24 @@ | ||
| 438 | 358 | * @param int $index The series index. |
| 439 | 359 | */ |
| 440 | 360 | protected function _renderSeries( $index ) { |
| 441 | 361 | self::_renderSelectItem( |
| 442 | - esc_html__( 'Visible In Legend', 'visualizer' ), | |
| 362 | + esc_html__( 'Visible In Legend', Visualizer_Plugin::NAME ), | |
| 443 | 363 | 'series[' . $index . '][visibleInLegend]', |
| 444 | - isset( $this->series[ $index ]['visibleInLegend'] ) ? $this->series[ $index ]['visibleInLegend'] : '', | |
| 364 | + isset( $this->series[$index]['visibleInLegend'] ) ? $this->series[$index]['visibleInLegend'] : '', | |
| 445 | 365 | array( |
| 446 | 366 | '' => '', |
| 447 | - '0' => esc_html__( 'No', 'visualizer' ), | |
| 448 | - '1' => esc_html__( 'Yes', 'visualizer' ), | |
| 367 | + '0' => esc_html__( 'No', Visualizer_Plugin::NAME ), | |
| 368 | + '1' => esc_html__( 'Yes', Visualizer_Plugin::NAME ), | |
| 449 | 369 | ), |
| 450 | - esc_html__( 'Determines whether the series has to be presented in the legend or not.', 'visualizer' ) | |
| 370 | + esc_html__( 'Determines whether the series has to be presented in the legend or not.', Visualizer_Plugin::NAME ) | |
| 451 | 371 | ); |
| 452 | 372 | |
| 453 | - $this->_renderFormatField( $index ); | |
| 454 | - | |
| 455 | 373 | self::_renderColorPickerItem( |
| 456 | - esc_html__( 'Color', 'visualizer' ), | |
| 374 | + esc_html__( 'Color', Visualizer_Plugin::NAME ), | |
| 457 | 375 | 'series[' . $index . '][color]', |
| 458 | - isset( $this->series[ $index ]['color'] ) ? $this->series[ $index ]['color'] : null, | |
| 376 | + isset( $this->series[$index]['color'] ) ? $this->series[$index]['color'] : null, | |
| 459 | 377 | null |
| 460 | 378 | ); |
| 461 | - | |
| 462 | - $this->_renderRoleField( $index ); | |
| 463 | 379 | } |
| 464 | 380 | |
| 465 | - /** | |
| 466 | - * Renders format field for horizontal axis. | |
| 467 | - * | |
| 468 | - * @since 1.4.3 | |
| 469 | - * | |
| 470 | - * @access protected | |
| 471 | - */ | |
| 472 | - protected function _renderHorizontalAxisFormatField() { | |
| 473 | - self::_renderTextItem( | |
| 474 | - esc_html__( 'Number Format', 'visualizer' ), | |
| 475 | - 'hAxis[format]', | |
| 476 | - isset( $this->hAxis['format'] ) ? $this->hAxis['format'] : '', | |
| 477 | - sprintf( | |
| 478 | - '%s<br><br>%s<br><br>%s', | |
| 479 | - esc_html__( 'Enter custom format pattern to apply to horizontal axis labels.', 'visualizer' ), | |
| 480 | - sprintf( | |
| 481 | - // translators: %1$s - HTML link tag, %2$s - HTML closing link tag. | |
| 482 | - esc_html__( 'For number axis labels, this is a subset of the decimal formatting %1$sICU pattern set%2$s. For instance, $#,###.## will display values $1,234.56 for value 1234.56. Note: Using the #%% percentage format will multiply your values by 100.', 'visualizer' ), | |
| 483 | - '<a href="http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details" target="_blank">', | |
| 484 | - '</a>' | |
| 485 | - ), | |
| 486 | - sprintf( | |
| 487 | - // translators: %1$s - HTML link tag, %2$s - HTML closing link tag. | |
| 488 | - esc_html__( 'For date axis labels, this is a subset of the date formatting %1$sICU date and time format%2$s.', 'visualizer' ), | |
| 489 | - '<a href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax" target="_blank">', | |
| 490 | - '</a>' | |
| 491 | - ) | |
| 492 | - ) | |
| 493 | - ); | |
| 494 | - } | |
| 495 | - | |
| 496 | - /** | |
| 497 | - * Renders format field for vertical axis settings. | |
| 498 | - * | |
| 499 | - * @since 1.4.3 | |
| 500 | - * | |
| 501 | - * @access protected | |
| 502 | - */ | |
| 503 | - protected function _renderVerticalAxisFormatField() { | |
| 504 | - self::_renderTextItem( | |
| 505 | - esc_html__( 'Number Format', 'visualizer' ), | |
| 506 | - 'vAxis[format]', | |
| 507 | - isset( $this->vAxis['format'] ) ? $this->vAxis['format'] : '', | |
| 508 | - sprintf( | |
| 509 | - '%s<br><br>%s<br><br>%s', | |
| 510 | - esc_html__( 'Enter custom format pattern to apply to vertical axis labels.', 'visualizer' ), | |
| 511 | - sprintf( | |
| 512 | - // translators: %1$s - HTML link tag, %2$s - HTML closing link tag. | |
| 513 | - esc_html__( 'For number axis labels, this is a subset of the decimal formatting %1$sICU pattern set%2$s. For instance, $#,###.## will display values $1,234.56 for value 1234.56. Note: Using the #%% percentage format will multiply your values by 100.', 'visualizer' ), | |
| 514 | - '<a href="http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details" target="_blank">', | |
| 515 | - '</a>' | |
| 516 | - ), | |
| 517 | - sprintf( | |
| 518 | - // translators: %1$s - HTML link tag, %2$s - HTML closing link tag. | |
| 519 | - esc_html__( 'For date axis labels, this is a subset of the date formatting %1$sICU date and time format%2$s.', 'visualizer' ), | |
| 520 | - '<a href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax" target="_blank">', | |
| 521 | - '</a>' | |
| 522 | - ) | |
| 523 | - ) | |
| 524 | - ); | |
| 525 | - } | |
| 526 | -} | |
| 381 | +} | |