mix8.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <meta name="description" content="ECharts">
  8. <meta name="author" content="kener.linfeng@gmail.com">
  9. <title>ECharts · Example</title>
  10. <link rel="shortcut icon" href="../asset/ico/favicon.png">
  11. <link href="../asset/css/font-awesome.min.css" rel="stylesheet">
  12. <link href="../asset/css/bootstrap.css" rel="stylesheet">
  13. <link href="../asset/css/carousel.css" rel="stylesheet">
  14. <link href="../asset/css/echartsHome.css" rel="stylesheet">
  15. <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  16. <!--[if lt IE 9]>
  17. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  18. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  19. <![endif]-->
  20. <script src="./www/js/echarts.js"></script>
  21. <script src="../asset/js/codemirror.js"></script>
  22. <script src="../asset/js/javascript.js"></script>
  23. <link href="../asset/css/codemirror.css" rel="stylesheet">
  24. <link href="../asset/css/monokai.css" rel="stylesheet">
  25. <style type="text/css">
  26. .CodeMirror {
  27. height: 500px;
  28. }
  29. </style>
  30. </head>
  31. <body>
  32. <!-- Fixed navbar -->
  33. <div class="navbar navbar-default navbar-fixed-top" role="navigation" id="head"></div>
  34. <div class="container-fluid">
  35. <div class="row-fluid example">
  36. <div id="sidebar-code" class="col-md-4">
  37. <div class="well sidebar-nav">
  38. <div class="nav-header"><a href="#" onclick="autoResize()" class="glyphicon glyphicon-resize-full" id ="icon-resize" ></a>option</div>
  39. <textarea id="code" name="code">
  40. var axisData = [
  41. "2013/1/24", "2013/1/25", "2013/1/28", "2013/1/29", "2013/1/30",
  42. "2013/1/31", "2013/2/1", "2013/2/4", "2013/2/5", "2013/2/6",
  43. "2013/2/7", "2013/2/8", "2013/2/18", "2013/2/19", "2013/2/20",
  44. "2013/2/21", "2013/2/22", "2013/2/25", "2013/2/26", "2013/2/27",
  45. "2013/2/28", "2013/3/1", "2013/3/4", "2013/3/5", "2013/3/6",
  46. "2013/3/7", "2013/3/8", "2013/3/11", "2013/3/12", "2013/3/13",
  47. "2013/3/14", "2013/3/15", "2013/3/18", "2013/3/19", "2013/3/20",
  48. "2013/3/21", "2013/3/22", "2013/3/25", "2013/3/26", "2013/3/27",
  49. "2013/3/28", "2013/3/29", "2013/4/1", "2013/4/2", "2013/4/3",
  50. "2013/4/8", "2013/4/9", "2013/4/10", "2013/4/11", "2013/4/12",
  51. "2013/4/15", "2013/4/16", "2013/4/17", "2013/4/18", "2013/4/19",
  52. "2013/4/22", "2013/4/23", "2013/4/24", "2013/4/25", "2013/4/26",
  53. "2013/5/2", "2013/5/3", "2013/5/6", "2013/5/7", "2013/5/8",
  54. "2013/5/9", "2013/5/10", "2013/5/13", "2013/5/14", "2013/5/15",
  55. "2013/5/16", "2013/5/17", "2013/5/20", "2013/5/21", "2013/5/22",
  56. "2013/5/23", "2013/5/24", "2013/5/27", "2013/5/28", "2013/5/29",
  57. "2013/5/30", "2013/5/31", "2013/6/3", "2013/6/4", "2013/6/5",
  58. "2013/6/6", "2013/6/7", "2013/6/13"
  59. ];
  60. option = {
  61. title : {
  62. text: '2013年上半年上证指数'
  63. },
  64. tooltip : {
  65. trigger: 'axis',
  66. showDelay: 0, // 显示延迟,添加显示延迟可以避免频繁切换,单位ms
  67. formatter: function (params) {
  68. var res = params[0].name;
  69. res += '<br/>' + params[0].seriesName;
  70. res += '<br/> 开盘 : ' + params[0].value[0] + ' 最高 : ' + params[0].value[3];
  71. res += '<br/> 收盘 : ' + params[0].value[1] + ' 最低 : ' + params[0].value[2];
  72. return res;
  73. }
  74. },
  75. legend: {
  76. data:['上证指数','成交金额(万)','虚拟数据']
  77. },
  78. toolbox: {
  79. show : true,
  80. feature : {
  81. mark : {show: true},
  82. dataZoom : {show: true},
  83. magicType : {show: true, type: ['line', 'bar']},
  84. restore : {show: true},
  85. saveAsImage : {show: true}
  86. }
  87. },
  88. dataZoom : {
  89. y: 250,
  90. show : true,
  91. realtime: true,
  92. start : 50,
  93. end : 100
  94. },
  95. grid: {
  96. x: 80,
  97. y: 40,
  98. x2:20,
  99. y2:25
  100. },
  101. xAxis : [
  102. {
  103. type : 'category',
  104. boundaryGap : true,
  105. axisTick: {onGap:false},
  106. splitLine: {show:false},
  107. data : axisData
  108. }
  109. ],
  110. yAxis : [
  111. {
  112. type : 'value',
  113. scale:true,
  114. boundaryGap: [0.05, 0.05],
  115. splitArea : {show : true}
  116. }
  117. ],
  118. series : [
  119. {
  120. name:'上证指数',
  121. type:'k',
  122. data:[ // 开盘,收盘,最低,最高
  123. [2320.26,2302.6,2287.3,2362.94],
  124. [2300,2291.3,2288.26,2308.38],
  125. [2295.35,2346.5,2295.35,2346.92],
  126. [2347.22,2358.98,2337.35,2363.8],
  127. [2360.75,2382.48,2347.89,2383.76],
  128. [2383.43,2385.42,2371.23,2391.82],
  129. [2377.41,2419.02,2369.57,2421.15],
  130. [2425.92,2428.15,2417.58,2440.38],
  131. [2411,2433.13,2403.3,2437.42],
  132. [2432.68,2434.48,2427.7,2441.73],
  133. [2430.69,2418.53,2394.22,2433.89],
  134. [2416.62,2432.4,2414.4,2443.03],
  135. [2441.91,2421.56,2415.43,2444.8],
  136. [2420.26,2382.91,2373.53,2427.07],
  137. [2383.49,2397.18,2370.61,2397.94],
  138. [2378.82,2325.95,2309.17,2378.82],
  139. [2322.94,2314.16,2308.76,2330.88],
  140. [2320.62,2325.82,2315.01,2338.78],
  141. [2313.74,2293.34,2289.89,2340.71],
  142. [2297.77,2313.22,2292.03,2324.63],
  143. [2322.32,2365.59,2308.92,2366.16],
  144. [2364.54,2359.51,2330.86,2369.65],
  145. [2332.08,2273.4,2259.25,2333.54],
  146. [2274.81,2326.31,2270.1,2328.14],
  147. [2333.61,2347.18,2321.6,2351.44],
  148. [2340.44,2324.29,2304.27,2352.02],
  149. [2326.42,2318.61,2314.59,2333.67],
  150. [2314.68,2310.59,2296.58,2320.96],
  151. [2309.16,2286.6,2264.83,2333.29],
  152. [2282.17,2263.97,2253.25,2286.33],
  153. [2255.77,2270.28,2253.31,2276.22],
  154. [2269.31,2278.4,2250,2312.08],
  155. [2267.29,2240.02,2239.21,2276.05],
  156. [2244.26,2257.43,2232.02,2261.31],
  157. [2257.74,2317.37,2257.42,2317.86],
  158. [2318.21,2324.24,2311.6,2330.81],
  159. [2321.4,2328.28,2314.97,2332],
  160. [2334.74,2326.72,2319.91,2344.89],
  161. [2318.58,2297.67,2281.12,2319.99],
  162. [2299.38,2301.26,2289,2323.48],
  163. [2273.55,2236.3,2232.91,2273.55],
  164. [2238.49,2236.62,2228.81,2246.87],
  165. [2229.46,2234.4,2227.31,2243.95],
  166. [2234.9,2227.74,2220.44,2253.42],
  167. [2232.69,2225.29,2217.25,2241.34],
  168. [2196.24,2211.59,2180.67,2212.59],
  169. [2215.47,2225.77,2215.47,2234.73],
  170. [2224.93,2226.13,2212.56,2233.04],
  171. [2236.98,2219.55,2217.26,2242.48],
  172. [2218.09,2206.78,2204.44,2226.26],
  173. [2199.91,2181.94,2177.39,2204.99],
  174. [2169.63,2194.85,2165.78,2196.43],
  175. [2195.03,2193.8,2178.47,2197.51],
  176. [2181.82,2197.6,2175.44,2206.03],
  177. [2201.12,2244.64,2200.58,2250.11],
  178. [2236.4,2242.17,2232.26,2245.12],
  179. [2242.62,2184.54,2182.81,2242.62],
  180. [2187.35,2218.32,2184.11,2226.12],
  181. [2213.19,2199.31,2191.85,2224.63],
  182. [2203.89,2177.91,2173.86,2210.58],
  183. [2170.78,2174.12,2161.14,2179.65],
  184. [2179.05,2205.5,2179.05,2222.81],
  185. [2212.5,2231.17,2212.5,2236.07],
  186. [2227.86,2235.57,2219.44,2240.26],
  187. [2242.39,2246.3,2235.42,2255.21],
  188. [2246.96,2232.97,2221.38,2247.86],
  189. [2228.82,2246.83,2225.81,2247.67],
  190. [2247.68,2241.92,2231.36,2250.85],
  191. [2238.9,2217.01,2205.87,2239.93],
  192. [2217.09,2224.8,2213.58,2225.19],
  193. [2221.34,2251.81,2210.77,2252.87],
  194. [2249.81,2282.87,2248.41,2288.09],
  195. [2286.33,2299.99,2281.9,2309.39],
  196. [2297.11,2305.11,2290.12,2305.3],
  197. [2303.75,2302.4,2292.43,2314.18],
  198. [2293.81,2275.67,2274.1,2304.95],
  199. [2281.45,2288.53,2270.25,2292.59],
  200. [2286.66,2293.08,2283.94,2301.7],
  201. [2293.4,2321.32,2281.47,2322.1],
  202. [2323.54,2324.02,2321.17,2334.33],
  203. [2316.25,2317.75,2310.49,2325.72],
  204. [2320.74,2300.59,2299.37,2325.53],
  205. [2300.21,2299.25,2294.11,2313.43],
  206. [2297.1,2272.42,2264.76,2297.1],
  207. [2270.71,2270.93,2260.87,2276.86],
  208. [2264.43,2242.11,2240.07,2266.69],
  209. [2242.26,2210.9,2205.07,2250.63],
  210. [2190.1,2148.35,2126.22,2190.1]
  211. ]
  212. },
  213. {
  214. name:'成交金额(万)',
  215. type:'line',
  216. symbol: 'none',
  217. data:[]
  218. },
  219. {
  220. name:'虚拟数据',
  221. type:'bar',data:[]
  222. }
  223. ]
  224. };
  225. option2 = {
  226. tooltip : {
  227. trigger: 'axis',
  228. showDelay: 0 // 显示延迟,添加显示延迟可以避免频繁切换,单位ms
  229. },
  230. legend: {
  231. y : -30,
  232. data:['上证指数','成交金额(万)','虚拟数据']
  233. },
  234. toolbox: {
  235. y : -30,
  236. show : true,
  237. feature : {
  238. mark : {show: true},
  239. dataZoom : {show: true},
  240. dataView : {show: true, readOnly: false},
  241. magicType : {show: true, type: ['line', 'bar']},
  242. restore : {show: true},
  243. saveAsImage : {show: true}
  244. }
  245. },
  246. dataZoom : {
  247. show : true,
  248. realtime: true,
  249. start : 50,
  250. end : 100
  251. },
  252. grid: {
  253. x: 80,
  254. y:5,
  255. x2:20,
  256. y2:40
  257. },
  258. xAxis : [
  259. {
  260. type : 'category',
  261. position:'top',
  262. boundaryGap : true,
  263. axisLabel:{show:false},
  264. axisTick: {onGap:false},
  265. splitLine: {show:false},
  266. data : axisData
  267. }
  268. ],
  269. yAxis : [
  270. {
  271. type : 'value',
  272. scale:true,
  273. splitNumber: 3,
  274. boundaryGap: [0.05, 0.05],
  275. axisLabel: {
  276. formatter: function (v) {
  277. return Math.round(v/10000) + ' 万'
  278. }
  279. },
  280. splitArea : {show : true}
  281. }
  282. ],
  283. series : [
  284. {
  285. name:'成交金额(万)',
  286. type:'line',
  287. symbol: 'none',
  288. data:[
  289. 13560434, 8026738.5, 11691637, 12491697, 12485603,
  290. 11620504, 12555496, 15253370, 12709611, 10458354,
  291. 10933507, 9896523, 10365702, 10633095, 9722230,
  292. 12662783, 8757982, 7764234, 10591719, 8826293,
  293. 11591827, 11153111, 14304651, 11672120, 12536480,
  294. 12608589, 8843860, 7391994.5, 10063709, 7768895.5,
  295. 6921859, 10157810, 8148617.5, 7551207, 11397426,
  296. 10478607, 8595132, 8541862, 9181132, 8570842,
  297. 10759351, 7335819, 6699753.5, 7759666.5, 6880135.5,
  298. 7366616.5, 7313504, 7109021.5, 6213270, 5619688,
  299. 5816217.5, 6695584.5, 5998655.5, 6188812.5, 9538301,
  300. 8224500, 8221751.5, 7897721, 8448324, 6525151,
  301. 5987761, 7831570, 8162560.5, 7904092, 8139084.5,
  302. 9116529, 8128014, 7919148, 7566047, 6665826.5,
  303. 10225527, 11124881, 12884353, 11302521, 11529046,
  304. 11105205, 9202153, 9992016, 12035250, 11431155,
  305. 10354677, 10070399, 9164861, 9237718, 7114268,
  306. 7526158.5, 8105835, 7971452.5
  307. ],
  308. markLine : {
  309. symbol : 'none',
  310. itemStyle : {
  311. normal : {
  312. color:'#1e90ff',
  313. label : {
  314. show:false
  315. }
  316. }
  317. },
  318. data : [
  319. {type : 'average', name: '平均值'}
  320. ]
  321. }
  322. }
  323. ]
  324. };
  325. myChart2 = echarts.init(document.getElementById('main2'));
  326. myChart2.setOption(option2);
  327. option3 = {
  328. tooltip : {
  329. trigger: 'axis',
  330. showDelay: 0 // 显示延迟,添加显示延迟可以避免频繁切换,单位ms
  331. },
  332. legend: {
  333. y : -30,
  334. data:['上证指数','成交金额(万)','虚拟数据']
  335. },
  336. toolbox: {
  337. y : -30,
  338. show : true,
  339. feature : {
  340. mark : {show: true},
  341. dataZoom : {show: true},
  342. dataView : {show: true, readOnly: false},
  343. magicType : {show: true, type: ['line', 'bar']},
  344. restore : {show: true},
  345. saveAsImage : {show: true}
  346. }
  347. },
  348. dataZoom : {
  349. y:200,
  350. show : true,
  351. realtime: true,
  352. start : 50,
  353. end : 100
  354. },
  355. grid: {
  356. x: 80,
  357. y:5,
  358. x2:20,
  359. y2:30
  360. },
  361. xAxis : [
  362. {
  363. type : 'category',
  364. position:'bottom',
  365. boundaryGap : true,
  366. axisTick: {onGap:false},
  367. splitLine: {show:false},
  368. data : axisData
  369. }
  370. ],
  371. yAxis : [
  372. {
  373. type : 'value',
  374. scale:true,
  375. splitNumber:3,
  376. boundaryGap: [0.05, 0.05],
  377. axisLabel: {
  378. formatter: function (v) {
  379. return Math.round(v/10000) + ' 万'
  380. }
  381. },
  382. splitArea : {show : true}
  383. }
  384. ],
  385. series : [
  386. {
  387. name:'虚拟数据',
  388. type:'bar',
  389. symbol: 'none',
  390. data:[
  391. 560434, 226738, 696370, 249697, 248563,
  392. 620504, 555496, 525337, 270968, 458354,
  393. 933507, 896523, 365702, 633095, 722230,
  394. 662783, 875798, 776423, 105979, 882629,
  395. 598278, 231253, 430465, 672208, 253648,
  396. 608589, 884386, 739994, 263709, 776889,
  397. 692859, 105780, 848675, 755207, 397426,
  398. 478607, 859532, 854862, 983288, 857084,
  399. 759358, 733589, 669975, 775965, 688035,
  400. 736666, 733504, 709025, 623270, 569688,
  401. 586275, 669558, 599865, 688825, 953830,
  402. 822450, 822755, 789772, 844832, 652558,
  403. 598776, 783570, 862560, 794092, 839084,
  404. 965298, 828048, 799480, 756647, 665826,
  405. 102257, 248870, 288435, 302528, 529046,
  406. 105205, 920253, 999206, 203525, 435588,
  407. 103546, 703990, 964868, 923778, 742688,
  408. 752658, 805835, 797452
  409. ],
  410. markLine : {
  411. symbol : 'none',
  412. itemStyle : {
  413. normal : {
  414. color:'#1e90ff',
  415. label : {
  416. show:false
  417. }
  418. }
  419. },
  420. data : [
  421. {type : 'average', name: '平均值'}
  422. ]
  423. }
  424. }
  425. ]
  426. };
  427. myChart3 = echarts.init(document.getElementById('main3'));
  428. myChart3.setOption(option3);
  429. myChart.connect([myChart2, myChart3]);
  430. myChart2.connect([myChart, myChart3]);
  431. myChart3.connect([myChart, myChart2]);
  432. setTimeout(function (){
  433. window.onresize = function () {
  434. myChart.resize();
  435. myChart2.resize();
  436. myChart3.resize();
  437. }
  438. },200)
  439. </textarea>
  440. </div><!--/.well -->
  441. </div><!--/span-->
  442. <div id="graphic" class="col-md-8">
  443. <div id="main" class="main" style='height:230px;margin-bottom:1px;padding-bottom:0;border-bottom-width:0'></div>
  444. <div id="main2" class="main" style='height:145px;margin-bottom:1px;padding:1px 10px;border-width:0 1px;'></div>
  445. <div id="main3" class="main" style='height:105px;padding-top:1px;border-top-width:0'></div>
  446. <div>
  447. <button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
  448. <span class="text-primary">切换主题</span>
  449. <select id="theme-select"></select>
  450. <span id='wrong-message' style="color:red"></span>
  451. </div>
  452. </div><!--/span-->
  453. </div><!--/row-->
  454. </div><!--/.fluid-container-->
  455. <footer id="footer"></footer>
  456. <!-- Le javascript
  457. ================================================== -->
  458. <!-- Placed at the end of the document so the pages load faster -->
  459. <script src="../asset/js/jquery.min.js"></script>
  460. <script type="text/javascript" src="../asset/js/echartsHome.js"></script>
  461. <script src="../asset/js/bootstrap.min.js"></script>
  462. <script src="../asset/js/echartsExample.js"></script>
  463. <script type="text/javascript">
  464. function refresh(isBtnRefresh){
  465. if (isBtnRefresh) {
  466. needRefresh = true;
  467. focusGraphic();
  468. myChart2.showLoading();
  469. myChart3.showLoading();
  470. return;
  471. }
  472. needRefresh = false;
  473. myChart = echarts.init(domMain);
  474. (new Function(editor.doc.getValue()))();
  475. myChart.setOption(option, true);
  476. domMessage.innerHTML = '';
  477. window.onresize = function () {
  478. myChart.resize();
  479. myChart2.resize();
  480. myChart3.resize();
  481. }
  482. }
  483. </script>
  484. </body>
  485. </html>