toolbox.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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. </head>
  26. <body>
  27. <!-- Fixed navbar -->
  28. <div class="navbar navbar-default navbar-fixed-top" role="navigation" id="head"></div>
  29. <div class="container-fluid">
  30. <div class="row-fluid example">
  31. <div id="sidebar-code" class="col-md-4">
  32. <div class="well sidebar-nav">
  33. <div class="nav-header"><a href="#" onclick="autoResize()" class="glyphicon glyphicon-resize-full" id ="icon-resize" ></a>option</div>
  34. <textarea id="code" name="code">
  35. option = {
  36. tooltip : {
  37. trigger: 'axis'
  38. },
  39. legend: {
  40. data:['最高','最低']
  41. },
  42. toolbox: {
  43. show : true,
  44. orient: 'horizontal', // 布局方式,默认为水平布局,可选为:
  45. // 'horizontal' ¦ 'vertical'
  46. x: 'right', // 水平安放位置,默认为全图右对齐,可选为:
  47. // 'center' ¦ 'left' ¦ 'right'
  48. // ¦ {number}(x坐标,单位px)
  49. y: 'top', // 垂直安放位置,默认为全图顶端,可选为:
  50. // 'top' ¦ 'bottom' ¦ 'center'
  51. // ¦ {number}(y坐标,单位px)
  52. color : ['#1e90ff','#22bb22','#4b0082','#d2691e'],
  53. backgroundColor: 'rgba(0,0,0,0)', // 工具箱背景颜色
  54. borderColor: '#ccc', // 工具箱边框颜色
  55. borderWidth: 0, // 工具箱边框线宽,单位px,默认为0(无边框)
  56. padding: 5, // 工具箱内边距,单位px,默认各方向内边距为5,
  57. showTitle: true,
  58. feature : {
  59. mark : {
  60. show : true,
  61. title : {
  62. mark : '辅助线-开关',
  63. markUndo : '辅助线-删除',
  64. markClear : '辅助线-清空'
  65. },
  66. lineStyle : {
  67. width : 1,
  68. color : '#1e90ff',
  69. type : 'dashed'
  70. }
  71. },
  72. dataZoom : {
  73. show : true,
  74. title : {
  75. dataZoom : '区域缩放',
  76. dataZoomReset : '区域缩放-后退'
  77. }
  78. },
  79. dataView : {
  80. show : true,
  81. title : '数据视图',
  82. readOnly: true,
  83. lang : ['数据视图', '关闭', '刷新'],
  84. optionToContent: function(opt) {
  85. var axisData = opt.xAxis[0].data;
  86. var series = opt.series;
  87. var table = '<table style="width:100%;text-align:center"><tbody><tr>'
  88. + '<td>时间</td>'
  89. + '<td>' + series[0].name + '</td>'
  90. + '<td>' + series[1].name + '</td>'
  91. + '</tr>';
  92. for (var i = 0, l = axisData.length; i < l; i++) {
  93. table += '<tr>'
  94. + '<td>' + axisData[i] + '</td>'
  95. + '<td>' + series[0].data[i] + '</td>'
  96. + '<td>' + series[1].data[i] + '</td>'
  97. + '</tr>';
  98. }
  99. table += '</tbody></table>';
  100. return table;
  101. }
  102. },
  103. magicType: {
  104. show : true,
  105. title : {
  106. line : '动态类型切换-折线图',
  107. bar : '动态类型切换-柱形图',
  108. stack : '动态类型切换-堆积',
  109. tiled : '动态类型切换-平铺'
  110. },
  111. type : ['line', 'bar', 'stack', 'tiled']
  112. },
  113. restore : {
  114. show : true,
  115. title : '还原',
  116. color : 'black'
  117. },
  118. saveAsImage : {
  119. show : true,
  120. title : '保存为图片',
  121. type : 'jpeg',
  122. lang : ['点击本地保存']
  123. },
  124. myTool : {
  125. show : true,
  126. title : '自定义扩展方法',
  127. icon : 'image://../asset/ico/favicon.png',
  128. onclick : function (){
  129. alert('myToolHandler')
  130. }
  131. }
  132. }
  133. },
  134. calculable : true,
  135. dataZoom : {
  136. show : true,
  137. realtime : true,
  138. start : 20,
  139. end : 80
  140. },
  141. xAxis : [
  142. {
  143. type : 'category',
  144. boundaryGap : false,
  145. data : function (){
  146. var list = [];
  147. for (var i = 1; i <= 30; i++) {
  148. list.push('2013-03-' + i);
  149. }
  150. return list;
  151. }()
  152. }
  153. ],
  154. yAxis : [
  155. {
  156. type : 'value'
  157. }
  158. ],
  159. series : [
  160. {
  161. name:'最高',
  162. type:'line',
  163. data:function (){
  164. var list = [];
  165. for (var i = 1; i <= 30; i++) {
  166. list.push(Math.round(Math.random()* 30));
  167. }
  168. return list;
  169. }()
  170. },
  171. {
  172. name:'最低',
  173. type:'line',
  174. data:function (){
  175. var list = [];
  176. for (var i = 1; i <= 30; i++) {
  177. list.push(Math.round(Math.random()* 10));
  178. }
  179. return list;
  180. }()
  181. }
  182. ]
  183. };
  184. </textarea>
  185. </div><!--/.well -->
  186. </div><!--/span-->
  187. <div id="graphic" class="col-md-8">
  188. <div id="main" class="main"></div>
  189. <div>
  190. <button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
  191. <span class="text-primary">切换主题</span>
  192. <select id="theme-select"></select>
  193. <span id='wrong-message' style="color:red"></span>
  194. </div>
  195. </div><!--/span-->
  196. </div><!--/row-->
  197. </div><!--/.fluid-container-->
  198. <footer id="footer"></footer>
  199. <!-- Le javascript
  200. ================================================== -->
  201. <!-- Placed at the end of the document so the pages load faster -->
  202. <script src="../asset/js/jquery.min.js"></script>
  203. <script type="text/javascript" src="../asset/js/echartsHome.js"></script>
  204. <script src="../asset/js/bootstrap.min.js"></script>
  205. <script src="../asset/js/echartsExample.js"></script>
  206. </body>
  207. </html>