echarts-demo.js 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160
  1. $(function () {
  2. var lineChart = echarts.init(document.getElementById("echarts-line-chart"));
  3. var lineoption = {
  4. title : {
  5. text: '未来一周气温变化'
  6. },
  7. tooltip : {
  8. trigger: 'axis'
  9. },
  10. legend: {
  11. data:['最高气温','最低气温']
  12. },
  13. grid:{
  14. x:40,
  15. x2:40,
  16. y2:24
  17. },
  18. calculable : true,
  19. xAxis : [
  20. {
  21. type : 'category',
  22. boundaryGap : false,
  23. data : ['周一','周二','周三','周四','周五','周六','周日']
  24. }
  25. ],
  26. yAxis : [
  27. {
  28. type : 'value',
  29. axisLabel : {
  30. formatter: '{value} °C'
  31. }
  32. }
  33. ],
  34. series : [
  35. {
  36. name:'最高气温',
  37. type:'line',
  38. data:[11, 11, 15, 13, 12, 13, 10],
  39. markPoint : {
  40. data : [
  41. {type : 'max', name: '最大值'},
  42. {type : 'min', name: '最小值'}
  43. ]
  44. },
  45. markLine : {
  46. data : [
  47. {type : 'average', name: '平均值'}
  48. ]
  49. }
  50. },
  51. {
  52. name:'最低气温',
  53. type:'line',
  54. data:[1, -2, 2, 5, 3, 2, 0],
  55. markPoint : {
  56. data : [
  57. {name : '周最低', value : -2, xAxis: 1, yAxis: -1.5}
  58. ]
  59. },
  60. markLine : {
  61. data : [
  62. {type : 'average', name : '平均值'}
  63. ]
  64. }
  65. }
  66. ]
  67. };
  68. lineChart.setOption(lineoption);
  69. $(window).resize(lineChart.resize);
  70. var barChart = echarts.init(document.getElementById("echarts-bar-chart"));
  71. var baroption = {
  72. title : {
  73. text: '某地区蒸发量和降水量'
  74. },
  75. tooltip : {
  76. trigger: 'axis'
  77. },
  78. legend: {
  79. data:['蒸发量','降水量']
  80. },
  81. grid:{
  82. x:30,
  83. x2:40,
  84. y2:24
  85. },
  86. calculable : true,
  87. xAxis : [
  88. {
  89. type : 'category',
  90. data : ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
  91. }
  92. ],
  93. yAxis : [
  94. {
  95. type : 'value'
  96. }
  97. ],
  98. series : [
  99. {
  100. name:'蒸发量',
  101. type:'bar',
  102. data:[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3],
  103. markPoint : {
  104. data : [
  105. {type : 'max', name: '最大值'},
  106. {type : 'min', name: '最小值'}
  107. ]
  108. },
  109. markLine : {
  110. data : [
  111. {type : 'average', name: '平均值'}
  112. ]
  113. }
  114. },
  115. {
  116. name:'降水量',
  117. type:'bar',
  118. data:[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3],
  119. markPoint : {
  120. data : [
  121. {name : '年最高', value : 182.2, xAxis: 7, yAxis: 183, symbolSize:18},
  122. {name : '年最低', value : 2.3, xAxis: 11, yAxis: 3}
  123. ]
  124. },
  125. markLine : {
  126. data : [
  127. {type : 'average', name : '平均值'}
  128. ]
  129. }
  130. }
  131. ]
  132. };
  133. barChart.setOption(baroption);
  134. window.onresize = barChart.resize;
  135. var scatterChart = echarts.init(document.getElementById("echarts-scatter-chart"));
  136. var scatteroption = {
  137. title : {
  138. text: '男性女性身高体重分布',
  139. subtext: '抽样调查来自: Heinz 2003'
  140. },
  141. tooltip : {
  142. trigger: 'axis',
  143. showDelay : 0,
  144. axisPointer:{
  145. type : 'cross',
  146. lineStyle: {
  147. type : 'dashed',
  148. width : 1
  149. }
  150. }
  151. },
  152. legend: {
  153. data:['女性','男性']
  154. },
  155. grid:{
  156. x:45,
  157. x2:40,
  158. y2:24
  159. },
  160. xAxis : [
  161. {
  162. type : 'value',
  163. scale:true,
  164. axisLabel : {
  165. formatter: '{value} cm'
  166. }
  167. }
  168. ],
  169. yAxis : [
  170. {
  171. type : 'value',
  172. scale:true,
  173. axisLabel : {
  174. formatter: '{value} kg'
  175. }
  176. }
  177. ],
  178. series : [
  179. {
  180. name:'女性',
  181. type:'scatter',
  182. tooltip : {
  183. trigger: 'item',
  184. formatter : function (params) {
  185. if (params.value.length > 1) {
  186. return params.seriesName + ' :<br/>'
  187. + params.value[0] + 'cm '
  188. + params.value[1] + 'kg ';
  189. }
  190. else {
  191. return params.seriesName + ' :<br/>'
  192. + params.name + ' : '
  193. + params.value + 'kg ';
  194. }
  195. }
  196. },
  197. data: [[161.2, 51.6], [167.5, 59.0], [159.5, 49.2], [157.0, 63.0], [155.8, 53.6],
  198. [170.0, 59.0], [159.1, 47.6], [166.0, 69.8], [176.2, 66.8], [160.2, 75.2],
  199. [172.5, 55.2], [170.9, 54.2], [172.9, 62.5], [153.4, 42.0], [160.0, 50.0],
  200. [147.2, 49.8], [168.2, 49.2], [175.0, 73.2], [157.0, 47.8], [167.6, 68.8],
  201. [159.5, 50.6], [175.0, 82.5], [166.8, 57.2], [176.5, 87.8], [170.2, 72.8],
  202. [174.0, 54.5], [173.0, 59.8], [179.9, 67.3], [170.5, 67.8], [160.0, 47.0],
  203. [154.4, 46.2], [162.0, 55.0], [176.5, 83.0], [160.0, 54.4], [152.0, 45.8],
  204. [162.1, 53.6], [170.0, 73.2], [160.2, 52.1], [161.3, 67.9], [166.4, 56.6],
  205. [168.9, 62.3], [163.8, 58.5], [167.6, 54.5], [160.0, 50.2], [161.3, 60.3],
  206. [167.6, 58.3], [165.1, 56.2], [160.0, 50.2], [170.0, 72.9], [157.5, 59.8],
  207. [167.6, 61.0], [160.7, 69.1], [163.2, 55.9], [152.4, 46.5], [157.5, 54.3],
  208. [168.3, 54.8], [180.3, 60.7], [165.5, 60.0], [165.0, 62.0], [164.5, 60.3],
  209. [156.0, 52.7], [160.0, 74.3], [163.0, 62.0], [165.7, 73.1], [161.0, 80.0],
  210. [162.0, 54.7], [166.0, 53.2], [174.0, 75.7], [172.7, 61.1], [167.6, 55.7],
  211. [151.1, 48.7], [164.5, 52.3], [163.5, 50.0], [152.0, 59.3], [169.0, 62.5],
  212. [164.0, 55.7], [161.2, 54.8], [155.0, 45.9], [170.0, 70.6], [176.2, 67.2],
  213. [170.0, 69.4], [162.5, 58.2], [170.3, 64.8], [164.1, 71.6], [169.5, 52.8],
  214. [163.2, 59.8], [154.5, 49.0], [159.8, 50.0], [173.2, 69.2], [170.0, 55.9],
  215. [161.4, 63.4], [169.0, 58.2], [166.2, 58.6], [159.4, 45.7], [162.5, 52.2],
  216. [159.0, 48.6], [162.8, 57.8], [159.0, 55.6], [179.8, 66.8], [162.9, 59.4],
  217. [161.0, 53.6], [151.1, 73.2], [168.2, 53.4], [168.9, 69.0], [173.2, 58.4],
  218. [171.8, 56.2], [178.0, 70.6], [164.3, 59.8], [163.0, 72.0], [168.5, 65.2],
  219. [166.8, 56.6], [172.7, 105.2], [163.5, 51.8], [169.4, 63.4], [167.8, 59.0],
  220. [159.5, 47.6], [167.6, 63.0], [161.2, 55.2], [160.0, 45.0], [163.2, 54.0],
  221. [162.2, 50.2], [161.3, 60.2], [149.5, 44.8], [157.5, 58.8], [163.2, 56.4],
  222. [172.7, 62.0], [155.0, 49.2], [156.5, 67.2], [164.0, 53.8], [160.9, 54.4],
  223. [162.8, 58.0], [167.0, 59.8], [160.0, 54.8], [160.0, 43.2], [168.9, 60.5],
  224. [158.2, 46.4], [156.0, 64.4], [160.0, 48.8], [167.1, 62.2], [158.0, 55.5],
  225. [167.6, 57.8], [156.0, 54.6], [162.1, 59.2], [173.4, 52.7], [159.8, 53.2],
  226. [170.5, 64.5], [159.2, 51.8], [157.5, 56.0], [161.3, 63.6], [162.6, 63.2],
  227. [160.0, 59.5], [168.9, 56.8], [165.1, 64.1], [162.6, 50.0], [165.1, 72.3],
  228. [166.4, 55.0], [160.0, 55.9], [152.4, 60.4], [170.2, 69.1], [162.6, 84.5],
  229. [170.2, 55.9], [158.8, 55.5], [172.7, 69.5], [167.6, 76.4], [162.6, 61.4],
  230. [167.6, 65.9], [156.2, 58.6], [175.2, 66.8], [172.1, 56.6], [162.6, 58.6],
  231. [160.0, 55.9], [165.1, 59.1], [182.9, 81.8], [166.4, 70.7], [165.1, 56.8],
  232. [177.8, 60.0], [165.1, 58.2], [175.3, 72.7], [154.9, 54.1], [158.8, 49.1],
  233. [172.7, 75.9], [168.9, 55.0], [161.3, 57.3], [167.6, 55.0], [165.1, 65.5],
  234. [175.3, 65.5], [157.5, 48.6], [163.8, 58.6], [167.6, 63.6], [165.1, 55.2],
  235. [165.1, 62.7], [168.9, 56.6], [162.6, 53.9], [164.5, 63.2], [176.5, 73.6],
  236. [168.9, 62.0], [175.3, 63.6], [159.4, 53.2], [160.0, 53.4], [170.2, 55.0],
  237. [162.6, 70.5], [167.6, 54.5], [162.6, 54.5], [160.7, 55.9], [160.0, 59.0],
  238. [157.5, 63.6], [162.6, 54.5], [152.4, 47.3], [170.2, 67.7], [165.1, 80.9],
  239. [172.7, 70.5], [165.1, 60.9], [170.2, 63.6], [170.2, 54.5], [170.2, 59.1],
  240. [161.3, 70.5], [167.6, 52.7], [167.6, 62.7], [165.1, 86.3], [162.6, 66.4],
  241. [152.4, 67.3], [168.9, 63.0], [170.2, 73.6], [175.2, 62.3], [175.2, 57.7],
  242. [160.0, 55.4], [165.1, 104.1], [174.0, 55.5], [170.2, 77.3], [160.0, 80.5],
  243. [167.6, 64.5], [167.6, 72.3], [167.6, 61.4], [154.9, 58.2], [162.6, 81.8],
  244. [175.3, 63.6], [171.4, 53.4], [157.5, 54.5], [165.1, 53.6], [160.0, 60.0],
  245. [174.0, 73.6], [162.6, 61.4], [174.0, 55.5], [162.6, 63.6], [161.3, 60.9],
  246. [156.2, 60.0], [149.9, 46.8], [169.5, 57.3], [160.0, 64.1], [175.3, 63.6],
  247. [169.5, 67.3], [160.0, 75.5], [172.7, 68.2], [162.6, 61.4], [157.5, 76.8],
  248. [176.5, 71.8], [164.4, 55.5], [160.7, 48.6], [174.0, 66.4], [163.8, 67.3]
  249. ],
  250. markPoint : {
  251. data : [
  252. {type : 'max', name: '最大值'},
  253. {type : 'min', name: '最小值'}
  254. ]
  255. },
  256. markLine : {
  257. data : [
  258. {type : 'average', name: '平均值'}
  259. ]
  260. }
  261. },
  262. {
  263. name:'男性',
  264. type:'scatter',
  265. tooltip : {
  266. trigger: 'item',
  267. formatter : function (params) {
  268. if (params.value.length > 1) {
  269. return params.seriesName + ' :<br/>'
  270. + params.value[0] + 'cm '
  271. + params.value[1] + 'kg ';
  272. }
  273. else {
  274. return params.seriesName + ' :<br/>'
  275. + params.name + ' : '
  276. + params.value + 'kg ';
  277. }
  278. }
  279. },
  280. data: [[174.0, 65.6], [175.3, 71.8], [193.5, 80.7], [186.5, 72.6], [187.2, 78.8],
  281. [181.5, 74.8], [184.0, 86.4], [184.5, 78.4], [175.0, 62.0], [184.0, 81.6],
  282. [180.0, 76.6], [177.8, 83.6], [192.0, 90.0], [176.0, 74.6], [174.0, 71.0],
  283. [184.0, 79.6], [192.7, 93.8], [171.5, 70.0], [173.0, 72.4], [176.0, 85.9],
  284. [176.0, 78.8], [180.5, 77.8], [172.7, 66.2], [176.0, 86.4], [173.5, 81.8],
  285. [178.0, 89.6], [180.3, 82.8], [180.3, 76.4], [164.5, 63.2], [173.0, 60.9],
  286. [183.5, 74.8], [175.5, 70.0], [188.0, 72.4], [189.2, 84.1], [172.8, 69.1],
  287. [170.0, 59.5], [182.0, 67.2], [170.0, 61.3], [177.8, 68.6], [184.2, 80.1],
  288. [186.7, 87.8], [171.4, 84.7], [172.7, 73.4], [175.3, 72.1], [180.3, 82.6],
  289. [182.9, 88.7], [188.0, 84.1], [177.2, 94.1], [172.1, 74.9], [167.0, 59.1],
  290. [169.5, 75.6], [174.0, 86.2], [172.7, 75.3], [182.2, 87.1], [164.1, 55.2],
  291. [163.0, 57.0], [171.5, 61.4], [184.2, 76.8], [174.0, 86.8], [174.0, 72.2],
  292. [177.0, 71.6], [186.0, 84.8], [167.0, 68.2], [171.8, 66.1], [182.0, 72.0],
  293. [167.0, 64.6], [177.8, 74.8], [164.5, 70.0], [192.0, 101.6], [175.5, 63.2],
  294. [171.2, 79.1], [181.6, 78.9], [167.4, 67.7], [181.1, 66.0], [177.0, 68.2],
  295. [174.5, 63.9], [177.5, 72.0], [170.5, 56.8], [182.4, 74.5], [197.1, 90.9],
  296. [180.1, 93.0], [175.5, 80.9], [180.6, 72.7], [184.4, 68.0], [175.5, 70.9],
  297. [180.6, 72.5], [177.0, 72.5], [177.1, 83.4], [181.6, 75.5], [176.5, 73.0],
  298. [175.0, 70.2], [174.0, 73.4], [165.1, 70.5], [177.0, 68.9], [192.0, 102.3],
  299. [176.5, 68.4], [169.4, 65.9], [182.1, 75.7], [179.8, 84.5], [175.3, 87.7],
  300. [184.9, 86.4], [177.3, 73.2], [167.4, 53.9], [178.1, 72.0], [168.9, 55.5],
  301. [157.2, 58.4], [180.3, 83.2], [170.2, 72.7], [177.8, 64.1], [172.7, 72.3],
  302. [165.1, 65.0], [186.7, 86.4], [165.1, 65.0], [174.0, 88.6], [175.3, 84.1],
  303. [185.4, 66.8], [177.8, 75.5], [180.3, 93.2], [180.3, 82.7], [177.8, 58.0],
  304. [177.8, 79.5], [177.8, 78.6], [177.8, 71.8], [177.8, 116.4], [163.8, 72.2],
  305. [188.0, 83.6], [198.1, 85.5], [175.3, 90.9], [166.4, 85.9], [190.5, 89.1],
  306. [166.4, 75.0], [177.8, 77.7], [179.7, 86.4], [172.7, 90.9], [190.5, 73.6],
  307. [185.4, 76.4], [168.9, 69.1], [167.6, 84.5], [175.3, 64.5], [170.2, 69.1],
  308. [190.5, 108.6], [177.8, 86.4], [190.5, 80.9], [177.8, 87.7], [184.2, 94.5],
  309. [176.5, 80.2], [177.8, 72.0], [180.3, 71.4], [171.4, 72.7], [172.7, 84.1],
  310. [172.7, 76.8], [177.8, 63.6], [177.8, 80.9], [182.9, 80.9], [170.2, 85.5],
  311. [167.6, 68.6], [175.3, 67.7], [165.1, 66.4], [185.4, 102.3], [181.6, 70.5],
  312. [172.7, 95.9], [190.5, 84.1], [179.1, 87.3], [175.3, 71.8], [170.2, 65.9],
  313. [193.0, 95.9], [171.4, 91.4], [177.8, 81.8], [177.8, 96.8], [167.6, 69.1],
  314. [167.6, 82.7], [180.3, 75.5], [182.9, 79.5], [176.5, 73.6], [186.7, 91.8],
  315. [188.0, 84.1], [188.0, 85.9], [177.8, 81.8], [174.0, 82.5], [177.8, 80.5],
  316. [171.4, 70.0], [185.4, 81.8], [185.4, 84.1], [188.0, 90.5], [188.0, 91.4],
  317. [182.9, 89.1], [176.5, 85.0], [175.3, 69.1], [175.3, 73.6], [188.0, 80.5],
  318. [188.0, 82.7], [175.3, 86.4], [170.5, 67.7], [179.1, 92.7], [177.8, 93.6],
  319. [175.3, 70.9], [182.9, 75.0], [170.8, 93.2], [188.0, 93.2], [180.3, 77.7],
  320. [177.8, 61.4], [185.4, 94.1], [168.9, 75.0], [185.4, 83.6], [180.3, 85.5],
  321. [174.0, 73.9], [167.6, 66.8], [182.9, 87.3], [160.0, 72.3], [180.3, 88.6],
  322. [167.6, 75.5], [186.7, 101.4], [175.3, 91.1], [175.3, 67.3], [175.9, 77.7],
  323. [175.3, 81.8], [179.1, 75.5], [181.6, 84.5], [177.8, 76.6], [182.9, 85.0],
  324. [177.8, 102.5], [184.2, 77.3], [179.1, 71.8], [176.5, 87.9], [188.0, 94.3],
  325. [174.0, 70.9], [167.6, 64.5], [170.2, 77.3], [167.6, 72.3], [188.0, 87.3],
  326. [174.0, 80.0], [176.5, 82.3], [180.3, 73.6], [167.6, 74.1], [188.0, 85.9],
  327. [180.3, 73.2], [167.6, 76.3], [183.0, 65.9], [183.0, 90.9], [179.1, 89.1],
  328. [170.2, 62.3], [177.8, 82.7], [179.1, 79.1], [190.5, 98.2], [177.8, 84.1],
  329. [180.3, 83.2], [180.3, 83.2]
  330. ],
  331. markPoint : {
  332. data : [
  333. {type : 'max', name: '最大值'},
  334. {type : 'min', name: '最小值'}
  335. ]
  336. },
  337. markLine : {
  338. data : [
  339. {type : 'average', name: '平均值'}
  340. ]
  341. }
  342. }
  343. ]
  344. };
  345. scatterChart.setOption(scatteroption);
  346. $(window).resize(scatterChart.resize);
  347. var kChart = echarts.init(document.getElementById("echarts-k-chart"));
  348. var koption = {
  349. title : {
  350. text: '2013年上半年上证指数'
  351. },
  352. tooltip : {
  353. trigger: 'axis',
  354. formatter: function (params) {
  355. var res = params[0].seriesName + ' ' + params[0].name;
  356. res += '<br/> 开盘 : ' + params[0].value[0] + ' 最高 : ' + params[0].value[3];
  357. res += '<br/> 收盘 : ' + params[0].value[1] + ' 最低 : ' + params[0].value[2];
  358. return res;
  359. }
  360. },
  361. legend: {
  362. data:['上证指数']
  363. },
  364. grid:{
  365. x:40,
  366. x2:2
  367. },
  368. dataZoom : {
  369. show : true,
  370. realtime: true,
  371. start : 50,
  372. end : 100
  373. },
  374. xAxis : [
  375. {
  376. type : 'category',
  377. boundaryGap : true,
  378. axisTick: {onGap:false},
  379. splitLine: {show:false},
  380. data : [
  381. "2013/1/24", "2013/1/25", "2013/1/28", "2013/1/29", "2013/1/30",
  382. "2013/1/31", "2013/2/1", "2013/2/4", "2013/2/5", "2013/2/6",
  383. "2013/2/7", "2013/2/8", "2013/2/18", "2013/2/19", "2013/2/20",
  384. "2013/2/21", "2013/2/22", "2013/2/25", "2013/2/26", "2013/2/27",
  385. "2013/2/28", "2013/3/1", "2013/3/4", "2013/3/5", "2013/3/6",
  386. "2013/3/7", "2013/3/8", "2013/3/11", "2013/3/12", "2013/3/13",
  387. "2013/3/14", "2013/3/15", "2013/3/18", "2013/3/19", "2013/3/20",
  388. "2013/3/21", "2013/3/22", "2013/3/25", "2013/3/26", "2013/3/27",
  389. "2013/3/28", "2013/3/29", "2013/4/1", "2013/4/2", "2013/4/3",
  390. "2013/4/8", "2013/4/9", "2013/4/10", "2013/4/11", "2013/4/12",
  391. "2013/4/15", "2013/4/16", "2013/4/17", "2013/4/18", "2013/4/19",
  392. "2013/4/22", "2013/4/23", "2013/4/24", "2013/4/25", "2013/4/26",
  393. "2013/5/2", "2013/5/3", "2013/5/6", "2013/5/7", "2013/5/8",
  394. "2013/5/9", "2013/5/10", "2013/5/13", "2013/5/14", "2013/5/15",
  395. "2013/5/16", "2013/5/17", "2013/5/20", "2013/5/21", "2013/5/22",
  396. "2013/5/23", "2013/5/24", "2013/5/27", "2013/5/28", "2013/5/29",
  397. "2013/5/30", "2013/5/31", "2013/6/3", "2013/6/4", "2013/6/5",
  398. "2013/6/6", "2013/6/7", "2013/6/13"
  399. ]
  400. }
  401. ],
  402. yAxis : [
  403. {
  404. type : 'value',
  405. scale:true,
  406. boundaryGap: [0.01, 0.01]
  407. }
  408. ],
  409. series : [
  410. {
  411. name:'上证指数',
  412. type:'k',
  413. data:[ // 开盘,收盘,最低,最高
  414. [2320.26,2302.6,2287.3,2362.94],
  415. [2300,2291.3,2288.26,2308.38],
  416. [2295.35,2346.5,2295.35,2346.92],
  417. [2347.22,2358.98,2337.35,2363.8],
  418. [2360.75,2382.48,2347.89,2383.76],
  419. [2383.43,2385.42,2371.23,2391.82],
  420. [2377.41,2419.02,2369.57,2421.15],
  421. [2425.92,2428.15,2417.58,2440.38],
  422. [2411,2433.13,2403.3,2437.42],
  423. [2432.68,2434.48,2427.7,2441.73],
  424. [2430.69,2418.53,2394.22,2433.89],
  425. [2416.62,2432.4,2414.4,2443.03],
  426. [2441.91,2421.56,2415.43,2444.8],
  427. [2420.26,2382.91,2373.53,2427.07],
  428. [2383.49,2397.18,2370.61,2397.94],
  429. [2378.82,2325.95,2309.17,2378.82],
  430. [2322.94,2314.16,2308.76,2330.88],
  431. [2320.62,2325.82,2315.01,2338.78],
  432. [2313.74,2293.34,2289.89,2340.71],
  433. [2297.77,2313.22,2292.03,2324.63],
  434. [2322.32,2365.59,2308.92,2366.16],
  435. [2364.54,2359.51,2330.86,2369.65],
  436. [2332.08,2273.4,2259.25,2333.54],
  437. [2274.81,2326.31,2270.1,2328.14],
  438. [2333.61,2347.18,2321.6,2351.44],
  439. [2340.44,2324.29,2304.27,2352.02],
  440. [2326.42,2318.61,2314.59,2333.67],
  441. [2314.68,2310.59,2296.58,2320.96],
  442. [2309.16,2286.6,2264.83,2333.29],
  443. [2282.17,2263.97,2253.25,2286.33],
  444. [2255.77,2270.28,2253.31,2276.22],
  445. [2269.31,2278.4,2250,2312.08],
  446. [2267.29,2240.02,2239.21,2276.05],
  447. [2244.26,2257.43,2232.02,2261.31],
  448. [2257.74,2317.37,2257.42,2317.86],
  449. [2318.21,2324.24,2311.6,2330.81],
  450. [2321.4,2328.28,2314.97,2332],
  451. [2334.74,2326.72,2319.91,2344.89],
  452. [2318.58,2297.67,2281.12,2319.99],
  453. [2299.38,2301.26,2289,2323.48],
  454. [2273.55,2236.3,2232.91,2273.55],
  455. [2238.49,2236.62,2228.81,2246.87],
  456. [2229.46,2234.4,2227.31,2243.95],
  457. [2234.9,2227.74,2220.44,2253.42],
  458. [2232.69,2225.29,2217.25,2241.34],
  459. [2196.24,2211.59,2180.67,2212.59],
  460. [2215.47,2225.77,2215.47,2234.73],
  461. [2224.93,2226.13,2212.56,2233.04],
  462. [2236.98,2219.55,2217.26,2242.48],
  463. [2218.09,2206.78,2204.44,2226.26],
  464. [2199.91,2181.94,2177.39,2204.99],
  465. [2169.63,2194.85,2165.78,2196.43],
  466. [2195.03,2193.8,2178.47,2197.51],
  467. [2181.82,2197.6,2175.44,2206.03],
  468. [2201.12,2244.64,2200.58,2250.11],
  469. [2236.4,2242.17,2232.26,2245.12],
  470. [2242.62,2184.54,2182.81,2242.62],
  471. [2187.35,2218.32,2184.11,2226.12],
  472. [2213.19,2199.31,2191.85,2224.63],
  473. [2203.89,2177.91,2173.86,2210.58],
  474. [2170.78,2174.12,2161.14,2179.65],
  475. [2179.05,2205.5,2179.05,2222.81],
  476. [2212.5,2231.17,2212.5,2236.07],
  477. [2227.86,2235.57,2219.44,2240.26],
  478. [2242.39,2246.3,2235.42,2255.21],
  479. [2246.96,2232.97,2221.38,2247.86],
  480. [2228.82,2246.83,2225.81,2247.67],
  481. [2247.68,2241.92,2231.36,2250.85],
  482. [2238.9,2217.01,2205.87,2239.93],
  483. [2217.09,2224.8,2213.58,2225.19],
  484. [2221.34,2251.81,2210.77,2252.87],
  485. [2249.81,2282.87,2248.41,2288.09],
  486. [2286.33,2299.99,2281.9,2309.39],
  487. [2297.11,2305.11,2290.12,2305.3],
  488. [2303.75,2302.4,2292.43,2314.18],
  489. [2293.81,2275.67,2274.1,2304.95],
  490. [2281.45,2288.53,2270.25,2292.59],
  491. [2286.66,2293.08,2283.94,2301.7],
  492. [2293.4,2321.32,2281.47,2322.1],
  493. [2323.54,2324.02,2321.17,2334.33],
  494. [2316.25,2317.75,2310.49,2325.72],
  495. [2320.74,2300.59,2299.37,2325.53],
  496. [2300.21,2299.25,2294.11,2313.43],
  497. [2297.1,2272.42,2264.76,2297.1],
  498. [2270.71,2270.93,2260.87,2276.86],
  499. [2264.43,2242.11,2240.07,2266.69],
  500. [2242.26,2210.9,2205.07,2250.63],
  501. [2190.1,2148.35,2126.22,2190.1]
  502. ]
  503. }
  504. ]
  505. };
  506. kChart.setOption(koption);
  507. $(window).resize(kChart.resize);
  508. var pieChart = echarts.init(document.getElementById("echarts-pie-chart"));
  509. var pieoption = {
  510. title : {
  511. text: '某站点用户访问来源',
  512. subtext: '纯属虚构',
  513. x:'center'
  514. },
  515. tooltip : {
  516. trigger: 'item',
  517. formatter: "{a} <br/>{b} : {c} ({d}%)"
  518. },
  519. legend: {
  520. orient : 'vertical',
  521. x : 'left',
  522. data:['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
  523. },
  524. calculable : true,
  525. series : [
  526. {
  527. name:'访问来源',
  528. type:'pie',
  529. radius : '55%',
  530. center: ['50%', '60%'],
  531. data:[
  532. {value:335, name:'直接访问'},
  533. {value:310, name:'邮件营销'},
  534. {value:234, name:'联盟广告'},
  535. {value:135, name:'视频广告'},
  536. {value:1548, name:'搜索引擎'}
  537. ]
  538. }
  539. ]
  540. };
  541. pieChart.setOption(pieoption);
  542. $(window).resize(pieChart.resize);
  543. var radarChart = echarts.init(document.getElementById("echarts-radar-chart"));
  544. var radaroption = {
  545. title : {
  546. text: '预算 vs 开销',
  547. subtext: '纯属虚构'
  548. },
  549. tooltip : {
  550. trigger: 'axis'
  551. },
  552. legend: {
  553. orient : 'vertical',
  554. x : 'right',
  555. y : 'bottom',
  556. data:['预算分配','实际开销']
  557. },
  558. polar : [
  559. {
  560. indicator : [
  561. { text: '销售', max: 6000},
  562. { text: '管理', max: 16000},
  563. { text: '信息技术', max: 30000},
  564. { text: '客服', max: 38000},
  565. { text: '研发', max: 52000},
  566. { text: '市场', max: 25000}
  567. ]
  568. }
  569. ],
  570. calculable : true,
  571. series : [
  572. {
  573. name: '预算 vs 开销',
  574. type: 'radar',
  575. data : [
  576. {
  577. value : [4300, 10000, 28000, 35000, 50000, 19000],
  578. name : '预算分配'
  579. },
  580. {
  581. value : [5000, 14000, 28000, 31000, 42000, 21000],
  582. name : '实际开销'
  583. }
  584. ]
  585. }
  586. ]
  587. };
  588. radarChart.setOption(radaroption);
  589. $(window).resize(radarChart.resize);
  590. var mapChart = echarts.init(document.getElementById("echarts-map-chart"));
  591. var mapoption = {
  592. title : {
  593. text: 'iphone销量',
  594. subtext: '纯属虚构',
  595. x:'center'
  596. },
  597. tooltip : {
  598. trigger: 'item'
  599. },
  600. legend: {
  601. orient: 'vertical',
  602. x:'left',
  603. data:['iphone3','iphone4','iphone5']
  604. },
  605. dataRange: {
  606. min: 0,
  607. max: 2500,
  608. x: 'left',
  609. y: 'bottom',
  610. text:['高','低'], // 文本,默认为数值文本
  611. calculable : true
  612. },
  613. toolbox: {
  614. show: true,
  615. orient : 'vertical',
  616. x: 'right',
  617. y: 'center',
  618. feature : {
  619. mark : {show: true},
  620. dataView : {show: true, readOnly: false},
  621. restore : {show: true},
  622. saveAsImage : {show: true}
  623. }
  624. },
  625. roamController: {
  626. show: true,
  627. x: 'right',
  628. mapTypeControl: {
  629. 'china': true
  630. }
  631. },
  632. series : [
  633. {
  634. name: 'iphone3',
  635. type: 'map',
  636. mapType: 'china',
  637. roam: false,
  638. itemStyle:{
  639. normal:{label:{show:true}},
  640. emphasis:{label:{show:true}}
  641. },
  642. data:[
  643. {name: '北京',value: Math.round(Math.random()*1000)},
  644. {name: '天津',value: Math.round(Math.random()*1000)},
  645. {name: '上海',value: Math.round(Math.random()*1000)},
  646. {name: '重庆',value: Math.round(Math.random()*1000)},
  647. {name: '河北',value: Math.round(Math.random()*1000)},
  648. {name: '河南',value: Math.round(Math.random()*1000)},
  649. {name: '云南',value: Math.round(Math.random()*1000)},
  650. {name: '辽宁',value: Math.round(Math.random()*1000)},
  651. {name: '黑龙江',value: Math.round(Math.random()*1000)},
  652. {name: '湖南',value: Math.round(Math.random()*1000)},
  653. {name: '安徽',value: Math.round(Math.random()*1000)},
  654. {name: '山东',value: Math.round(Math.random()*1000)},
  655. {name: '新疆',value: Math.round(Math.random()*1000)},
  656. {name: '江苏',value: Math.round(Math.random()*1000)},
  657. {name: '浙江',value: Math.round(Math.random()*1000)},
  658. {name: '江西',value: Math.round(Math.random()*1000)},
  659. {name: '湖北',value: Math.round(Math.random()*1000)},
  660. {name: '广西',value: Math.round(Math.random()*1000)},
  661. {name: '甘肃',value: Math.round(Math.random()*1000)},
  662. {name: '山西',value: Math.round(Math.random()*1000)},
  663. {name: '内蒙古',value: Math.round(Math.random()*1000)},
  664. {name: '陕西',value: Math.round(Math.random()*1000)},
  665. {name: '吉林',value: Math.round(Math.random()*1000)},
  666. {name: '福建',value: Math.round(Math.random()*1000)},
  667. {name: '贵州',value: Math.round(Math.random()*1000)},
  668. {name: '广东',value: Math.round(Math.random()*1000)},
  669. {name: '青海',value: Math.round(Math.random()*1000)},
  670. {name: '西藏',value: Math.round(Math.random()*1000)},
  671. {name: '四川',value: Math.round(Math.random()*1000)},
  672. {name: '宁夏',value: Math.round(Math.random()*1000)},
  673. {name: '海南',value: Math.round(Math.random()*1000)},
  674. {name: '台湾',value: Math.round(Math.random()*1000)},
  675. {name: '香港',value: Math.round(Math.random()*1000)},
  676. {name: '澳门',value: Math.round(Math.random()*1000)}
  677. ]
  678. },
  679. {
  680. name: 'iphone4',
  681. type: 'map',
  682. mapType: 'china',
  683. itemStyle:{
  684. normal:{label:{show:true}},
  685. emphasis:{label:{show:true}}
  686. },
  687. data:[
  688. {name: '北京',value: Math.round(Math.random()*1000)},
  689. {name: '天津',value: Math.round(Math.random()*1000)},
  690. {name: '上海',value: Math.round(Math.random()*1000)},
  691. {name: '重庆',value: Math.round(Math.random()*1000)},
  692. {name: '河北',value: Math.round(Math.random()*1000)},
  693. {name: '安徽',value: Math.round(Math.random()*1000)},
  694. {name: '新疆',value: Math.round(Math.random()*1000)},
  695. {name: '浙江',value: Math.round(Math.random()*1000)},
  696. {name: '江西',value: Math.round(Math.random()*1000)},
  697. {name: '山西',value: Math.round(Math.random()*1000)},
  698. {name: '内蒙古',value: Math.round(Math.random()*1000)},
  699. {name: '吉林',value: Math.round(Math.random()*1000)},
  700. {name: '福建',value: Math.round(Math.random()*1000)},
  701. {name: '广东',value: Math.round(Math.random()*1000)},
  702. {name: '西藏',value: Math.round(Math.random()*1000)},
  703. {name: '四川',value: Math.round(Math.random()*1000)},
  704. {name: '宁夏',value: Math.round(Math.random()*1000)},
  705. {name: '香港',value: Math.round(Math.random()*1000)},
  706. {name: '澳门',value: Math.round(Math.random()*1000)}
  707. ]
  708. },
  709. {
  710. name: 'iphone5',
  711. type: 'map',
  712. mapType: 'china',
  713. itemStyle:{
  714. normal:{label:{show:true}},
  715. emphasis:{label:{show:true}}
  716. },
  717. data:[
  718. {name: '北京',value: Math.round(Math.random()*1000)},
  719. {name: '天津',value: Math.round(Math.random()*1000)},
  720. {name: '上海',value: Math.round(Math.random()*1000)},
  721. {name: '广东',value: Math.round(Math.random()*1000)},
  722. {name: '台湾',value: Math.round(Math.random()*1000)},
  723. {name: '香港',value: Math.round(Math.random()*1000)},
  724. {name: '澳门',value: Math.round(Math.random()*1000)}
  725. ]
  726. }
  727. ]
  728. };
  729. mapChart.setOption(mapoption);
  730. $(window).resize(mapChart.resize);
  731. var chordChart = echarts.init(document.getElementById("echarts-chord-chart"));
  732. var chordoption = {
  733. title : {
  734. text: '测试数据',
  735. subtext: 'From d3.js',
  736. x:'right',
  737. y:'bottom'
  738. },
  739. tooltip : {
  740. trigger: 'item',
  741. formatter: function (params) {
  742. if (params.indicator2) { // is edge
  743. return params.value.weight;
  744. } else {// is node
  745. return params.name
  746. }
  747. }
  748. },
  749. toolbox: {
  750. show : true,
  751. feature : {
  752. restore : {show: true},
  753. magicType: {show: true, type: ['force', 'chord']},
  754. saveAsImage : {show: true}
  755. }
  756. },
  757. legend: {
  758. x: 'left',
  759. data:['group1','group2', 'group3', 'group4']
  760. },
  761. series : [
  762. {
  763. type:'chord',
  764. sort : 'ascending',
  765. sortSub : 'descending',
  766. showScale : true,
  767. showScaleText : true,
  768. data : [
  769. {name : 'group1'},
  770. {name : 'group2'},
  771. {name : 'group3'},
  772. {name : 'group4'}
  773. ],
  774. itemStyle : {
  775. normal : {
  776. label : {
  777. show : false
  778. }
  779. }
  780. },
  781. matrix : [
  782. [11975, 5871, 8916, 2868],
  783. [ 1951, 10048, 2060, 6171],
  784. [ 8010, 16145, 8090, 8045],
  785. [ 1013, 990, 940, 6907]
  786. ]
  787. }
  788. ]
  789. };
  790. chordChart.setOption(chordoption);
  791. $(window).resize(chordChart.resize);
  792. var forceChart = echarts.init(document.getElementById("echarts-force-chart"));
  793. var forceoption ={
  794. title : {
  795. text: '人物关系:乔布斯',
  796. subtext: '数据来自人立方',
  797. x:'right',
  798. y:'bottom'
  799. },
  800. tooltip : {
  801. trigger: 'item',
  802. formatter: '{a} : {b}'
  803. },
  804. toolbox: {
  805. show : true,
  806. feature : {
  807. restore : {show: true},
  808. magicType: {show: true, type: ['force', 'chord']},
  809. saveAsImage : {show: true}
  810. }
  811. },
  812. legend: {
  813. x: 'left',
  814. data:['家人','朋友']
  815. },
  816. series : [
  817. {
  818. type:'force',
  819. name : "人物关系",
  820. ribbonType: false,
  821. categories : [
  822. {
  823. name: '人物'
  824. },
  825. {
  826. name: '家人'
  827. },
  828. {
  829. name:'朋友'
  830. }
  831. ],
  832. itemStyle: {
  833. normal: {
  834. label: {
  835. show: true,
  836. textStyle: {
  837. color: '#333'
  838. }
  839. },
  840. nodeStyle : {
  841. brushType : 'both',
  842. borderColor : 'rgba(255,215,0,0.4)',
  843. borderWidth : 1
  844. },
  845. linkStyle: {
  846. type: 'curve'
  847. }
  848. },
  849. emphasis: {
  850. label: {
  851. show: false
  852. // textStyle: null // 默认使用全局文本样式,详见TEXTSTYLE
  853. },
  854. nodeStyle : {
  855. //r: 30
  856. },
  857. linkStyle : {}
  858. }
  859. },
  860. useWorker: false,
  861. minRadius : 15,
  862. maxRadius : 25,
  863. gravity: 1.1,
  864. scaling: 1.1,
  865. roam: 'move',
  866. nodes:[
  867. {category:0, name: '乔布斯', value : 10},
  868. {category:1, name: '丽萨-乔布斯',value : 2},
  869. {category:1, name: '保罗-乔布斯',value : 3},
  870. {category:1, name: '克拉拉-乔布斯',value : 3},
  871. {category:1, name: '劳伦-鲍威尔',value : 7},
  872. {category:2, name: '史蒂夫-沃兹尼艾克',value : 5},
  873. {category:2, name: '奥巴马',value : 8},
  874. {category:2, name: '比尔-盖茨',value : 9},
  875. {category:2, name: '乔纳森-艾夫',value : 4},
  876. {category:2, name: '蒂姆-库克',value : 4},
  877. {category:2, name: '龙-韦恩',value : 1},
  878. ],
  879. links : [
  880. {source : '丽萨-乔布斯', target : '乔布斯', weight : 1, name: '女儿'},
  881. {source : '保罗-乔布斯', target : '乔布斯', weight : 2, name: '父亲'},
  882. {source : '克拉拉-乔布斯', target : '乔布斯', weight : 1, name: '母亲'},
  883. {source : '劳伦-鲍威尔', target : '乔布斯', weight : 2},
  884. {source : '史蒂夫-沃兹尼艾克', target : '乔布斯', weight : 3, name: '合伙人'},
  885. {source : '奥巴马', target : '乔布斯', weight : 1},
  886. {source : '比尔-盖茨', target : '乔布斯', weight : 6, name: '竞争对手'},
  887. {source : '乔纳森-艾夫', target : '乔布斯', weight : 1, name: '爱将'},
  888. {source : '蒂姆-库克', target : '乔布斯', weight : 1},
  889. {source : '龙-韦恩', target : '乔布斯', weight : 1},
  890. {source : '克拉拉-乔布斯', target : '保罗-乔布斯', weight : 1},
  891. {source : '奥巴马', target : '保罗-乔布斯', weight : 1},
  892. {source : '奥巴马', target : '克拉拉-乔布斯', weight : 1},
  893. {source : '奥巴马', target : '劳伦-鲍威尔', weight : 1},
  894. {source : '奥巴马', target : '史蒂夫-沃兹尼艾克', weight : 1},
  895. {source : '比尔-盖茨', target : '奥巴马', weight : 6},
  896. {source : '比尔-盖茨', target : '克拉拉-乔布斯', weight : 1},
  897. {source : '蒂姆-库克', target : '奥巴马', weight : 1}
  898. ]
  899. }
  900. ]
  901. };
  902. forceChart.setOption(forceoption);
  903. $(window).resize(forceChart.resize);
  904. var gaugeChart = echarts.init(document.getElementById("echarts-gauge-chart"));
  905. var gaugeoption = {
  906. tooltip : {
  907. formatter: "{a} <br/>{c} {b}"
  908. },
  909. toolbox: {
  910. show : true,
  911. feature : {
  912. mark : {show: true},
  913. restore : {show: true},
  914. saveAsImage : {show: true}
  915. }
  916. },
  917. series : [
  918. {
  919. name:'速度',
  920. type:'gauge',
  921. min:0,
  922. max:220,
  923. splitNumber:11,
  924. axisLine: { // 坐标轴线
  925. lineStyle: { // 属性lineStyle控制线条样式
  926. width: 10
  927. }
  928. },
  929. axisTick: { // 坐标轴小标记
  930. length :15, // 属性length控制线长
  931. lineStyle: { // 属性lineStyle控制线条样式
  932. color: 'auto'
  933. }
  934. },
  935. splitLine: { // 分隔线
  936. length :20, // 属性length控制线长
  937. lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式
  938. color: 'auto'
  939. }
  940. },
  941. title : {
  942. textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  943. fontWeight: 'bolder',
  944. fontSize: 20,
  945. fontStyle: 'italic'
  946. }
  947. },
  948. detail : {
  949. textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  950. fontWeight: 'bolder'
  951. }
  952. },
  953. data:[{value: 40, name: 'km/h'}]
  954. },
  955. {
  956. name:'转速',
  957. type:'gauge',
  958. center : ['25%', '55%'], // 默认全局居中
  959. radius : '50%',
  960. min:0,
  961. max:7,
  962. endAngle:45,
  963. splitNumber:7,
  964. axisLine: { // 坐标轴线
  965. lineStyle: { // 属性lineStyle控制线条样式
  966. width: 8
  967. }
  968. },
  969. axisTick: { // 坐标轴小标记
  970. length :12, // 属性length控制线长
  971. lineStyle: { // 属性lineStyle控制线条样式
  972. color: 'auto'
  973. }
  974. },
  975. splitLine: { // 分隔线
  976. length :20, // 属性length控制线长
  977. lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式
  978. color: 'auto'
  979. }
  980. },
  981. pointer: {
  982. width:5
  983. },
  984. title : {
  985. offsetCenter: [0, '-30%'], // x, y,单位px
  986. },
  987. detail : {
  988. textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
  989. fontWeight: 'bolder'
  990. }
  991. },
  992. data:[{value: 1.5, name: 'x1000 r/min'}]
  993. },
  994. {
  995. name:'油表',
  996. type:'gauge',
  997. center : ['75%', '50%'], // 默认全局居中
  998. radius : '50%',
  999. min:0,
  1000. max:2,
  1001. startAngle:135,
  1002. endAngle:45,
  1003. splitNumber:2,
  1004. axisLine: { // 坐标轴线
  1005. lineStyle: { // 属性lineStyle控制线条样式
  1006. color: [[0.2, '#ff4500'],[0.8, '#48b'],[1, '#228b22']],
  1007. width: 8
  1008. }
  1009. },
  1010. axisTick: { // 坐标轴小标记
  1011. splitNumber:5,
  1012. length :10, // 属性length控制线长
  1013. lineStyle: { // 属性lineStyle控制线条样式
  1014. color: 'auto'
  1015. }
  1016. },
  1017. axisLabel: {
  1018. formatter:function(v){
  1019. switch (v + '') {
  1020. case '0' : return 'E';
  1021. case '1' : return 'Gas';
  1022. case '2' : return 'F';
  1023. }
  1024. }
  1025. },
  1026. splitLine: { // 分隔线
  1027. length :15, // 属性length控制线长
  1028. lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式
  1029. color: 'auto'
  1030. }
  1031. },
  1032. pointer: {
  1033. width:2
  1034. },
  1035. title : {
  1036. show: false
  1037. },
  1038. detail : {
  1039. show: false
  1040. },
  1041. data:[{value: 0.5, name: 'gas'}]
  1042. },
  1043. {
  1044. name:'水表',
  1045. type:'gauge',
  1046. center : ['75%', '50%'], // 默认全局居中
  1047. radius : '50%',
  1048. min:0,
  1049. max:2,
  1050. startAngle:315,
  1051. endAngle:225,
  1052. splitNumber:2,
  1053. axisLine: { // 坐标轴线
  1054. lineStyle: { // 属性lineStyle控制线条样式
  1055. color: [[0.2, '#ff4500'],[0.8, '#48b'],[1, '#228b22']],
  1056. width: 8
  1057. }
  1058. },
  1059. axisTick: { // 坐标轴小标记
  1060. show: false
  1061. },
  1062. axisLabel: {
  1063. formatter:function(v){
  1064. switch (v + '') {
  1065. case '0' : return 'H';
  1066. case '1' : return 'Water';
  1067. case '2' : return 'C';
  1068. }
  1069. }
  1070. },
  1071. splitLine: { // 分隔线
  1072. length :15, // 属性length控制线长
  1073. lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式
  1074. color: 'auto'
  1075. }
  1076. },
  1077. pointer: {
  1078. width:2
  1079. },
  1080. title : {
  1081. show: false
  1082. },
  1083. detail : {
  1084. show: false
  1085. },
  1086. data:[{value: 0.5, name: 'gas'}]
  1087. }
  1088. ]
  1089. };
  1090. gaugeChart.setOption(gaugeoption);
  1091. $(window).resize(gaugeChart.resize);
  1092. var funnelChart = echarts.init(document.getElementById("echarts-funnel-chart"));
  1093. var funneloption = {
  1094. title : {
  1095. text: '漏斗图',
  1096. subtext: '纯属虚构'
  1097. },
  1098. tooltip : {
  1099. trigger: 'item',
  1100. formatter: "{a} <br/>{b} : {c}%"
  1101. },
  1102. legend: {
  1103. data : ['展现','点击','访问','咨询','订单']
  1104. },
  1105. calculable : true,
  1106. series : [
  1107. {
  1108. name:'漏斗图',
  1109. type:'funnel',
  1110. width: '40%',
  1111. data:[
  1112. {value:60, name:'访问'},
  1113. {value:40, name:'咨询'},
  1114. {value:20, name:'订单'},
  1115. {value:80, name:'点击'},
  1116. {value:100, name:'展现'}
  1117. ]
  1118. },
  1119. {
  1120. name:'金字塔',
  1121. type:'funnel',
  1122. x : '50%',
  1123. sort : 'ascending',
  1124. itemStyle: {
  1125. normal: {
  1126. // color: 各异,
  1127. label: {
  1128. position: 'left'
  1129. }
  1130. }
  1131. },
  1132. data:[
  1133. {value:60, name:'访问'},
  1134. {value:40, name:'咨询'},
  1135. {value:20, name:'订单'},
  1136. {value:80, name:'点击'},
  1137. {value:100, name:'展现'}
  1138. ]
  1139. }
  1140. ]
  1141. };
  1142. funnelChart.setOption(funneloption);
  1143. $(window).resize(funnelChart.resize);
  1144. });