Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MPERF-10509.diff
diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
index d402b7512dd..8f58e873b46 100644
--- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
+++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
@@ -19,7 +19,7 @@ class Mage_Adminhtml_Block_Dashboard_Graph extends Mage_Adminhtml_Block_Dashboar
/**
* Api URL
*/
- const API_URL = 'http://chart.apis.google.com/chart';
+ const API_URL = 'https://image-charts.com/chart';
/**
* All series
@@ -80,6 +80,8 @@ class Mage_Adminhtml_Block_Dashboard_Graph extends Mage_Adminhtml_Block_Dashboar
/**
* Google chart api data encoding
*
+ * @deprecated since the Google Image Charts API not accessible from March 14, 2019
+ *
* @var string
*/
protected $_encoding = 'e';
@@ -172,7 +174,9 @@ public function getChartUrl($directUrl = true)
'cht' => 'lc',
'chf' => 'bg,s,f4f4f4|c,lg,90,ffffff,0.1,ededed,0',
'chm' => 'B,f4d4b2,0,0,0',
- 'chco' => 'db4814'
+ 'chco' => 'db4814',
+ 'chxs' => '0,0,11|1,0,11',
+ 'chma' => '15,15,15,15'
);
$this->_allSeries = $this->getRowsData($this->_dataRows);
@@ -246,20 +250,11 @@ public function getChartUrl($directUrl = true)
$this->_axisLabels['x'] = $dates;
$this->_allSeries = $datas;
- //Google encoding values
- if ($this->_encoding == "s") {
- // simple encoding
- $params['chd'] = "s:";
- $dataDelimiter = "";
- $dataSetdelimiter = ",";
- $dataMissing = "_";
- } else {
- // extended encoding
- $params['chd'] = "e:";
- $dataDelimiter = "";
- $dataSetdelimiter = ",";
- $dataMissing = "__";
- }
+ // Image-Charts Awesome data format values
+ $params['chd'] = "a:";
+ $dataDelimiter = ",";
+ $dataSetdelimiter = "|";
+ $dataMissing = "_";
// process each string in the array, and find the max length
foreach ($this->getAllSeries() as $index => $serie) {
@@ -305,38 +300,14 @@ public function getChartUrl($directUrl = true)
foreach ($this->getAllSeries() as $index => $serie) {
$thisdataarray = $serie;
- if ($this->_encoding == "s") {
- // SIMPLE ENCODING
- for ($j = 0; $j < sizeof($thisdataarray); $j++) {
- $currentvalue = $thisdataarray[$j];
- if (is_numeric($currentvalue)) {
- $ylocation = round((strlen($this->_simpleEncoding)-1) * ($yorigin + $currentvalue) / $yrange);
- array_push($chartdata, substr($this->_simpleEncoding, $ylocation, 1) . $dataDelimiter);
- } else {
- array_push($chartdata, $dataMissing . $dataDelimiter);
- }
- }
- // END SIMPLE ENCODING
- } else {
- // EXTENDED ENCODING
- for ($j = 0; $j < sizeof($thisdataarray); $j++) {
- $currentvalue = $thisdataarray[$j];
- if (is_numeric($currentvalue)) {
- if ($yrange) {
- $ylocation = (4095 * ($yorigin + $currentvalue) / $yrange);
- } else {
- $ylocation = 0;
- }
- $firstchar = floor($ylocation / 64);
- $secondchar = $ylocation % 64;
- $mappedchar = substr($this->_extendedEncoding, $firstchar, 1)
- . substr($this->_extendedEncoding, $secondchar, 1);
- array_push($chartdata, $mappedchar . $dataDelimiter);
- } else {
- array_push($chartdata, $dataMissing . $dataDelimiter);
- }
+ for ($j = 0; $j < sizeof($thisdataarray); $j++) {
+ $currentvalue = $thisdataarray[$j];
+ if (is_numeric($currentvalue)) {
+ $ylocation = $yorigin + $currentvalue;
+ array_push($chartdata, $ylocation . $dataDelimiter);
+ } else {
+ array_push($chartdata, $dataMissing . $dataDelimiter);
}
- // ============= END EXTENDED ENCODING =============
}
array_push($chartdata, $dataSetdelimiter);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.