| @@ -12,19 +12,8 @@ | ||
| 12 | 12 | */ |
| 13 | 13 | abstract class Visualizer_Render_Sidebar_ChartJS extends Visualizer_Render_Sidebar { |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | - * The array of available legend positions. | |
| 17 | - * | |
| 18 | - * @since 1.0.0 | |
| 19 | - * | |
| 20 | - * @access protected | |
| 21 | - * @var array | |
| 22 | - */ | |
| 23 | - protected $_legendPositions; | |
| 24 | - | |
| 25 | - | |
| 26 | - /** | |
| 27 | 16 | * The constructor. |
| 28 | 17 | */ |
| 29 | 18 | public function __construct( $data = array() ) { |
| 30 | 19 | $this->_library = 'chartjs'; |
| @@ -34,11 +23,10 @@ | ||
| 34 | 23 | 'left' => esc_html__( 'Left of the chart', 'visualizer' ), |
| 35 | 24 | 'right' => esc_html__( 'Right of the chart', 'visualizer' ), |
| 36 | 25 | 'top' => esc_html__( 'Above the chart', 'visualizer' ), |
| 37 | 26 | 'bottom' => esc_html__( 'Below the chart', 'visualizer' ), |
| 38 | - 'bottom' => esc_html__( 'Below the chart', 'visualizer' ), | |
| 39 | - 'none' => esc_html__( 'Omit the legend', 'visualizer' ), | |
| 40 | 27 | ); |
| 28 | + | |
| 41 | 29 | } |
| 42 | 30 | |
| 43 | 31 | /** |
| 44 | 32 | * Renders concrete series settings for the Bar chart. |
| @@ -76,9 +64,9 @@ | ||
| 76 | 64 | |
| 77 | 65 | /** |
| 78 | 66 | * Loads the assets. |
| 79 | 67 | */ |
| 80 | - public function load_chartjs_assets( $deps, $is_frontend ) { | |
| 68 | + function load_chartjs_assets( $deps, $is_frontend ) { | |
| 81 | 69 | $this->load_dependent_assets( array( 'moment', 'numeral' ) ); |
| 82 | 70 | |
| 83 | 71 | wp_register_script( 'chartjs', VISUALIZER_ABSURL . 'js/lib/chartjs.min.js', array( 'numeral', 'moment' ), null, true ); |
| 84 | 72 | wp_register_script( |
| @@ -94,8 +82,9 @@ | ||
| 94 | 82 | return array_merge( |
| 95 | 83 | $deps, |
| 96 | 84 | array( 'visualizer-render-chartjs-lib' ) |
| 97 | 85 | ); |
| 86 | + | |
| 98 | 87 | } |
| 99 | 88 | |
| 100 | 89 | /** |
| 101 | 90 | * Renders series settings group. |
| @@ -130,8 +119,9 @@ | ||
| 130 | 119 | */ |
| 131 | 120 | protected function _renderSeries( $index ) { |
| 132 | 121 | $this->_renderFormatField( $index ); |
| 133 | 122 | $this->_renderChartTypeSeries( $index ); |
| 123 | + | |
| 134 | 124 | } |
| 135 | 125 | |
| 136 | 126 | /** |
| 137 | 127 | * Renders template. |
| @@ -176,15 +166,11 @@ | ||
| 176 | 166 | self::_renderTextAreaItem( |
| 177 | 167 | esc_html__( 'Chart Description', 'visualizer' ), |
| 178 | 168 | 'description', |
| 179 | 169 | $this->description, |
| 180 | - sprintf( | |
| 181 | - // translators: %1$s - HTML link tag, %2$s - HTML closing link tag. | |
| 182 | - esc_html__( 'Description to display in the structured data schema as explained %1$shere%2$s', 'visualizer' ), | |
| 183 | - '<a href="https://developers.google.com/search/docs/data-types/dataset#dataset" target="_blank">', | |
| 184 | - '</a>' | |
| 185 | - ) | |
| 170 | + 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>' ) | |
| 186 | 171 | ); |
| 172 | + | |
| 187 | 173 | } |
| 188 | 174 | |
| 189 | 175 | /** |
| 190 | 176 | * Renders chart general settings group. |
| @@ -205,9 +191,9 @@ | ||
| 205 | 191 | |
| 206 | 192 | self::_renderSectionStart( esc_html__( 'Font Styles', 'visualizer' ), false ); |
| 207 | 193 | echo '<div class="viz-section-item">'; |
| 208 | 194 | echo '<a class="more-info" href="javascript:;">[?]</a>'; |
| 209 | - echo '<b>', esc_html__( 'Font Family And Size', 'visualizer' ), '</b>'; | |
| 195 | + echo '<b>', esc_html__( 'Family And Size', 'visualizer' ), '</b>'; | |
| 210 | 196 | |
| 211 | 197 | echo '<table class="viz-section-table" cellspacing="0" cellpadding="0" border="0">'; |
| 212 | 198 | echo '<tr>'; |
| 213 | 199 | echo '<td class="viz-section-table-column">'; |
| @@ -243,9 +229,9 @@ | ||
| 243 | 229 | 'legend[position]', |
| 244 | 230 | // let's have a default otherwise the chart behaves weird when hovering in edit mode |
| 245 | 231 | isset( $this->legend['position'] ) ? $this->legend['position'] : 'top', |
| 246 | 232 | $this->_legendPositions, |
| 247 | - esc_html__( 'Sets the legend position relative to the chart.', 'visualizer' ) | |
| 233 | + esc_html__( 'Determines where to place the legend, compared to the chart area.', 'visualizer' ) | |
| 248 | 234 | ); |
| 249 | 235 | |
| 250 | 236 | self::_renderCheckboxItem( |
| 251 | 237 | esc_html__( 'Show datasets in reverse order', 'visualizer' ), |
| @@ -256,9 +242,9 @@ | ||
| 256 | 242 | ); |
| 257 | 243 | |
| 258 | 244 | echo '<div class="viz-section-item">'; |
| 259 | 245 | echo '<a class="more-info" href="javascript:;">[?]</a>'; |
| 260 | - echo '<b>', esc_html__( 'Font Family And Size', 'visualizer' ), '</b>'; | |
| 246 | + echo '<b>', esc_html__( 'Family And Size', 'visualizer' ), '</b>'; | |
| 261 | 247 | |
| 262 | 248 | echo '<table class="viz-section-table" cellspacing="0" cellpadding="0" border="0">'; |
| 263 | 249 | echo '<tr>'; |
| 264 | 250 | echo '<td class="viz-section-table-column">'; |
| @@ -298,25 +284,8 @@ | ||
| 298 | 284 | self::_renderSectionEnd(); |
| 299 | 285 | |
| 300 | 286 | $this->_renderAnimationSettings(); |
| 301 | 287 | |
| 302 | - self::_renderSectionStart( esc_html__( 'License & Creator', 'visualizer' ), false ); | |
| 303 | - self::_renderTextItem( | |
| 304 | - esc_html__( 'License', 'visualizer' ), | |
| 305 | - 'license', | |
| 306 | - $this->license, | |
| 307 | - '' | |
| 308 | - ); | |
| 309 | - self::_renderTextItem( | |
| 310 | - esc_html__( 'Creator', 'visualizer' ), | |
| 311 | - 'creator', | |
| 312 | - $this->creator, | |
| 313 | - '' | |
| 314 | - ); | |
| 315 | - self::_renderSectionEnd(); | |
| 316 | - | |
| 317 | - self::_renderChartImageSettings(); | |
| 318 | - | |
| 319 | 288 | self::_renderGroupEnd(); |
| 320 | 289 | } |
| 321 | 290 | |
| 322 | 291 | /** |
| @@ -362,8 +331,9 @@ | ||
| 362 | 331 | esc_html__( 'The easing function applied to the animation.', 'visualizer' ) |
| 363 | 332 | ); |
| 364 | 333 | |
| 365 | 334 | self::_renderSectionEnd(); |
| 335 | + | |
| 366 | 336 | } |
| 367 | 337 | |
| 368 | 338 | /** |
| 369 | 339 | * Renders tooltip settings section. |
| @@ -386,18 +356,9 @@ | ||
| 386 | 356 | * Add the correct description for the manual configuration box. |
| 387 | 357 | */ |
| 388 | 358 | protected function _renderManualConfigDescription() { |
| 389 | 359 | self::_renderSectionStart(); |
| 390 | - self::_renderSectionDescription( | |
| 391 | - '<span class="viz-gvlink">' . sprintf( | |
| 392 | - // translators: %1$s - HTML link tag, %2$s - HTML closing link tag, %3$s - HTML link tag, %4$s - HTML closing link tag. | |
| 393 | - __( 'Configure the graph by providing configuration variables right from the %1$sChartJS API%2$s. You can refer to %3$sCommon Snippets%4$s for examples.', 'visualizer' ), | |
| 394 | - '<a href="https://www.chartjs.org/docs/latest/configuration/" target="_blank">', | |
| 395 | - '</a>', | |
| 396 | - '<a href="https://docs.themeisle.com/article/728-manual-configuration" target="_blank">', | |
| 397 | - '</a>' | |
| 398 | - ) . '</span>' | |
| 399 | - ); | |
| 360 | + self::_renderSectionDescription( '<span class="viz-gvlink">' . sprintf( __( 'Configure the graph by providing configuration variables right from the %1$sChartJS API%2$s. You can refer to to some examples %3$shere%4$s.', 'visualizer' ), '<a href="https://www.chartjs.org/docs/latest/configuration/" target="_blank">', '</a>', '<a href="https://docs.themeisle.com/article/728-manual-configuration" target="_blank">', '</a>' ) . '</span>' ); | |
| 400 | 361 | } |
| 401 | 362 | |
| 402 | 363 | /** |
| 403 | 364 | * Add the correct example for the manual configuration box. |
| @@ -402,15 +363,12 @@ | ||
| 402 | 363 | /** |
| 403 | 364 | * Add the correct example for the manual configuration box. |
| 404 | 365 | */ |
| 405 | 366 | protected function _renderManualConfigExample() { |
| 406 | - return json_encode( | |
| 407 | - array( | |
| 408 | - 'cutoutPercentage' => 5, | |
| 409 | - 'rotation' => 60, | |
| 410 | - ), | |
| 411 | - JSON_PRETTY_PRINT | |
| 412 | - ); | |
| 367 | + return '{ | |
| 368 | + "cutoutPercentage": 5, | |
| 369 | + "rotation": 60 | |
| 370 | + }'; | |
| 413 | 371 | } |
| 414 | 372 | |
| 415 | 373 | /** |
| 416 | 374 | * Renders chart view settings group. |