You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

453 lines
13 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. 'use strict';
  2. $(document).ready(function() {
  3. var ctx = document.getElementById('update-chart-1').getContext("2d");
  4. var myChart = new Chart(ctx, {
  5. type: 'bar',
  6. data: valincome('#fff', [25, 30, 20, 15, 20], '#fff'),
  7. options: valincomebuildoption(),
  8. });
  9. var ctx = document.getElementById('update-chart-2').getContext("2d");
  10. var myChart = new Chart(ctx, {
  11. type: 'bar',
  12. data: valincome('#fff', [10, 30, 20, 15, 30], '#fff'),
  13. options: valincomebuildoption(),
  14. });
  15. var ctx = document.getElementById('update-chart-3').getContext("2d");
  16. var myChart = new Chart(ctx, {
  17. type: 'bar',
  18. data: valincome('#fff', [25, 10, 20, 15, 20], '#fff'),
  19. options: valincomebuildoption(),
  20. });
  21. var ctx = document.getElementById('update-chart-4').getContext("2d");
  22. var myChart = new Chart(ctx, {
  23. type: 'bar',
  24. data: valincome('#fff', [25, 30, 20, 15, 10], '#fff'),
  25. options: valincomebuildoption(),
  26. });
  27. function valincome(a, b, f) {
  28. if (f == null) {
  29. f = "rgba(0,0,0,0)";
  30. }
  31. return {
  32. labels: ["1", "2", "3", "4", "5"],
  33. datasets: [{
  34. label: "",
  35. borderColor: a,
  36. borderWidth: 0,
  37. hitRadius: 30,
  38. pointRadius: 0,
  39. pointHoverRadius: 4,
  40. pointBorderWidth: 2,
  41. pointHoverBorderWidth: 12,
  42. pointBackgroundColor: Chart.helpers.color("#000000").alpha(0).rgbString(),
  43. pointBorderColor: a,
  44. pointHoverBackgroundColor: a,
  45. pointHoverBorderColor: Chart.helpers.color("#000000").alpha(.1).rgbString(),
  46. fill: true,
  47. backgroundColor: Chart.helpers.color(f).alpha(1).rgbString(),
  48. data: b,
  49. }]
  50. };
  51. }
  52. function valincomebuildoption() {
  53. return {
  54. maintainAspectRatio: false,
  55. title: {
  56. display: false,
  57. },
  58. tooltips: {
  59. enabled: false,
  60. },
  61. legend: {
  62. display: false
  63. },
  64. hover: {
  65. mode: 'index'
  66. },
  67. scales: {
  68. xAxes: [{
  69. display: false,
  70. gridLines: false,
  71. scaleLabel: {
  72. display: true,
  73. labelString: 'Month'
  74. }
  75. }],
  76. yAxes: [{
  77. display: false,
  78. gridLines: false,
  79. scaleLabel: {
  80. display: true,
  81. labelString: 'Value'
  82. },
  83. ticks: {
  84. min: 1,
  85. }
  86. }]
  87. },
  88. elements: {
  89. point: {
  90. radius: 4,
  91. borderWidth: 12
  92. }
  93. },
  94. layout: {
  95. padding: {
  96. left: 10,
  97. right: 0,
  98. top: 15,
  99. bottom: 0
  100. }
  101. }
  102. };
  103. }
  104. $(function() {
  105. var amchart = AmCharts.makeChart("sales-analytics", {
  106. "type": "serial",
  107. "theme": "light",
  108. "marginTop": 0,
  109. "marginRight": 0,
  110. "dataProvider": [{
  111. "year": "1950",
  112. "value": -0.307
  113. }, {
  114. "year": "1951",
  115. "value": -0.168
  116. }, {
  117. "year": "1952",
  118. "value": -0.073
  119. }, {
  120. "year": "1953",
  121. "value": -0.027
  122. }, {
  123. "year": "1954",
  124. "value": -0.251
  125. }, {
  126. "year": "1955",
  127. "value": -0.281
  128. }, {
  129. "year": "1956",
  130. "value": -0.348
  131. }, {
  132. "year": "1957",
  133. "value": -0.074
  134. }, {
  135. "year": "1958",
  136. "value": -0.011
  137. }, {
  138. "year": "1959",
  139. "value": -0.074
  140. }, {
  141. "year": "1960",
  142. "value": -0.124
  143. }, {
  144. "year": "1961",
  145. "value": -0.024
  146. }, {
  147. "year": "1962",
  148. "value": -0.022
  149. }, {
  150. "year": "1963",
  151. "value": 0
  152. }, {
  153. "year": "1964",
  154. "value": -0.296
  155. }, {
  156. "year": "1965",
  157. "value": -0.217
  158. }, {
  159. "year": "1966",
  160. "value": -0.147
  161. }, {
  162. "year": "1967",
  163. "value": -0.15
  164. }, {
  165. "year": "1968",
  166. "value": -0.16
  167. }, {
  168. "year": "1969",
  169. "value": -0.011
  170. }, {
  171. "year": "1970",
  172. "value": -0.068
  173. }, {
  174. "year": "1971",
  175. "value": -0.19
  176. }, {
  177. "year": "1972",
  178. "value": -0.056
  179. }, {
  180. "year": "1973",
  181. "value": 0.077
  182. }, {
  183. "year": "1974",
  184. "value": -0.213
  185. }, {
  186. "year": "1975",
  187. "value": -0.17
  188. }, {
  189. "year": "1976",
  190. "value": -0.254
  191. }, {
  192. "year": "1977",
  193. "value": 0.019
  194. }, {
  195. "year": "1978",
  196. "value": -0.063
  197. }, {
  198. "year": "1979",
  199. "value": 0.05
  200. }, {
  201. "year": "1980",
  202. "value": 0.077
  203. }, {
  204. "year": "1981",
  205. "value": 0.12
  206. }, {
  207. "year": "1982",
  208. "value": 0.011
  209. }, {
  210. "year": "1983",
  211. "value": 0.177
  212. }, {
  213. "year": "1984",
  214. "value": -0.021
  215. }, {
  216. "year": "1985",
  217. "value": -0.037
  218. }, {
  219. "year": "1986",
  220. "value": 0.03
  221. }, {
  222. "year": "1987",
  223. "value": 0.179
  224. }, {
  225. "year": "1988",
  226. "value": 0.18
  227. }, {
  228. "year": "1989",
  229. "value": 0.104
  230. }, {
  231. "year": "1990",
  232. "value": 0.255
  233. }, {
  234. "year": "1991",
  235. "value": 0.21
  236. }, {
  237. "year": "1992",
  238. "value": 0.065
  239. }, {
  240. "year": "1993",
  241. "value": 0.11
  242. }, {
  243. "year": "1994",
  244. "value": 0.172
  245. }, {
  246. "year": "1995",
  247. "value": 0.269
  248. }, {
  249. "year": "1996",
  250. "value": 0.141
  251. }, {
  252. "year": "1997",
  253. "value": 0.353
  254. }, {
  255. "year": "1998",
  256. "value": 0.548
  257. }, {
  258. "year": "1999",
  259. "value": 0.298
  260. }, {
  261. "year": "2000",
  262. "value": 0.267
  263. }, {
  264. "year": "2001",
  265. "value": 0.411
  266. }, {
  267. "year": "2002",
  268. "value": 0.462
  269. }, {
  270. "year": "2003",
  271. "value": 0.47
  272. }, {
  273. "year": "2004",
  274. "value": 0.445
  275. }, {
  276. "year": "2005",
  277. "value": 0.47
  278. }],
  279. "valueAxes": [{
  280. "axisAlpha": 0,
  281. "gridAlpha": 0,
  282. "position": "left"
  283. }],
  284. "graphs": [{
  285. "id": "g1",
  286. "balloonText": "[[category]]<br><b><span style='font-size:14px;'>[[value]]</span></b>",
  287. "bullet": "round",
  288. "bulletSize": 8,
  289. "lineColor": "#fe5d70",
  290. "lineThickness": 2,
  291. "negativeLineColor": "#fe9365",
  292. "type": "smoothedLine",
  293. "valueField": "value"
  294. }],
  295. "chartScrollbar": {
  296. "graph": "g1",
  297. "gridAlpha": 0,
  298. "color": "#888888",
  299. "scrollbarHeight": 55,
  300. "backgroundAlpha": 0,
  301. "selectedBackgroundAlpha": 0.1,
  302. "selectedBackgroundColor": "#888888",
  303. "graphFillAlpha": 0,
  304. "autoGridCount": true,
  305. "selectedGraphFillAlpha": 0,
  306. "graphLineAlpha": 0.2,
  307. "graphLineColor": "#c2c2c2",
  308. "selectedGraphLineColor": "#888888",
  309. "selectedGraphLineAlpha": 1
  310. },
  311. "chartCursor": {
  312. "categoryBalloonDateFormat": "YYYY",
  313. "cursorAlpha": 0,
  314. "valueLineEnabled": true,
  315. "valueLineBalloonEnabled": true,
  316. "valueLineAlpha": 0.5,
  317. "fullWidth": true
  318. },
  319. "dataDateFormat": "YYYY",
  320. "categoryField": "year",
  321. "categoryAxis": {
  322. "minPeriod": "YYYY",
  323. "parseDates": true,
  324. "gridAlpha": 0,
  325. "minorGridAlpha": 0,
  326. "minorGridEnabled": true
  327. },
  328. "export": {
  329. "enabled": true
  330. }
  331. });
  332. amchart.addListener("rendered", zoomChart);
  333. if (amchart.zoomChart) {
  334. amchart.zoomChart();
  335. }
  336. function zoomChart() {
  337. amchart.zoomToIndexes(Math.round(amchart.dataProvider.length * 0.4), Math.round(amchart.dataProvider.length * 0.55));
  338. }
  339. });
  340. var ctx = document.getElementById('app-sale1').getContext("2d");
  341. var myChart = new Chart(ctx, {
  342. type: 'line',
  343. data: amuntchart('#11c15b', [1, 15, 30, 15, 25, 35, 45, 20, 25, 30], 'transparent'),
  344. options: buildchartoption(),
  345. });
  346. var ctx = document.getElementById('app-sale2').getContext("2d");
  347. var myChart = new Chart(ctx, {
  348. type: 'line',
  349. data: amuntchart('#448aff', [45, 30, 25, 35, 20, 35, 45, 20, 25, 1], 'transparent'),
  350. options: buildchartoption(),
  351. });
  352. var ctx = document.getElementById('app-sale3').getContext("2d");
  353. var myChart = new Chart(ctx, {
  354. type: 'line',
  355. data: amuntchart('#ff5252', [1, 45, 24, 40, 20, 35, 10, 20, 45, 30], 'transparent'),
  356. options: buildchartoption(),
  357. });
  358. var ctx = document.getElementById('app-sale4').getContext("2d");
  359. var myChart = new Chart(ctx, {
  360. type: 'line',
  361. data: amuntchart('#536dfe', [1, 15, 45, 15, 25, 35, 45, 20, 25, 30], 'transparent'),
  362. options: buildchartoption(),
  363. });
  364. function amuntchart(a, b, f) {
  365. if (f == null) {
  366. f = "rgba(0,0,0,0)";
  367. }
  368. return {
  369. labels: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October"],
  370. datasets: [{
  371. label: "",
  372. borderColor: a,
  373. borderWidth: 2,
  374. hitRadius: 30,
  375. pointHoverRadius: 4,
  376. pointBorderWidth: 50,
  377. pointHoverBorderWidth: 12,
  378. pointBackgroundColor: Chart.helpers.color("#000000").alpha(0).rgbString(),
  379. pointBorderColor: Chart.helpers.color("#000000").alpha(0).rgbString(),
  380. pointHoverBackgroundColor: a,
  381. pointHoverBorderColor: Chart.helpers.color("#000000").alpha(.1).rgbString(),
  382. fill: true,
  383. backgroundColor: f,
  384. data: b,
  385. }]
  386. };
  387. }
  388. function buildchartoption() {
  389. return {
  390. maintainAspectRatio: false,
  391. title: {
  392. display: !1
  393. },
  394. tooltips: {
  395. enabled: false,
  396. },
  397. legend: {
  398. display: !1,
  399. labels: {
  400. usePointStyle: !1
  401. }
  402. },
  403. responsive: !0,
  404. maintainAspectRatio: !0,
  405. hover: {
  406. mode: "index"
  407. },
  408. scales: {
  409. xAxes: [{
  410. display: !1,
  411. gridLines: !1,
  412. scaleLabel: {
  413. display: !0,
  414. labelString: "Month"
  415. }
  416. }],
  417. yAxes: [{
  418. display: !1,
  419. gridLines: !1,
  420. scaleLabel: {
  421. display: !0,
  422. labelString: "Value"
  423. },
  424. ticks: {
  425. beginAtZero: !0
  426. }
  427. }]
  428. },
  429. elements: {
  430. point: {
  431. radius: 4,
  432. borderWidth: 12
  433. }
  434. },
  435. layout: {
  436. padding: {
  437. left: 0,
  438. right: 0,
  439. top: 5,
  440. bottom: 0
  441. }
  442. }
  443. };
  444. }
  445. });