| @@ -399,9 +399,9 @@ | ||
| 399 | 399 | * |
| 400 | 400 | * @access public |
| 401 | 401 | * @return array |
| 402 | 402 | */ |
| 403 | - public function get_chart_settings_google_admin($settings, $action, $source) { | |
| 403 | + public function get_chart_settings_google_admin ($settings, $action, $source) { | |
| 404 | 404 | $chart_default_colors = array('#3366cc','#dc3912','#ff9900','#109618', '#990099','#0099c6','#dd4477','#66aa00', '#b82e2e','#316395','#994499','#22aa99', '#aaaa11','#6633cc','#e67300','#8b0707', '#651067','#329262','#5574a6','#3b3eac', '#b77322','#16d620','#b91383','#f4359e', '#9c5935','#a9c413','#2a778d','#668d1c', '#bea413','#0c5922','#743411'); |
| 405 | 405 | |
| 406 | 406 | $tooltip_trigger_options = array( |
| 407 | 407 | "hover" => __("While hovering", "chart-builder"), |
| @@ -969,9 +969,9 @@ | ||
| 969 | 969 | |
| 970 | 970 | $settings['enable_img'] = ( isset( $settings['enable_img'] ) && $settings['enable_img'] != '' ) ? $settings['enable_img'] : 'off'; |
| 971 | 971 | $settings['enable_img'] = isset( $settings['enable_img'] ) && $settings['enable_img'] == 'on' ? 'checked' : ''; |
| 972 | 972 | |
| 973 | - $counting_source = !empty($source) ? $source : array(); | |
| 973 | + $counting_source = $source; | |
| 974 | 974 | |
| 975 | 975 | $count_slices = (isset($counting_source) && !is_null($counting_source) && count($counting_source) > 0) ? count($counting_source) - 1 : 0; |
| 976 | 976 | $count_series = (isset($counting_source[0]) && !is_null($counting_source[0]) && count($counting_source[0]) > 0) ? count($counting_source[0]) - 1 : 0; |
| 977 | 977 | $count_rows = (isset($counting_source) && !is_null($counting_source) && count($counting_source) > 0) ? count(array_column($counting_source, 0)) - 1 : 0; |
| @@ -1397,58 +1397,58 @@ | ||
| 1397 | 1397 | * |
| 1398 | 1398 | * @access public |
| 1399 | 1399 | * @return array |
| 1400 | 1400 | */ |
| 1401 | - public function get_chart_settings_chartjs_admin($settings, $source) { | |
| 1401 | + public function get_chart_settings_chartjs_admin ($settings) { | |
| 1402 | 1402 | $chart_default_colors = array('#36A2EB','#FF6384','#FF9F40','#FFCD56', '#4BC0C0','#0099c6','#dd4477','#66aa00', '#b82e2e','#316395','#994499','#22aa99', '#aaaa11','#6633cc','#e67300','#8b0707', '#651067','#329262','#5574a6','#3b3eac', '#b77322','#16d620','#b91383','#f4359e', '#9c5935','#a9c413','#2a778d','#668d1c', '#bea413','#0c5922','#743411'); |
| 1403 | 1403 | |
| 1404 | 1404 | $title_positions = array( |
| 1405 | - "left" => __("Left", "chart-builder"), | |
| 1406 | - "right" => __("Right", "chart-builder"), | |
| 1407 | - "center" => __("Center", "chart-builder") | |
| 1405 | + "left" => __("Left", "chart-builder"), | |
| 1406 | + "right" => __("Right", "chart-builder"), | |
| 1407 | + "center" => __("Center", "chart-builder") | |
| 1408 | 1408 | ); |
| 1409 | 1409 | |
| 1410 | 1410 | $text_transforms = array( |
| 1411 | - "uppercase" => __("Uppercase", "chart-builder"), | |
| 1412 | - "lowercase" => __("Lowercase", "chart-builder"), | |
| 1413 | - "capitalize" => __("Capitalize", "chart-builder"), | |
| 1414 | - "none" => __("None", "chart-builder"), | |
| 1411 | + "uppercase" => __("Uppercase", "chart-builder"), | |
| 1412 | + "lowercase" => __("Lowercase", "chart-builder"), | |
| 1413 | + "capitalize" => __("Capitalize", "chart-builder"), | |
| 1414 | + "none" => __("None", "chart-builder"), | |
| 1415 | 1415 | ); |
| 1416 | 1416 | |
| 1417 | 1417 | $text_decorations = array( |
| 1418 | - "overline" => __("Overline", "chart-builder"), | |
| 1419 | - "underline" => __("Underline", "chart-builder"), | |
| 1420 | - "line-through" => __("Line through", "chart-builder"), | |
| 1421 | - "none" => __("None", "chart-builder"), | |
| 1418 | + "overline" => __("Overline", "chart-builder"), | |
| 1419 | + "underline" => __("Underline", "chart-builder"), | |
| 1420 | + "line-through" => __("Line through", "chart-builder"), | |
| 1421 | + "none" => __("None", "chart-builder"), | |
| 1422 | 1422 | ); |
| 1423 | 1423 | |
| 1424 | 1424 | $border_styles = array( |
| 1425 | - "solid" => __("Solid", "chart-builder"), | |
| 1426 | - "dashed" => __("Dashed", "chart-builder"), | |
| 1427 | - "dotted" => __("Dotted", "chart-builder"), | |
| 1428 | - "double" => __("Double", "chart-builder"), | |
| 1429 | - "groove" => __("Groove", "chart-builder"), | |
| 1430 | - "inset" => __("Inset", "chart-builder"), | |
| 1431 | - "outset" => __("Outset", "chart-builder"), | |
| 1432 | - "ridge" => __("Ridge", "chart-builder") | |
| 1425 | + "solid" => __("Solid", "chart-builder"), | |
| 1426 | + "dashed" => __("Dashed", "chart-builder"), | |
| 1427 | + "dotted" => __("Dotted", "chart-builder"), | |
| 1428 | + "double" => __("Double", "chart-builder"), | |
| 1429 | + "groove" => __("Groove", "chart-builder"), | |
| 1430 | + "inset" => __("Inset", "chart-builder"), | |
| 1431 | + "outset" => __("Outset", "chart-builder"), | |
| 1432 | + "ridge" => __("Ridge", "chart-builder") | |
| 1433 | 1433 | ); |
| 1434 | 1434 | |
| 1435 | 1435 | $legend_positions = array( |
| 1436 | - "top" => __("Above the chart", "chart-builder"), | |
| 1437 | - "bottom" => __("Below the chart", "chart-builder"), | |
| 1438 | - "left" => __("Left of the chart", "chart-builder"), | |
| 1439 | - "right" => __("Right of the chart", "chart-builder"), | |
| 1436 | + "top" => __("Above the chart", "chart-builder"), | |
| 1437 | + "bottom" => __("Below the chart", "chart-builder"), | |
| 1438 | + "left" => __("Left of the chart", "chart-builder"), | |
| 1439 | + "right" => __("Right of the chart", "chart-builder"), | |
| 1440 | 1440 | ); |
| 1441 | 1441 | |
| 1442 | 1442 | $legend_alignments = array( |
| 1443 | - "start" => __("Start", "chart-builder"), | |
| 1444 | - "center" => __("Center", "chart-builder"), | |
| 1445 | - "end" => __("End", "chart-builder"), | |
| 1443 | + "start" => __("Start", "chart-builder"), | |
| 1444 | + "center" => __("Center", "chart-builder"), | |
| 1445 | + "end" => __("End", "chart-builder"), | |
| 1446 | 1446 | ); |
| 1447 | 1447 | |
| 1448 | 1448 | $group_width_format_options = array( |
| 1449 | - "%" => __("%", "chart-builder"), | |
| 1450 | - "px" => __("px", "chart-builder"), | |
| 1449 | + "%" => __("%", "chart-builder"), | |
| 1450 | + "px" => __("px", "chart-builder"), | |
| 1451 | 1451 | ); |
| 1452 | 1452 | |
| 1453 | 1453 | // Width |
| 1454 | 1454 | $settings['width'] = isset( $settings['width'] ) && $settings['width'] != '' ? esc_attr( $settings['width'] ) : '100'; |
| @@ -1455,10 +1455,10 @@ | ||
| 1455 | 1455 | $settings['width_format'] = isset( $settings['width_format'] ) && $settings['width_format'] != '' ? esc_attr( $settings['width_format'] ) : '%'; |
| 1456 | 1456 | $settings['width_format_options'] = $group_width_format_options; |
| 1457 | 1457 | |
| 1458 | 1458 | // Height |
| 1459 | - $settings['height'] = isset( $settings['height'] ) && $settings['height'] != '' ? esc_attr( $settings['height'] ) : '100'; | |
| 1460 | - $settings['height_format'] = isset( $settings['height_format'] ) && $settings['height_format'] != '' ? esc_attr( $settings['height_format'] ) : '%'; | |
| 1459 | + $settings['height'] = isset( $settings['height'] ) && $settings['height'] != '' ? esc_attr( $settings['height'] ) : '400'; | |
| 1460 | + $settings['height_format'] = isset( $settings['height_format'] ) && $settings['height_format'] != '' ? esc_attr( $settings['height_format'] ) : 'px'; | |
| 1461 | 1461 | |
| 1462 | 1462 | // Title color |
| 1463 | 1463 | $settings['title_color'] = isset( $settings['title_color'] ) && $settings['title_color'] != '' ? esc_attr( $settings['title_color'] ) : '#000000'; |
| 1464 | 1464 | |
| @@ -1600,21 +1600,17 @@ | ||
| 1600 | 1600 | $settings['show_title'] = ( $settings['show_title'] != '' ) ? $settings['show_title'] : 'off'; |
| 1601 | 1601 | $settings['show_title'] = isset( $settings['show_title'] ) && $settings['show_title'] == 'on' ? 'checked' : ''; |
| 1602 | 1602 | } |
| 1603 | 1603 | |
| 1604 | - $counting_source = !empty($source) ? $source : array(); | |
| 1605 | 1604 | $count_slices = (isset($counting_source) && !is_null($counting_source) && count($counting_source) > 0) ? count($counting_source) - 1 : 0; |
| 1606 | 1605 | |
| 1607 | 1606 | // Slices settings |
| 1608 | 1607 | $settings['slice_colors_default'] = $chart_default_colors; |
| 1609 | - $settings['slice_color'] = isset( $settings['slice_color'] ) && $settings['slice_color'] != '' ? json_decode($settings['slice_color'], true) : array_slice($chart_default_colors, 0, $count_slices); | |
| 1610 | - | |
| 1608 | + $settings['slice_color'] = isset( $settings['slice_color'] ) && $settings['slice_color'] != '' ? json_decode($settings['slice_color'], true) : array_slice($chart_default_colors, 0, $count_slices);; | |
| 1609 | + | |
| 1611 | 1610 | // Slice border color |
| 1612 | 1611 | $settings['slice_border_color'] = isset( $settings['slice_border_color'] ) && $settings['slice_border_color'] != '' ? esc_attr( $settings['slice_border_color'] ) : '#ffffff'; |
| 1613 | - | |
| 1614 | - // Slice border color | |
| 1615 | - $settings['slices_border_color'] = isset( $settings['slices_border_color'] ) && $settings['slices_border_color'] != '' ? json_decode($settings['slices_border_color'], true) : array_fill(0, $count_slices, $settings['slice_border_color']); | |
| 1616 | - | |
| 1612 | + | |
| 1617 | 1613 | // Slices border width |
| 1618 | 1614 | $settings['slice_border_width'] = isset( $settings['slice_border_width'] ) && $settings['slice_border_width'] != '' ? esc_attr( $settings['slice_border_width'] ) : '1'; |
| 1619 | 1615 | |
| 1620 | 1616 | // Tooltip text color |
| @@ -1619,28 +1615,8 @@ | ||
| 1619 | 1615 | |
| 1620 | 1616 | // Tooltip text color |
| 1621 | 1617 | $settings['tooltip_text_color'] = isset( $settings['tooltip_text_color'] ) && $settings['tooltip_text_color'] != '' ? esc_attr( $settings['tooltip_text_color'] ) : '#fff'; |
| 1622 | 1618 | |
| 1623 | - $settings['show_color_code'] = isset( $settings['show_color_code'] ) && $settings['show_color_code'] != '' ? esc_attr( $settings['show_color_code'] ) : 'off'; | |
| 1624 | - $settings['show_color_code'] = isset( $settings['show_color_code'] ) && $settings['show_color_code'] == 'on' ? 'checked' : ''; | |
| 1625 | - | |
| 1626 | - $settings['tooltip_italic'] = ( isset( $settings['tooltip_italic'] ) && $settings['tooltip_italic'] != '' ) ? $settings['tooltip_italic'] : 'off'; | |
| 1627 | - $settings['tooltip_italic'] = isset( $settings['tooltip_italic'] ) && $settings['tooltip_italic'] == 'on' ? 'checked' : ''; | |
| 1628 | - | |
| 1629 | - // Tooltip font size | |
| 1630 | - $settings['tooltip_font_size'] = isset( $settings['tooltip_font_size'] ) && intval($settings['tooltip_font_size']) > 0 ? esc_attr( $settings['tooltip_font_size'] ) : '12'; | |
| 1631 | - | |
| 1632 | - // Tooltip bold options | |
| 1633 | - $tooltip_bold_options = array( | |
| 1634 | - "default" => __("Default", "chart-builder"), | |
| 1635 | - "true" => __("Enable", "chart-builder"), | |
| 1636 | - "false" => __("Disable", "chart-builder") | |
| 1637 | - ); | |
| 1638 | - | |
| 1639 | - // Tooltip bold text | |
| 1640 | - $settings['tooltip_bold'] = isset( $settings['tooltip_bold'] ) && $settings['tooltip_bold'] != '' ? esc_attr( $settings['tooltip_bold'] ) : 'default'; | |
| 1641 | - $settings['tooltip_bold_options'] = $tooltip_bold_options; | |
| 1642 | - | |
| 1643 | 1619 | // Legend font color |
| 1644 | 1620 | $settings['legend_color'] = isset( $settings['legend_color'] ) && $settings['legend_color'] != '' ? esc_attr( $settings['legend_color'] ) : '#000000'; |
| 1645 | 1621 | |
| 1646 | 1622 | // Legend font size |
| @@ -1675,11 +1651,11 @@ | ||
| 1675 | 1651 | * |
| 1676 | 1652 | * @access public |
| 1677 | 1653 | * @return array |
| 1678 | 1654 | */ |
| 1679 | - public function get_chart_settings_chartjs_public($settings, $chartData) { | |
| 1655 | + public function get_chart_settings_chartjs_public ($settings) { | |
| 1680 | 1656 | $chart_default_colors = array('#36A2EB','#FF6384','#FF9F40','#FFCD56', '#4BC0C0','#0099c6','#dd4477','#66aa00', '#b82e2e','#316395','#994499','#22aa99', '#aaaa11','#6633cc','#e67300','#8b0707', '#651067','#329262','#5574a6','#3b3eac', '#b77322','#16d620','#b91383','#f4359e', '#9c5935','#a9c413','#2a778d','#668d1c', '#bea413','#0c5922','#743411'); |
| 1681 | - // echo "<pre>"; var_dump($settings); echo "</pre>"; | |
| 1657 | + | |
| 1682 | 1658 | // Width |
| 1683 | 1659 | $settings['width'] = isset( $settings['width'] ) && $settings['width'] != '' ? esc_attr( $settings['width'] ) : '100'; |
| 1684 | 1660 | $settings['width_format'] = isset( $settings['width_format'] ) && $settings['width_format'] != '' ? esc_attr( $settings['width_format'] ) : '%'; |
| 1685 | 1661 | $settings['chart_width'] = $settings['width'].$settings['width_format']; |
| @@ -1684,10 +1660,10 @@ | ||
| 1684 | 1660 | $settings['width_format'] = isset( $settings['width_format'] ) && $settings['width_format'] != '' ? esc_attr( $settings['width_format'] ) : '%'; |
| 1685 | 1661 | $settings['chart_width'] = $settings['width'].$settings['width_format']; |
| 1686 | 1662 | |
| 1687 | 1663 | // height |
| 1688 | - $settings['height'] = isset( $settings['height'] ) && $settings['height'] != '' ? esc_attr( $settings['height'] ) : '100'; | |
| 1689 | - $settings['height_format'] = isset( $settings['height_format'] ) && $settings['height_format'] != '' ? esc_attr( $settings['height_format'] ) : '%'; | |
| 1664 | + $settings['height'] = isset( $settings['height'] ) && $settings['height'] != '' ? esc_attr( $settings['height'] ) : '400'; | |
| 1665 | + $settings['height_format'] = isset( $settings['height_format'] ) && $settings['height_format'] != '' ? esc_attr( $settings['height_format'] ) : 'px'; | |
| 1690 | 1666 | $settings['chart_height'] = $settings['height'].$settings['height_format']; |
| 1691 | 1667 | |
| 1692 | 1668 | // Show chart description |
| 1693 | 1669 | $settings['show_description'] = isset( $settings['show_description'] ) && $settings['show_description'] != '' ? esc_attr( $settings['show_description'] ) : 'on'; |
| @@ -1822,11 +1798,8 @@ | ||
| 1822 | 1798 | $settings['slice_color'] = isset( $settings['slice_color'] ) && $settings['slice_color'] != '' ? json_decode($settings['slice_color'], true) : $chart_default_colors; |
| 1823 | 1799 | |
| 1824 | 1800 | // Slice border color |
| 1825 | 1801 | $settings['slice_border_color'] = isset( $settings['slice_border_color'] ) && $settings['slice_border_color'] != '' ? esc_attr( $settings['slice_border_color'] ) : '#ffffff'; |
| 1826 | - | |
| 1827 | - // Slice border color | |
| 1828 | - $settings['slices_border_color'] = isset( $settings['slices_border_color'] ) && $settings['slices_border_color'] != '' ? json_decode($settings['slices_border_color'], true) : array_fill(0, $count_slices, $settings['slice_border_color']); | |
| 1829 | 1802 | |
| 1830 | 1803 | // Slices border width |
| 1831 | 1804 | $settings['slice_border_width'] = isset( $settings['slice_border_width'] ) && $settings['slice_border_width'] != '' ? esc_attr( $settings['slice_border_width'] ) : '1'; |
| 1832 | 1805 | |
| @@ -1832,19 +1805,8 @@ | ||
| 1832 | 1805 | |
| 1833 | 1806 | // Tooltip text color |
| 1834 | 1807 | $settings['tooltip_text_color'] = isset( $settings['tooltip_text_color'] ) && $settings['tooltip_text_color'] != '' ? esc_attr( $settings['tooltip_text_color'] ) : '#fff'; |
| 1835 | 1808 | |
| 1836 | - // Tooltip font size | |
| 1837 | - $settings['tooltip_font_size'] = isset( $settings['tooltip_font_size'] ) && intval($settings['tooltip_font_size']) > 0 ? esc_attr( $settings['tooltip_font_size'] ) : 12; | |
| 1838 | - | |
| 1839 | - // Show color code | |
| 1840 | - $settings['show_color_code'] = isset( $settings['show_color_code'] ) && $settings['show_color_code'] != '' ? esc_attr( $settings['show_color_code'] ) : 'off'; | |
| 1841 | - $settings['show_color_code'] = isset( $settings['show_color_code'] ) && $settings['show_color_code'] == 'on' ? 'checked' : ''; | |
| 1842 | - | |
| 1843 | - // Tooltip Italic text | |
| 1844 | - $settings['tooltip_italic'] = ( isset( $settings['tooltip_italic'] ) && $settings['tooltip_italic'] != '' ) ? $settings['tooltip_italic'] : 'off'; | |
| 1845 | - //$settings['tooltip_italic'] = isset( $settings['tooltip_italic'] ) && $settings['tooltip_italic'] == 'checked' ? 'italic' : 'normal'; | |
| 1846 | - $settings['tooltip_italic'] = ( isset( $settings['tooltip_italic'] ) && ($settings['tooltip_italic'] == 'checked' || $settings['tooltip_italic'] == 'on') ) ? 'italic' : 'normal'; | |
| 1847 | 1809 | // Legend font color |
| 1848 | 1810 | $settings['legend_color'] = isset( $settings['legend_color'] ) && $settings['legend_color'] != '' ? esc_attr( $settings['legend_color'] ) : '#000000'; |
| 1849 | 1811 | |
| 1850 | 1812 | // Legend font size |