|
| 1 | +diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php |
| 2 | +index d402b7512dd..8f58e873b46 100644 |
| 3 | +--- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php |
| 4 | ++++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php |
| 5 | +@@ -19,7 +19,7 @@ class Mage_Adminhtml_Block_Dashboard_Graph extends Mage_Adminhtml_Block_Dashboar |
| 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 | +@@ -80,6 +80,8 @@ class Mage_Adminhtml_Block_Dashboard_Graph extends Mage_Adminhtml_Block_Dashboar |
| 15 | + /** |
| 16 | + * Google chart api data encoding |
| 17 | + * |
| 18 | ++ * @deprecated since the Google Image Charts API not accessible from March 14, 2019 |
| 19 | ++ * |
| 20 | + * @var string |
| 21 | + */ |
| 22 | + protected $_encoding = 'e'; |
| 23 | +@@ -172,7 +174,9 @@ public function getChartUrl($directUrl = true) |
| 24 | + 'cht' => 'lc', |
| 25 | + 'chf' => 'bg,s,f4f4f4|c,lg,90,ffffff,0.1,ededed,0', |
| 26 | + 'chm' => 'B,f4d4b2,0,0,0', |
| 27 | +- 'chco' => 'db4814' |
| 28 | ++ 'chco' => 'db4814', |
| 29 | ++ 'chxs' => '0,0,11|1,0,11', |
| 30 | ++ 'chma' => '15,15,15,15' |
| 31 | + ); |
| 32 | + |
| 33 | + $this->_allSeries = $this->getRowsData($this->_dataRows); |
| 34 | +@@ -246,20 +250,11 @@ public function getChartUrl($directUrl = true) |
| 35 | + $this->_axisLabels['x'] = $dates; |
| 36 | + $this->_allSeries = $datas; |
| 37 | + |
| 38 | +- //Google encoding values |
| 39 | +- if ($this->_encoding == "s") { |
| 40 | +- // simple encoding |
| 41 | +- $params['chd'] = "s:"; |
| 42 | +- $dataDelimiter = ""; |
| 43 | +- $dataSetdelimiter = ","; |
| 44 | +- $dataMissing = "_"; |
| 45 | +- } else { |
| 46 | +- // extended encoding |
| 47 | +- $params['chd'] = "e:"; |
| 48 | +- $dataDelimiter = ""; |
| 49 | +- $dataSetdelimiter = ","; |
| 50 | +- $dataMissing = "__"; |
| 51 | +- } |
| 52 | ++ // Image-Charts Awesome data format values |
| 53 | ++ $params['chd'] = "a:"; |
| 54 | ++ $dataDelimiter = ","; |
| 55 | ++ $dataSetdelimiter = "|"; |
| 56 | ++ $dataMissing = "_"; |
| 57 | + |
| 58 | + // process each string in the array, and find the max length |
| 59 | + foreach ($this->getAllSeries() as $index => $serie) { |
| 60 | +@@ -305,38 +300,14 @@ public function getChartUrl($directUrl = true) |
| 61 | + |
| 62 | + foreach ($this->getAllSeries() as $index => $serie) { |
| 63 | + $thisdataarray = $serie; |
| 64 | +- if ($this->_encoding == "s") { |
| 65 | +- // SIMPLE ENCODING |
| 66 | +- for ($j = 0; $j < sizeof($thisdataarray); $j++) { |
| 67 | +- $currentvalue = $thisdataarray[$j]; |
| 68 | +- if (is_numeric($currentvalue)) { |
| 69 | +- $ylocation = round((strlen($this->_simpleEncoding)-1) * ($yorigin + $currentvalue) / $yrange); |
| 70 | +- array_push($chartdata, substr($this->_simpleEncoding, $ylocation, 1) . $dataDelimiter); |
| 71 | +- } else { |
| 72 | +- array_push($chartdata, $dataMissing . $dataDelimiter); |
| 73 | +- } |
| 74 | +- } |
| 75 | +- // END SIMPLE ENCODING |
| 76 | +- } else { |
| 77 | +- // EXTENDED ENCODING |
| 78 | +- for ($j = 0; $j < sizeof($thisdataarray); $j++) { |
| 79 | +- $currentvalue = $thisdataarray[$j]; |
| 80 | +- if (is_numeric($currentvalue)) { |
| 81 | +- if ($yrange) { |
| 82 | +- $ylocation = (4095 * ($yorigin + $currentvalue) / $yrange); |
| 83 | +- } else { |
| 84 | +- $ylocation = 0; |
| 85 | +- } |
| 86 | +- $firstchar = floor($ylocation / 64); |
| 87 | +- $secondchar = $ylocation % 64; |
| 88 | +- $mappedchar = substr($this->_extendedEncoding, $firstchar, 1) |
| 89 | +- . substr($this->_extendedEncoding, $secondchar, 1); |
| 90 | +- array_push($chartdata, $mappedchar . $dataDelimiter); |
| 91 | +- } else { |
| 92 | +- array_push($chartdata, $dataMissing . $dataDelimiter); |
| 93 | +- } |
| 94 | ++ for ($j = 0; $j < sizeof($thisdataarray); $j++) { |
| 95 | ++ $currentvalue = $thisdataarray[$j]; |
| 96 | ++ if (is_numeric($currentvalue)) { |
| 97 | ++ $ylocation = $yorigin + $currentvalue; |
| 98 | ++ array_push($chartdata, $ylocation . $dataDelimiter); |
| 99 | ++ } else { |
| 100 | ++ array_push($chartdata, $dataMissing . $dataDelimiter); |
| 101 | + } |
| 102 | +- // ============= END EXTENDED ENCODING ============= |
| 103 | + } |
| 104 | + array_push($chartdata, $dataSetdelimiter); |
| 105 | + } |
0 commit comments