-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMAGETWO-98833_composer_patch-2019-04-15-04-37-48.patch
153 lines (144 loc) · 6.08 KB
/
MAGETWO-98833_composer_patch-2019-04-15-04-37-48.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
diff --git a/vendor/magento/module-backend/Block/Dashboard/Graph.php b/vendor/magento/module-backend/Block/Dashboard/Graph.php
index 8e238ccab44c..71a6cf4e938f 100644
--- a/vendor/magento/module-backend/Block/Dashboard/Graph.php
+++ b/vendor/magento/module-backend/Block/Dashboard/Graph.php
@@ -15,7 +15,7 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard
/**
* Api URL
*/
- const API_URL = 'http://chart.apis.google.com/chart';
+ const API_URL = 'https://image-charts.com/chart';
/**
* All series
@@ -76,6 +76,7 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard
/**
* Google chart api data encoding
*
+ * @deprecated since the Google Image Charts API not accessible from March 14, 2019
* @var string
*/
protected $_encoding = 'e';
@@ -187,11 +188,12 @@ public function getChartUrl($directUrl = true)
{
$params = [
'cht' => 'lc',
- 'chf' => 'bg,s,ffffff',
- 'chco' => 'ef672f',
'chls' => '7',
- 'chxs' => '0,676056,15,0,l,676056|1,676056,15,0,l,676056',
- 'chm' => 'h,f2ebde,0,0:1:.1,1,-1',
+ 'chf' => 'bg,s,f4f4f4|c,lg,90,ffffff,0.1,ededed,0',
+ 'chm' => 'B,f4d4b2,0,0,0',
+ 'chco' => 'db4814',
+ 'chxs' => '0,0,11|1,0,11',
+ 'chma' => '15,15,15,15'
];
$this->_allSeries = $this->getRowsData($this->_dataRows);
@@ -279,20 +281,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
$localmaxvalue = [0];
@@ -306,7 +299,6 @@ public function getChartUrl($directUrl = true)
$minvalue = min($localminvalue);
// default values
- $yrange = 0;
$yLabels = [];
$miny = 0;
$maxy = 0;
@@ -321,7 +313,6 @@ public function getChartUrl($directUrl = true)
$maxy = ceil($maxvalue + 1);
$yLabels = range($miny, $maxy, 1);
}
- $yrange = $maxy;
$yorigin = 0;
}
@@ -329,44 +320,13 @@ 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
- );
- $chartdata[] = substr($this->_simpleEncoding, $ylocation, 1) . $dataDelimiter;
- } else {
- $chartdata[] = $dataMissing . $dataDelimiter;
- }
- }
- } 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
- );
- $chartdata[] = $mappedchar . $dataDelimiter;
- } else {
- $chartdata[] = $dataMissing . $dataDelimiter;
- }
+ for ($j = 0; $j < sizeof($thisdataarray); $j++) {
+ $currentvalue = $thisdataarray[$j];
+ if (is_numeric($currentvalue)) {
+ $ylocation = $yorigin + $currentvalue;
+ $chartdata[] = $ylocation . $dataDelimiter;
+ } else {
+ $chartdata[] = $dataMissing . $dataDelimiter;
}
}
$chartdata[] = $dataSetdelimiter;
@@ -540,6 +500,8 @@ protected function getHeight()
}
/**
+ * Sets data helper
+ *
* @param \Magento\Backend\Helper\Dashboard\AbstractDashboard $dataHelper
* @return void
*/
diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/GraphTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/GraphTest.php
index 17863cd70958..215fd85d3316 100644
--- a/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/GraphTest.php
+++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/GraphTest.php
@@ -27,6 +27,6 @@ protected function setUp()
public function testGetChartUrl()
{
- $this->assertStringStartsWith('http://chart.apis.google.com/chart', $this->_block->getChartUrl());
+ $this->assertStringStartsWith('https://image-charts.com/chart', $this->_block->getChartUrl());
}
}