| @@ -28,9 +28,9 @@ | ||
| 28 | 28 | * |
| 29 | 29 | * @since 1.0.0 |
| 30 | 30 | * @abstract |
| 31 | 31 | */ |
| 32 | -abstract class Visualizer_Render_Sidebar_Graph extends Visualizer_Render_Sidebar { | |
| 32 | +abstract class Visualizer_Render_Sidebar_Graph extends Visualizer_Render_Sidebar_Google { | |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * Determines whether we need to render vertical gridlines options or not. |
| 36 | 36 | * |
| @@ -121,8 +121,18 @@ | ||
| 121 | 121 | $this->axisTitlesPosition, |
| 122 | 122 | $this->_positions, |
| 123 | 123 | esc_html__( 'Determines where to place the axis titles, compared to the chart area.', 'visualizer' ) |
| 124 | 124 | ); |
| 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 | + | |
| 125 | 135 | } |
| 126 | 136 | |
| 127 | 137 | /** |
| 128 | 138 | * Renders general settings block for horizontal axis settings. |
| @@ -139,11 +149,36 @@ | ||
| 139 | 149 | esc_html__( 'The title of the horizontal axis.', 'visualizer' ) |
| 140 | 150 | ); |
| 141 | 151 | |
| 142 | 152 | 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( | |
| 143 | 178 | esc_html__( 'Text Position', 'visualizer' ), |
| 144 | - 'vAxis[textPosition]', | |
| 145 | - isset( $this->vAxis['textPosition'] ) ? $this->vAxis['textPosition'] : '', | |
| 179 | + 'hAxis[textPosition]', | |
| 180 | + isset( $this->hAxis['textPosition'] ) ? $this->hAxis['textPosition'] : '', | |
| 146 | 181 | $this->_positions, |
| 147 | 182 | esc_html__( 'Position of the horizontal axis text, relative to the chart area.', 'visualizer' ) |
| 148 | 183 | ); |
| 149 | 184 | |
| @@ -178,23 +213,24 @@ | ||
| 178 | 213 | self::_renderGroupStart( esc_html__( 'Horizontal Axis Settings', 'visualizer' ) ); |
| 179 | 214 | self::_renderSectionStart( esc_html__( 'General Settings', 'visualizer' ), false ); |
| 180 | 215 | $this->_renderHorizontalAxisGeneralSettings(); |
| 181 | 216 | self::_renderSectionEnd(); |
| 182 | - | |
| 183 | 217 | if ( $this->_horizontalGridLines ) { |
| 184 | 218 | self::_renderSectionStart( esc_html__( 'Grid Lines', 'visualizer' ), false ); |
| 185 | 219 | self::_renderTextItem( |
| 186 | 220 | esc_html__( 'Count', 'visualizer' ), |
| 187 | - 'vAxis[gridlines][count]', | |
| 188 | - isset( $this->vAxis['gridlines']['count'] ) ? $this->vAxis['gridlines']['count'] : '', | |
| 189 | - 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' ), | |
| 190 | - 5 | |
| 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 ) | |
| 191 | 227 | ); |
| 192 | 228 | |
| 193 | 229 | self::_renderColorPickerItem( |
| 194 | 230 | esc_html__( 'Color', 'visualizer' ), |
| 195 | - 'vAxis[gridlines][color]', | |
| 196 | - isset( $this->vAxis['gridlines']['color'] ) ? $this->vAxis['gridlines']['color'] : null, | |
| 231 | + 'hAxis[gridlines][color]', | |
| 232 | + isset( $this->hAxis['gridlines']['color'] ) ? $this->hAxis['gridlines']['color'] : null, | |
| 197 | 233 | '#ccc' |
| 198 | 234 | ); |
| 199 | 235 | self::_renderSectionEnd(); |
| 200 | 236 | |
| @@ -200,24 +236,26 @@ | ||
| 200 | 236 | |
| 201 | 237 | self::_renderSectionStart( esc_html__( 'Minor Grid Lines', 'visualizer' ), false ); |
| 202 | 238 | self::_renderTextItem( |
| 203 | 239 | esc_html__( 'Count', 'visualizer' ), |
| 204 | - 'vAxis[minorGridlines][count]', | |
| 205 | - isset( $this->vAxis['minorGridlines']['count'] ) ? $this->vAxis['minorGridlines']['count'] : '', | |
| 206 | - esc_html__( 'The number of horizontal minor gridlines between two regular gridlines.', 'visualizer' ), | |
| 207 | - 0 | |
| 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, 'max' => 1, 'step' => 1 ) | |
| 208 | 246 | ); |
| 209 | 247 | |
| 210 | 248 | self::_renderColorPickerItem( |
| 211 | 249 | esc_html__( 'Color', 'visualizer' ), |
| 212 | - 'vAxis[minorGridlines][color]', | |
| 213 | - isset( $this->vAxis['minorGridlines']['color'] ) ? $this->vAxis['minorGridlines']['color'] : null, | |
| 250 | + 'hAxis[minorGridlines][color]', | |
| 251 | + isset( $this->hAxis['minorGridlines']['color'] ) ? $this->hAxis['minorGridlines']['color'] : null, | |
| 214 | 252 | null |
| 215 | 253 | ); |
| 216 | 254 | self::_renderSectionEnd(); |
| 217 | 255 | } |
| 218 | 256 | |
| 219 | - if ( $this->_verticalGridLines ) { | |
| 257 | + if ( $this->_horizontalGridLines ) { | |
| 220 | 258 | self::_renderSectionStart( esc_html__( 'View Window', 'visualizer' ), false ); |
| 221 | 259 | self::_renderTextItem( |
| 222 | 260 | esc_html__( 'Maximum Value', 'visualizer' ), |
| 223 | 261 | 'hAxis[viewWindow][max]', |
| @@ -252,10 +290,10 @@ | ||
| 252 | 290 | ); |
| 253 | 291 | |
| 254 | 292 | self::_renderSelectItem( |
| 255 | 293 | esc_html__( 'Text Position', 'visualizer' ), |
| 256 | - 'hAxis[textPosition]', | |
| 257 | - isset( $this->hAxis['textPosition'] ) ? $this->hAxis['textPosition'] : '', | |
| 294 | + 'vAxis[textPosition]', | |
| 295 | + isset( $this->vAxis['textPosition'] ) ? $this->vAxis['textPosition'] : '', | |
| 258 | 296 | $this->_positions, |
| 259 | 297 | esc_html__( 'Position of the vertical axis text, relative to the chart area.', 'visualizer' ) |
| 260 | 298 | ); |
| 261 | 299 | |
| @@ -295,18 +333,20 @@ | ||
| 295 | 333 | if ( $this->_verticalGridLines ) { |
| 296 | 334 | self::_renderSectionStart( esc_html__( 'Grid Lines', 'visualizer' ), false ); |
| 297 | 335 | self::_renderTextItem( |
| 298 | 336 | esc_html__( 'Count', 'visualizer' ), |
| 299 | - 'hAxis[gridlines][count]', | |
| 300 | - isset( $this->hAxis['gridlines']['count'] ) ? $this->hAxis['gridlines']['count'] : '', | |
| 301 | - 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' ), | |
| 302 | - 5 | |
| 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 ) | |
| 303 | 343 | ); |
| 304 | 344 | |
| 305 | 345 | self::_renderColorPickerItem( |
| 306 | 346 | esc_html__( 'Color', 'visualizer' ), |
| 307 | - 'hAxis[gridlines][color]', | |
| 308 | - isset( $this->hAxis['gridlines']['color'] ) ? $this->hAxis['gridlines']['color'] : null, | |
| 347 | + 'vAxis[gridlines][color]', | |
| 348 | + isset( $this->vAxis['gridlines']['color'] ) ? $this->vAxis['gridlines']['color'] : null, | |
| 309 | 349 | '#ccc' |
| 310 | 350 | ); |
| 311 | 351 | self::_renderSectionEnd(); |
| 312 | 352 | |
| @@ -312,24 +352,26 @@ | ||
| 312 | 352 | |
| 313 | 353 | self::_renderSectionStart( esc_html__( 'Minor Grid Lines', 'visualizer' ), false ); |
| 314 | 354 | self::_renderTextItem( |
| 315 | 355 | esc_html__( 'Count', 'visualizer' ), |
| 316 | - 'hAxis[minorGridlines][count]', | |
| 317 | - isset( $this->hAxis['minorGridlines']['count'] ) ? $this->hAxis['minorGridlines']['count'] : '', | |
| 318 | - esc_html__( 'The number of vertical minor gridlines between two regular gridlines.', 'visualizer' ), | |
| 319 | - 0 | |
| 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, 'max' => 1, 'step' => 1 ) | |
| 320 | 362 | ); |
| 321 | 363 | |
| 322 | 364 | self::_renderColorPickerItem( |
| 323 | 365 | esc_html__( 'Color', 'visualizer' ), |
| 324 | - 'hAxis[minorGridlines][color]', | |
| 325 | - isset( $this->hAxis['minorGridlines']['color'] ) ? $this->hAxis['minorGridlines']['color'] : null, | |
| 366 | + 'vAxis[minorGridlines][color]', | |
| 367 | + isset( $this->vAxis['minorGridlines']['color'] ) ? $this->vAxis['minorGridlines']['color'] : null, | |
| 326 | 368 | null |
| 327 | 369 | ); |
| 328 | 370 | self::_renderSectionEnd(); |
| 329 | 371 | } |
| 330 | 372 | |
| 331 | - if ( $this->_horizontalGridLines ) { | |
| 373 | + if ( $this->_verticalGridLines ) { | |
| 332 | 374 | self::_renderSectionStart( esc_html__( 'View Window', 'visualizer' ), false ); |
| 333 | 375 | self::_renderTextItem( |
| 334 | 376 | esc_html__( 'Maximum Value', 'visualizer' ), |
| 335 | 377 | 'vAxis[viewWindow][max]', |
| @@ -368,8 +410,12 @@ | ||
| 368 | 410 | * @access protected |
| 369 | 411 | */ |
| 370 | 412 | protected function _renderSeriesSettings() { |
| 371 | 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 | + | |
| 372 | 418 | for ( $i = 1, $cnt = count( $this->__series ); $i < $cnt; $i++ ) { |
| 373 | 419 | if ( ! empty( $this->__series[ $i ]['label'] ) ) { |
| 374 | 420 | self::_renderSectionStart( esc_html( $this->__series[ $i ]['label'] ), false ); |
| 375 | 421 | $this->_renderSeries( $i - 1 ); |
| @@ -407,8 +453,11 @@ | ||
| 407 | 453 | 'series[' . $index . '][color]', |
| 408 | 454 | isset( $this->series[ $index ]['color'] ) ? $this->series[ $index ]['color'] : null, |
| 409 | 455 | null |
| 410 | 456 | ); |
| 457 | + | |
| 458 | + $this->_renderRoleField( $index ); | |
| 459 | + | |
| 411 | 460 | } |
| 412 | 461 | |
| 413 | 462 | /** |
| 414 | 463 | * Renders format field for horizontal axis. |