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