css-transform.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <!DOCTYPE>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <script src="lib/esl.js"></script>
  6. <script src="lib/config.js"></script>
  7. <script src="lib/jquery.min.js"></script>
  8. <script src="lib/facePrint.js"></script>
  9. <meta name="viewport" content="width=device-width, initial-scale=1" />
  10. <link rel="stylesheet" href="lib/reset.css">
  11. </head>
  12. <body>
  13. <style>
  14. body {
  15. position: relative;
  16. min-height: 1500px;
  17. }
  18. .chart {
  19. position: relative;
  20. width: 500px;
  21. height: 300px;
  22. border: 10px solid rgba(0,0,0,0.5);
  23. margin: 30px auto 30px auto;
  24. }
  25. </style>
  26. <h3>Check whether tooltip behave correctly (in mouse position calculation).</h3>
  27. <h3>Supported browser when using transfrom:</h3>
  28. <ul>
  29. <li>PC: Chrome, FireFox, IE6+, Edge, Safari, Opera</li>
  30. <li>Mobild: Andriod (?)</li>
  31. </ul>
  32. <h3>Unsupported browser when using transfrom:</h3>
  33. <ul>
  34. <li>Mobild: IOS</li>
  35. </ul>
  36. <div class="chart" id="main0"
  37. style="
  38. -webkit-transform: scale(0.5, 0.5) rotate(15deg);
  39. transform: scale(0.5, 0.5) rotate(15deg);
  40. ">
  41. </div>
  42. <div style="perspective: 171px;">
  43. <div class="chart" id="main1"
  44. style="
  45. -webkit-transform: rotateY(18deg) rotateX(8deg);
  46. transform: rotateY(18deg) rotateX(8deg);
  47. -webkit-transform-style: preserve-3d;
  48. transform-style: preserve-3d;
  49. ">
  50. </div>
  51. </div>
  52. <script>
  53. require([
  54. 'echarts'
  55. // 'echarts/chart/line',
  56. // 'echarts/component/legend',
  57. // 'echarts/component/grid',
  58. // 'echarts/component/tooltip',
  59. // 'echarts/component/dataZoomInside'
  60. ], function (echarts) {
  61. var el = document.getElementById('main0');
  62. if (!el) {
  63. return;
  64. }
  65. var chart = echarts.init(el);
  66. var xAxisData = [];
  67. var data1 = [];
  68. var data2 = [];
  69. var data3 = [];
  70. for (var i = 0; i < 100; i++) {
  71. xAxisData.push('类目' + i);
  72. if (i < 5 && i > 1) {
  73. data1.push(0);
  74. }
  75. else {
  76. data1.push(+(Math.random() + 0.5).toFixed(3));
  77. }
  78. data2.push(+(Math.random() + 0.5).toFixed(3));
  79. data3.push(+(Math.random() + 0.5).toFixed(3));
  80. }
  81. var itemStyle = {
  82. normal: {
  83. borderColor: 'white',
  84. borderWidth: 3,
  85. // shadowBlur: 10,
  86. // shadowOffsetX: 0,
  87. // shadowOffsetY: 5,
  88. // shadowColor: 'rgba(0, 0, 0, 0.4)',
  89. lineStyle: {
  90. width: 1
  91. // shadowBlur: 10,
  92. // shadowOffsetX: 0,
  93. // shadowOffsetY: 5,
  94. // shadowColor: 'rgba(0, 0, 0, 0.4)'
  95. }
  96. }
  97. };
  98. chart.setOption({
  99. legend: {
  100. data: ['line', 'line2', 'line3']
  101. },
  102. visualMap: null, // 用于测试 option 中含有null的情况。
  103. tooltip: {
  104. trigger: 'axis',
  105. axisPointer: {
  106. type: 'line'
  107. }
  108. },
  109. xAxis: {
  110. // data: ['类目1', '类目2', '类目3', '类目4', '类目5',]
  111. data: xAxisData,
  112. boundaryGap: false,
  113. // inverse: true,
  114. splitArea: {
  115. show: false
  116. },
  117. splitLine: {
  118. show: false
  119. }
  120. },
  121. grid: {
  122. left: '10%',
  123. right: '10%'
  124. },
  125. yAxis: {
  126. splitArea: {
  127. show: true
  128. }
  129. },
  130. dataZoom: {
  131. type: 'inside',
  132. start: 10,
  133. end: 30
  134. },
  135. // animation: false,
  136. series: [null, // 用于测试 option 中含有null的情况。
  137. {
  138. name: 'line',
  139. type: 'line',
  140. stack: 'all',
  141. symbol: 'circle',
  142. symbolSize: 10,
  143. data: data1,
  144. itemStyle: itemStyle,
  145. step: 'end'
  146. }, {
  147. name: 'line2',
  148. type: 'line',
  149. stack: 'all',
  150. symbol: 'circle',
  151. symbolSize: 10,
  152. data: data2,
  153. itemStyle: itemStyle,
  154. step: 'end'
  155. }, {
  156. name: 'line3',
  157. type: 'line',
  158. stack: 'all',
  159. symbol: 'triangle',
  160. symbolSize: 10,
  161. data: data3,
  162. itemStyle: itemStyle,
  163. step: 'end'
  164. }]
  165. });
  166. });
  167. </script>
  168. <script>
  169. require([
  170. 'echarts'
  171. // 'echarts/chart/line',
  172. // 'echarts/component/legend',
  173. // 'echarts/component/grid',
  174. // 'echarts/component/tooltip',
  175. // 'echarts/component/dataZoomInside'
  176. ], function (echarts) {
  177. var el = document.getElementById('main1');
  178. if (!el) {
  179. return;
  180. }
  181. var chart = echarts.init(el);
  182. var xAxisData = [];
  183. var data1 = [];
  184. var data2 = [];
  185. var data3 = [];
  186. for (var i = 0; i < 100; i++) {
  187. xAxisData.push('类目' + i);
  188. if (i < 5 && i > 1) {
  189. data1.push(0);
  190. }
  191. else {
  192. data1.push(+(Math.random() + 0.5).toFixed(3));
  193. }
  194. data2.push(+(Math.random() + 0.5).toFixed(3));
  195. data3.push(+(Math.random() + 0.5).toFixed(3));
  196. }
  197. var itemStyle = {
  198. normal: {
  199. borderColor: 'white',
  200. borderWidth: 3,
  201. // shadowBlur: 10,
  202. // shadowOffsetX: 0,
  203. // shadowOffsetY: 5,
  204. // shadowColor: 'rgba(0, 0, 0, 0.4)',
  205. lineStyle: {
  206. width: 1
  207. // shadowBlur: 10,
  208. // shadowOffsetX: 0,
  209. // shadowOffsetY: 5,
  210. // shadowColor: 'rgba(0, 0, 0, 0.4)'
  211. }
  212. }
  213. };
  214. chart.setOption({
  215. legend: {
  216. data: ['line', 'line2', 'line3']
  217. },
  218. visualMap: null, // 用于测试 option 中含有null的情况。
  219. tooltip: {
  220. trigger: 'axis',
  221. axisPointer: {
  222. type: 'line'
  223. }
  224. },
  225. xAxis: {
  226. // data: ['类目1', '类目2', '类目3', '类目4', '类目5',]
  227. data: xAxisData,
  228. boundaryGap: false,
  229. // inverse: true,
  230. splitArea: {
  231. show: false
  232. },
  233. splitLine: {
  234. show: false
  235. }
  236. },
  237. grid: {
  238. left: '10%',
  239. right: '10%'
  240. },
  241. yAxis: {
  242. splitArea: {
  243. show: true
  244. }
  245. },
  246. dataZoom: {
  247. type: 'inside',
  248. start: 10,
  249. end: 30
  250. },
  251. // animation: false,
  252. series: [null, // 用于测试 option 中含有null的情况。
  253. {
  254. name: 'line',
  255. type: 'line',
  256. stack: 'all',
  257. symbol: 'circle',
  258. symbolSize: 10,
  259. data: data1,
  260. itemStyle: itemStyle,
  261. step: 'end'
  262. }, {
  263. name: 'line2',
  264. type: 'line',
  265. stack: 'all',
  266. symbol: 'circle',
  267. symbolSize: 10,
  268. data: data2,
  269. itemStyle: itemStyle,
  270. step: 'end'
  271. }, {
  272. name: 'line3',
  273. type: 'line',
  274. stack: 'all',
  275. symbol: 'triangle',
  276. symbolSize: 10,
  277. data: data3,
  278. itemStyle: itemStyle,
  279. step: 'end'
  280. }]
  281. });
  282. });
  283. </script>
  284. </body>
  285. </html>