echarts.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. $(function (e) {
  2. 'use strict'
  3. /*-----echart2-----*/
  4. var chartdata = [{
  5. name: 'sales',
  6. type: 'bar',
  7. data: [10, 15, 9, 18, 10, 15]
  8. }, {
  9. name: 'profit',
  10. type: 'line',
  11. smooth: true,
  12. data: [8, 5, 25, 10, 10]
  13. }, {
  14. name: 'growth',
  15. type: 'bar',
  16. data: [10, 14, 10, 15, 9, 25]
  17. }];
  18. var chart = document.getElementById('echart1');
  19. var barChart = echarts.init(chart);
  20. var option = {
  21. grid: {
  22. top: '6',
  23. right: '0',
  24. bottom: '17',
  25. left: '25',
  26. },
  27. xAxis: {
  28. data: ['2014', '2015', '2016', '2017', '2018'],
  29. axisLine: {
  30. lineStyle: {
  31. color: 'rgba(119, 119, 142, 0.2)'
  32. }
  33. },
  34. axisLabel: {
  35. fontSize: 10,
  36. color: '#9ba6b5'
  37. }
  38. },
  39. tooltip: {
  40. show: true,
  41. showContent: true,
  42. alwaysShowContent: true,
  43. triggerOn: 'mousemove',
  44. trigger: 'axis',
  45. axisPointer: {
  46. label: {
  47. show: false,
  48. }
  49. }
  50. },
  51. yAxis: {
  52. splitLine: {
  53. lineStyle: {
  54. color: 'rgba(119, 119, 142, 0.2)'
  55. }
  56. },
  57. axisLine: {
  58. lineStyle: {
  59. color: 'rgba(119, 119, 142, 0.2)'
  60. }
  61. },
  62. axisLabel: {
  63. fontSize: 10,
  64. color: '#9ba6b5'
  65. }
  66. },
  67. series: chartdata,
  68. color: ['#6c5ffc', '#09ad95', '#05c3fb',]
  69. };
  70. barChart.setOption(option);
  71. window.addEventListener('resize',function(){
  72. barChart.resize();
  73. })
  74. /*-----echart1-----*/
  75. var chartdata2 = [{
  76. name: 'sales',
  77. type: 'line',
  78. smooth: true,
  79. data: [12, 25, 12, 35, 12, 38],
  80. color: ['#6c5ffc']
  81. }, {
  82. name: 'Profit',
  83. type: 'line',
  84. smooth: true,
  85. size: 10,
  86. data: [8, 12, 28, 10, 10, 12],
  87. color: ['#05c3fb']
  88. }];
  89. var chart2 = document.getElementById('echart2');
  90. var barChart2 = echarts.init(chart2);
  91. var option2 = {
  92. grid: {
  93. top: '6',
  94. right: '0',
  95. bottom: '17',
  96. left: '25',
  97. },
  98. xAxis: {
  99. data: ['2014', '2015', '2016', '2017', '2018'],
  100. axisLine: {
  101. lineStyle: {
  102. color: 'rgba(119, 119, 142, 0.2)'
  103. }
  104. },
  105. axisLabel: {
  106. fontSize: 10,
  107. color: '#9ba6b5'
  108. }
  109. },
  110. yAxis: {
  111. splitLine: {
  112. lineStyle: {
  113. color: 'rgba(119, 119, 142, 0.2)'
  114. }
  115. },
  116. axisLine: {
  117. lineStyle: {
  118. color: 'rgba(119, 119, 142, 0.2)'
  119. }
  120. },
  121. axisLabel: {
  122. fontSize: 10,
  123. color: '#9ba6b5'
  124. }
  125. },
  126. series: chartdata2
  127. };
  128. barChart2.setOption(option2);
  129. window.addEventListener('resize',function(){
  130. barChart2.resize();
  131. })
  132. /*-----echart3-----*/
  133. var option3 = {
  134. grid: {
  135. top: '6',
  136. right: '0',
  137. bottom: '17',
  138. left: '32',
  139. },
  140. xAxis: {
  141. type: 'value',
  142. axisLine: {
  143. lineStyle: {
  144. color: 'rgba(119, 119, 142, 0.2)'
  145. }
  146. },
  147. axisLabel: {
  148. fontSize: 10,
  149. color: '#9ba6b5'
  150. }
  151. },
  152. yAxis: {
  153. type: 'category',
  154. data: ['2014', '2015', '2016', '2017', '2018'],
  155. splitLine: {
  156. lineStyle: {
  157. color: 'rgba(119, 119, 142, 0.2)'
  158. }
  159. },
  160. axisLine: {
  161. lineStyle: {
  162. color: '#c0dfd8'
  163. }
  164. },
  165. axisLabel: {
  166. fontSize: 10,
  167. color: '#9ba6b5'
  168. }
  169. },
  170. series: chartdata,
  171. color: ['#6c5ffc', '#09ad95', '#05c3fb',]
  172. };
  173. var chart3 = document.getElementById('echart3');
  174. var barChart3 = echarts.init(chart3);
  175. barChart3.setOption(option3);
  176. window.addEventListener('resize',function(){
  177. barChart3.resize();
  178. })
  179. /*-----echart4-----*/
  180. var option4 = {
  181. grid: {
  182. top: '6',
  183. right: '0',
  184. bottom: '17',
  185. left: '32',
  186. },
  187. xAxis: {
  188. type: 'value',
  189. axisLine: {
  190. lineStyle: {
  191. color: 'rgba(119, 119, 142, 0.2)'
  192. }
  193. },
  194. axisLabel: {
  195. fontSize: 10,
  196. color: '#9ba6b5'
  197. }
  198. },
  199. yAxis: {
  200. type: 'category',
  201. data: ['2014', '2015', '2016', '2017', '2018'],
  202. splitLine: {
  203. lineStyle: {
  204. color: 'rgba(119, 119, 142, 0.2)'
  205. }
  206. },
  207. axisLine: {
  208. lineStyle: {
  209. color: 'rgba(119, 119, 142, 0.2)'
  210. }
  211. },
  212. axisLabel: {
  213. fontSize: 10,
  214. color: '#9ba6b5'
  215. }
  216. },
  217. series: chartdata2,
  218. color: ['#1170e4', '#d43f8d', '#09ad95']
  219. };
  220. var chart4 = document.getElementById('echart4');
  221. var barChart4 = echarts.init(chart4);
  222. barChart4.setOption(option4);
  223. window.addEventListener('resize',function(){
  224. barChart4.resize();
  225. })
  226. /*-----echart5-----*/
  227. var chartdata3 = [{
  228. name: 'sales',
  229. type: 'bar',
  230. stack: 'Stack',
  231. data: [14, 18, 20, 14, 29, 21, 25, 14, 24]
  232. }, {
  233. name: 'Profit',
  234. type: 'bar',
  235. stack: 'Stack',
  236. data: [12, 14, 15, 50, 24, 24, 10, 20, 30]
  237. }];
  238. var option5 = {
  239. grid: {
  240. top: '6',
  241. right: '0',
  242. bottom: '17',
  243. left: '25',
  244. },
  245. xAxis: {
  246. data: ['2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018'],
  247. axisLine: {
  248. lineStyle: {
  249. color: 'rgba(119, 119, 142, 0.2)'
  250. }
  251. },
  252. axisLabel: {
  253. fontSize: 10,
  254. color: '#9ba6b5'
  255. }
  256. },
  257. yAxis: {
  258. splitLine: {
  259. lineStyle: {
  260. color: 'rgba(119, 119, 142, 0.2)'
  261. }
  262. },
  263. axisLine: {
  264. lineStyle: {
  265. color: 'rgba(119, 119, 142, 0.2)'
  266. }
  267. },
  268. axisLabel: {
  269. fontSize: 10,
  270. color: '#9ba6b5'
  271. }
  272. },
  273. series: chartdata3,
  274. color: ['#6c5ffc', '#05c3fb']
  275. };
  276. var chart5 = document.getElementById('echart5');
  277. var barChart5 = echarts.init(chart5);
  278. barChart5.setOption(option5);
  279. window.addEventListener('resize',function(){
  280. barChart5.resize();
  281. })
  282. /*-----echart6-----*/
  283. var option6 = {
  284. grid: {
  285. top: '6',
  286. right: '10',
  287. bottom: '17',
  288. left: '32',
  289. },
  290. xAxis: {
  291. type: 'value',
  292. axisLine: {
  293. lineStyle: {
  294. color: 'rgba(119, 119, 142, 0.2)'
  295. }
  296. },
  297. axisLabel: {
  298. fontSize: 10,
  299. color: '#9ba6b5'
  300. }
  301. },
  302. yAxis: {
  303. type: 'category',
  304. data: ['2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018'],
  305. splitLine: {
  306. lineStyle: {
  307. color: 'rgba(119, 119, 142, 0.2)'
  308. }
  309. },
  310. axisLine: {
  311. lineStyle: {
  312. color: 'rgba(119, 119, 142, 0.2)'
  313. }
  314. },
  315. axisLabel: {
  316. fontSize: 10,
  317. color: '#9ba6b5'
  318. }
  319. },
  320. series: chartdata3,
  321. color: ['#6c5ffc', '#05c3fb']
  322. };
  323. var chart6 = document.getElementById('echart6');
  324. var barChart6 = echarts.init(chart6);
  325. barChart6.setOption(option6);
  326. window.addEventListener('resize',function(){
  327. barChart6.resize();
  328. })
  329. /*-----echart7-----*/
  330. var chartdata4 = [{
  331. name: 'data',
  332. type: 'line',
  333. data: [20, 20, 36, 18, 15, 20, 25, 20]
  334. }];
  335. var option7 = {
  336. grid: {
  337. top: '6',
  338. right: '0',
  339. bottom: '17',
  340. left: '25',
  341. },
  342. xAxis: {
  343. data: ['2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018'],
  344. axisLine: {
  345. lineStyle: {
  346. color: 'rgba(119, 119, 142, 0.2)'
  347. }
  348. },
  349. axisLabel: {
  350. fontSize: 10,
  351. color: '#9ba6b5'
  352. }
  353. },
  354. yAxis: {
  355. splitLine: {
  356. lineStyle: {
  357. color: 'rgba(119, 119, 142, 0.2)'
  358. }
  359. },
  360. axisLine: {
  361. lineStyle: {
  362. color: 'rgba(119, 119, 142, 0.2)'
  363. }
  364. },
  365. axisLabel: {
  366. fontSize: 10,
  367. color: '#9ba6b5'
  368. }
  369. },
  370. series: chartdata4,
  371. color: ['#6c5ffc']
  372. };
  373. var chart7 = document.getElementById('echart7');
  374. var lineChart = echarts.init(chart7);
  375. lineChart.setOption(option7);
  376. window.addEventListener('resize',function(){
  377. lineChart.resize();
  378. })
  379. /*-----echart8-----*/
  380. var chartdata5 = [{
  381. name: 'data',
  382. type: 'line',
  383. smooth: true,
  384. data: [20, 20, 36, 18, 15, 20, 25, 20]
  385. }];
  386. var option8 = {
  387. grid: {
  388. top: '6',
  389. right: '0',
  390. bottom: '17',
  391. left: '25',
  392. },
  393. xAxis: {
  394. data: ['2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018'],
  395. axisLine: {
  396. lineStyle: {
  397. color: 'rgba(119, 119, 142, 0.2)'
  398. }
  399. },
  400. axisLabel: {
  401. fontSize: 10,
  402. color: '#9ba6b5'
  403. }
  404. },
  405. yAxis: {
  406. splitLine: {
  407. lineStyle: {
  408. color: 'rgba(119, 119, 142, 0.2)'
  409. }
  410. },
  411. axisLine: {
  412. lineStyle: {
  413. color: 'rgba(119, 119, 142, 0.2)'
  414. }
  415. },
  416. axisLabel: {
  417. fontSize: 10,
  418. color: '#9ba6b5'
  419. }
  420. },
  421. series: chartdata5,
  422. color: ['#05c3fb']
  423. };
  424. var chart8 = document.getElementById('echart8');
  425. var lineChart2 = echarts.init(chart8);
  426. lineChart2.setOption(option8);
  427. window.addEventListener('resize',function(){
  428. lineChart2.resize();
  429. })
  430. });