|
| 1 | +diff --git a/vendor/magento/module-backend/Block/Dashboard/Graph.php b/vendor/magento/module-backend/Block/Dashboard/Graph.php |
| 2 | +index 8e238ccab44c..71a6cf4e938f 100644 |
| 3 | +--- a/vendor/magento/module-backend/Block/Dashboard/Graph.php |
| 4 | ++++ b/vendor/magento/module-backend/Block/Dashboard/Graph.php |
| 5 | +@@ -15,7 +15,7 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard |
| 6 | + /** |
| 7 | + * Api URL |
| 8 | + */ |
| 9 | +- const API_URL = 'http://chart.apis.google.com/chart'; |
| 10 | ++ const API_URL = 'https://image-charts.com/chart'; |
| 11 | + |
| 12 | + /** |
| 13 | + * All series |
| 14 | +@@ -76,6 +76,7 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard |
| 15 | + /** |
| 16 | + * Google chart api data encoding |
| 17 | + * |
| 18 | ++ * @deprecated since the Google Image Charts API not accessible from March 14, 2019 |
| 19 | + * @var string |
| 20 | + */ |
| 21 | + protected $_encoding = 'e'; |
| 22 | +@@ -187,11 +188,12 @@ public function getChartUrl($directUrl = true) |
| 23 | + { |
| 24 | + $params = [ |
| 25 | + 'cht' => 'lc', |
| 26 | +- 'chf' => 'bg,s,ffffff', |
| 27 | +- 'chco' => 'ef672f', |
| 28 | + 'chls' => '7', |
| 29 | +- 'chxs' => '0,676056,15,0,l,676056|1,676056,15,0,l,676056', |
| 30 | +- 'chm' => 'h,f2ebde,0,0:1:.1,1,-1', |
| 31 | ++ 'chf' => 'bg,s,f4f4f4|c,lg,90,ffffff,0.1,ededed,0', |
| 32 | ++ 'chm' => 'B,f4d4b2,0,0,0', |
| 33 | ++ 'chco' => 'db4814', |
| 34 | ++ 'chxs' => '0,0,11|1,0,11', |
| 35 | ++ 'chma' => '15,15,15,15' |
| 36 | + ]; |
| 37 | + |
| 38 | + $this->_allSeries = $this->getRowsData($this->_dataRows); |
| 39 | +@@ -279,20 +281,11 @@ public function getChartUrl($directUrl = true) |
| 40 | + $this->_axisLabels['x'] = $dates; |
| 41 | + $this->_allSeries = $datas; |
| 42 | + |
| 43 | +- //Google encoding values |
| 44 | +- if ($this->_encoding == "s") { |
| 45 | +- // simple encoding |
| 46 | +- $params['chd'] = "s:"; |
| 47 | +- $dataDelimiter = ""; |
| 48 | +- $dataSetdelimiter = ","; |
| 49 | +- $dataMissing = "_"; |
| 50 | +- } else { |
| 51 | +- // extended encoding |
| 52 | +- $params['chd'] = "e:"; |
| 53 | +- $dataDelimiter = ""; |
| 54 | +- $dataSetdelimiter = ","; |
| 55 | +- $dataMissing = "__"; |
| 56 | +- } |
| 57 | ++ // Image-Charts Awesome data format values |
| 58 | ++ $params['chd'] = "a:"; |
| 59 | ++ $dataDelimiter = ","; |
| 60 | ++ $dataSetdelimiter = "|"; |
| 61 | ++ $dataMissing = "_"; |
| 62 | + |
| 63 | + // process each string in the array, and find the max length |
| 64 | + $localmaxvalue = [0]; |
| 65 | +@@ -306,7 +299,6 @@ public function getChartUrl($directUrl = true) |
| 66 | + $minvalue = min($localminvalue); |
| 67 | + |
| 68 | + // default values |
| 69 | +- $yrange = 0; |
| 70 | + $yLabels = []; |
| 71 | + $miny = 0; |
| 72 | + $maxy = 0; |
| 73 | +@@ -321,7 +313,6 @@ public function getChartUrl($directUrl = true) |
| 74 | + $maxy = ceil($maxvalue + 1); |
| 75 | + $yLabels = range($miny, $maxy, 1); |
| 76 | + } |
| 77 | +- $yrange = $maxy; |
| 78 | + $yorigin = 0; |
| 79 | + } |
| 80 | + |
| 81 | +@@ -329,44 +320,13 @@ public function getChartUrl($directUrl = true) |
| 82 | + |
| 83 | + foreach ($this->getAllSeries() as $index => $serie) { |
| 84 | + $thisdataarray = $serie; |
| 85 | +- if ($this->_encoding == "s") { |
| 86 | +- // SIMPLE ENCODING |
| 87 | +- for ($j = 0; $j < sizeof($thisdataarray); $j++) { |
| 88 | +- $currentvalue = $thisdataarray[$j]; |
| 89 | +- if (is_numeric($currentvalue)) { |
| 90 | +- $ylocation = round( |
| 91 | +- (strlen($this->_simpleEncoding) - 1) * ($yorigin + $currentvalue) / $yrange |
| 92 | +- ); |
| 93 | +- $chartdata[] = substr($this->_simpleEncoding, $ylocation, 1) . $dataDelimiter; |
| 94 | +- } else { |
| 95 | +- $chartdata[] = $dataMissing . $dataDelimiter; |
| 96 | +- } |
| 97 | +- } |
| 98 | +- } else { |
| 99 | +- // EXTENDED ENCODING |
| 100 | +- for ($j = 0; $j < sizeof($thisdataarray); $j++) { |
| 101 | +- $currentvalue = $thisdataarray[$j]; |
| 102 | +- if (is_numeric($currentvalue)) { |
| 103 | +- if ($yrange) { |
| 104 | +- $ylocation = 4095 * ($yorigin + $currentvalue) / $yrange; |
| 105 | +- } else { |
| 106 | +- $ylocation = 0; |
| 107 | +- } |
| 108 | +- $firstchar = floor($ylocation / 64); |
| 109 | +- $secondchar = $ylocation % 64; |
| 110 | +- $mappedchar = substr( |
| 111 | +- $this->_extendedEncoding, |
| 112 | +- $firstchar, |
| 113 | +- 1 |
| 114 | +- ) . substr( |
| 115 | +- $this->_extendedEncoding, |
| 116 | +- $secondchar, |
| 117 | +- 1 |
| 118 | +- ); |
| 119 | +- $chartdata[] = $mappedchar . $dataDelimiter; |
| 120 | +- } else { |
| 121 | +- $chartdata[] = $dataMissing . $dataDelimiter; |
| 122 | +- } |
| 123 | ++ for ($j = 0; $j < sizeof($thisdataarray); $j++) { |
| 124 | ++ $currentvalue = $thisdataarray[$j]; |
| 125 | ++ if (is_numeric($currentvalue)) { |
| 126 | ++ $ylocation = $yorigin + $currentvalue; |
| 127 | ++ $chartdata[] = $ylocation . $dataDelimiter; |
| 128 | ++ } else { |
| 129 | ++ $chartdata[] = $dataMissing . $dataDelimiter; |
| 130 | + } |
| 131 | + } |
| 132 | + $chartdata[] = $dataSetdelimiter; |
| 133 | +@@ -540,6 +500,8 @@ protected function getHeight() |
| 134 | + } |
| 135 | + |
| 136 | + /** |
| 137 | ++ * Sets data helper |
| 138 | ++ * |
| 139 | + * @param \Magento\Backend\Helper\Dashboard\AbstractDashboard $dataHelper |
| 140 | + * @return void |
| 141 | + */ |
0 commit comments