| @@ -83,8 +83,16 @@ | ||
| 83 | 83 | */ |
| 84 | 84 | protected $_alignments; |
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | + * Whether this chart supports animation or not. | |
| 88 | + * | |
| 89 | + * @access protected | |
| 90 | + * @var bool | |
| 91 | + */ | |
| 92 | + protected $_supportsAnimation = true; | |
| 93 | + | |
| 94 | + /** | |
| 87 | 95 | * Constructor. |
| 88 | 96 | * |
| 89 | 97 | * @since 1.0.0 |
| 90 | 98 | * |
| @@ -174,9 +182,10 @@ | ||
| 174 | 182 | esc_html__( 'Configuration', 'visualizer' ), |
| 175 | 183 | 'manual', |
| 176 | 184 | $this->manual, |
| 177 | 185 | sprintf( |
| 178 | - esc_html__( 'One per line in valid JSON (key:value) format e.g. %s', 'visualizer' ), '<br><code>' . $example . '</code>' | |
| 186 | + esc_html__( 'One per line in valid JSON (key:value) format e.g. %s', 'visualizer' ), | |
| 187 | + '<br><code>' . $example . '</code>' | |
| 179 | 188 | ), |
| 180 | 189 | '', |
| 181 | 190 | array( 'rows' => 5 ) |
| 182 | 191 | ); |
| @@ -310,9 +319,58 @@ | ||
| 310 | 319 | |
| 311 | 320 | self::_renderSectionStart( esc_html__( 'Tooltip', 'visualizer' ), false ); |
| 312 | 321 | $this->_renderTooltipSettigns(); |
| 313 | 322 | self::_renderSectionEnd(); |
| 323 | + | |
| 324 | + $this->_renderAnimationSettings(); | |
| 325 | + | |
| 314 | 326 | self::_renderGroupEnd(); |
| 327 | + } | |
| 328 | + | |
| 329 | + /** | |
| 330 | + * Renders animation settings section. | |
| 331 | + * | |
| 332 | + * @access protected | |
| 333 | + */ | |
| 334 | + protected function _renderAnimationSettings() { | |
| 335 | + if ( ! $this->_supportsAnimation ) { | |
| 336 | + return; | |
| 337 | + } | |
| 338 | + | |
| 339 | + self::_renderSectionStart( esc_html__( 'Animation', 'visualizer' ), false ); | |
| 340 | + | |
| 341 | + self::_renderCheckboxItem( | |
| 342 | + esc_html__( 'Animate on startup', 'visualizer' ), | |
| 343 | + 'animation[startup]', | |
| 344 | + $this->animation['startup'], | |
| 345 | + true, | |
| 346 | + esc_html__( 'Determines if the chart will animate on the initial draw.', 'visualizer' ) | |
| 347 | + ); | |
| 348 | + | |
| 349 | + self::_renderTextItem( | |
| 350 | + esc_html__( 'Duration', 'visualizer' ), | |
| 351 | + 'animation[duration]', | |
| 352 | + isset( $this->animation['duration'] ) ? $this->animation['duration'] : 0, | |
| 353 | + esc_html__( 'The duration of the animation, in milliseconds', 'visualizer' ), | |
| 354 | + 0, | |
| 355 | + 'number' | |
| 356 | + ); | |
| 357 | + | |
| 358 | + self::_renderSelectItem( | |
| 359 | + esc_html__( 'Easing', 'visualizer' ), | |
| 360 | + 'animation[easing]', | |
| 361 | + isset( $this->animation['easing'] ) ? $this->animation['easing'] : null, | |
| 362 | + array( | |
| 363 | + 'linear' => esc_html__( 'Constant speed', 'visualizer' ), | |
| 364 | + 'in' => esc_html__( 'Start slow and speed up', 'visualizer' ), | |
| 365 | + 'out' => esc_html__( 'Start fast and slow down', 'visualizer' ), | |
| 366 | + 'inAndOut' => esc_html__( 'Start slow, speed up, then slow down', 'visualizer' ), | |
| 367 | + ), | |
| 368 | + esc_html__( 'The easing function applied to the animation.', 'visualizer' ) | |
| 369 | + ); | |
| 370 | + | |
| 371 | + self::_renderSectionEnd(); | |
| 372 | + | |
| 315 | 373 | } |
| 316 | 374 | |
| 317 | 375 | /** |
| 318 | 376 | * Renders tooltip settings section. |