visualMap-layout.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. <html>
  2. <head>
  3. <meta charset="utf-8">
  4. <script src="esl.js"></script>
  5. <script src="config.js"></script>
  6. <link rel="stylesheet" href="reset.css">
  7. <style>
  8. #main {
  9. position: relative;
  10. min-width: 1080px;
  11. }
  12. .block {
  13. text-align: center;
  14. display: inline-block;
  15. *display: inline;
  16. *zoom: 1;
  17. position: relative;
  18. height: 400px;
  19. margin: 20px;
  20. }
  21. .block .ec {
  22. float: left;
  23. width: 600px;
  24. height: 100%;
  25. border: 3px solid #777;
  26. }
  27. .block label {
  28. margin-left: 500px;
  29. display: block;
  30. width: 400px;
  31. height: 100%;
  32. background: #777;
  33. color: #fff;
  34. font-size: 12px;
  35. line-height: 18px;
  36. border: 3px solid #777;
  37. text-align: left;
  38. overflow: auto;
  39. }
  40. </style>
  41. </head>
  42. <body>
  43. <div id="main"></div>
  44. <script>
  45. require([
  46. 'echarts',
  47. 'zrender/core/util',
  48. 'echarts/chart/scatter',
  49. 'echarts/component/grid',
  50. 'echarts/component/visualMap'
  51. ], function (echarts, zrUtil) {
  52. makeChart({
  53. show: true,
  54. splitNumber: 7,
  55. minOpen: true,
  56. maxOpen: true,
  57. backgroundColor: '#eee',
  58. padding: [10, 30, 5, 40],
  59. visualSelected: {
  60. data: ['red', 'pink']
  61. }
  62. });
  63. makeChart({
  64. show: true,
  65. splitNumber: 7,
  66. minOpen: true,
  67. maxOpen: true,
  68. showLabel: true,
  69. text: ['Number Result'],
  70. backgroundColor: '#eee',
  71. padding: [10, 30, 5, 40],
  72. visualSelected: {
  73. data: ['red', 'pink']
  74. }
  75. });
  76. makeChart({
  77. show: true,
  78. pieces: [
  79. {min: 10, max: 15, color: 'green'},
  80. {min: 15, max: 25, visualValue: 'blue'},
  81. {min: 25, max: 35},
  82. {min: 35, max: 55},
  83. {min: 55}
  84. ],
  85. left: 200,
  86. backgroundColor: '#eee',
  87. visualSelected: {
  88. data: ['red', 'pink']
  89. }
  90. });
  91. makeChart({
  92. splitNumber: 5,
  93. right: 0,
  94. dimension: 3,
  95. backgroundColor: '#eee',
  96. visualSelected: {
  97. type: 'symbol',
  98. data: ['roundRect', 'rect', 'diamond', 'line', 'circle']
  99. }
  100. });
  101. makeChart({
  102. splitNumber: 5,
  103. right: 0,
  104. dimension: 3,
  105. text: ['Number Result'],
  106. showLabel: true,
  107. backgroundColor: '#eee',
  108. visualSelected: {
  109. type: 'symbol',
  110. data: ['roundRect', 'rect', 'diamond', 'line', 'circle']
  111. }
  112. });
  113. makeChart({
  114. splitNumber: 6,
  115. top: 0,
  116. left: 0,
  117. orient: 'horizontal',
  118. dimension: 3,
  119. backgroundColor: '#eee',
  120. visualSelected: {
  121. type: 'colorSaturation'
  122. }
  123. });
  124. makeChart({
  125. splitNumber: 5,
  126. top: 20,
  127. right: 0,
  128. orient: 'horizontal',
  129. dimension: 3,
  130. backgroundColor: '#eee',
  131. visualSelected: {
  132. type: 'colorLightness'
  133. }
  134. });
  135. makeChart({
  136. splitNumber: 5,
  137. top: 20,
  138. right: 0,
  139. text: ['Number \nRe', 'Number \nRe2'],
  140. showLabel: true,
  141. orient: 'horizontal',
  142. dimension: 3,
  143. backgroundColor: '#eee',
  144. visualSelected: {
  145. type: 'colorLightness'
  146. }
  147. });
  148. makeChart({
  149. splitNumber: 6,
  150. top: 40,
  151. orient: 'horizontal',
  152. align: 'right',
  153. dimension: 3,
  154. backgroundColor: '#eee',
  155. visualSelected: {
  156. type: 'colorAlpha'
  157. }
  158. });
  159. // -------------------------------------------
  160. makeChart({
  161. show: true,
  162. splitNumber: 7,
  163. text: ['高1', '低'],
  164. inverse: true,
  165. backgroundColor: '#eee',
  166. padding: [10, 30, 5, 40],
  167. visualSelected: {
  168. data: ['red', 'pink']
  169. }
  170. });
  171. makeChart({
  172. show: true,
  173. pieces: [
  174. {min: 10, max: 15, color: 'green'},
  175. {min: 15, max: 25, visualValue: 'blue'},
  176. {min: 25, max: 35},
  177. {min: 35, max: 55},
  178. {min: 55}
  179. ],
  180. left: 200,
  181. text: ['高', '低'],
  182. backgroundColor: '#eee',
  183. visualSelected: {
  184. data: ['red', 'pink']
  185. }
  186. });
  187. makeChart({
  188. splitNumber: 5,
  189. right: 0,
  190. dimension: 3,
  191. text: ['高', '低'],
  192. backgroundColor: '#eee',
  193. visualSelected: {
  194. type: 'symbol',
  195. data: ['roundRect', 'rect', 'diamond', 'line', 'circle']
  196. }
  197. });
  198. makeChart({
  199. splitNumber: 6,
  200. top: 0,
  201. left: 0,
  202. orient: 'horizontal',
  203. dimension: 3,
  204. text: ['高', '低'],
  205. backgroundColor: '#eee',
  206. visualSelected: {
  207. type: 'colorSaturation'
  208. }
  209. });
  210. makeChart({
  211. splitNumber: 5,
  212. top: 20,
  213. right: 0,
  214. orient: 'horizontal',
  215. dimension: 3,
  216. text: ['高', '低'],
  217. backgroundColor: '#eee',
  218. visualSelected: {
  219. type: 'colorLightness'
  220. }
  221. });
  222. makeChart({
  223. splitNumber: 6,
  224. top: 40,
  225. orient: 'horizontal',
  226. dimension: 3,
  227. text: ['高', '低'],
  228. backgroundColor: '#eee',
  229. visualSelected: {
  230. type: 'colorAlpha'
  231. }
  232. });
  233. // -------------------------------------------
  234. makeChart({
  235. show: true,
  236. splitNumber: 0,
  237. backgroundColor: '#eee',
  238. padding: [10, 30, 5, 40],
  239. calculable: true,
  240. inRange: {
  241. color: ['red', 'pink']
  242. }
  243. });
  244. makeChart({
  245. left: 200,
  246. show: true,
  247. pieces: [
  248. {min: 10, max: 15, color: 'green'},
  249. {min: 15, max: 25, visualValue: 'blue'},
  250. {min: 25, max: 35},
  251. {min: 35, max: 55},
  252. {min: 55}
  253. ],
  254. inverse: true,
  255. calculable: true,
  256. backgroundColor: '#eee',
  257. inRange: {
  258. color: ['red', 'pink']
  259. }
  260. });
  261. makeChart({
  262. right: 0,
  263. splitNumber: 5,
  264. calculable: true,
  265. dimension: 3,
  266. backgroundColor: '#eee',
  267. inRange: {
  268. color: ['red', 'pink']
  269. }
  270. });
  271. makeChart({
  272. left: 0,
  273. top: 0,
  274. orient: 'horizontal',
  275. splitNumber: 6,
  276. calculable: true,
  277. inverse: true,
  278. dimension: 3,
  279. backgroundColor: '#eee',
  280. inRange: 'colorSaturation'
  281. });
  282. makeChart({
  283. right: 0,
  284. top: 20,
  285. orient: 'horizontal',
  286. splitNumber: 5,
  287. calculable: true,
  288. dimension: 3,
  289. backgroundColor: '#eee',
  290. inRange: 'colorLightness'
  291. });
  292. makeChart({
  293. top: 40,
  294. splitNumber: 6,
  295. orient: 'horizontal',
  296. calculable: true,
  297. dimension: 3,
  298. backgroundColor: '#eee',
  299. inRange: 'colorAlpha'
  300. });
  301. makeChart({
  302. left: 'center',
  303. top: 'bottom',
  304. orient: 'horizontal',
  305. splitNumber: 6,
  306. calculable: true,
  307. dimension: 3,
  308. backgroundColor: '#eee',
  309. inRange: 'colorAlpha'
  310. });
  311. // -------------------------------------------
  312. makeChart({
  313. show: true,
  314. splitNumber: 7,
  315. text: ['高2', '低'],
  316. backgroundColor: '#eee',
  317. inverse: true,
  318. padding: [10, 30, 5, 40],
  319. calculable: true,
  320. inRange: {
  321. color: ['red', 'pink']
  322. }
  323. });
  324. makeChart({
  325. left: 200,
  326. show: true,
  327. pieces: [
  328. {min: 10, max: 15, color: 'green'},
  329. {min: 15, max: 25, visualValue: 'blue'},
  330. {min: 25, max: 35},
  331. {min: 35, max: 55},
  332. {min: 55}
  333. ],
  334. inverse: true,
  335. text: ['高', '低'],
  336. calculable: true,
  337. backgroundColor: '#eee',
  338. inRange: {
  339. color: ['red', 'pink']
  340. }
  341. });
  342. makeChart({
  343. right: 0,
  344. splitNumber: 5,
  345. text: ['高', '低'],
  346. calculable: true,
  347. dimension: 3,
  348. backgroundColor: '#eee',
  349. inRange: {
  350. color: ['red', 'pink']
  351. }
  352. });
  353. makeChart({
  354. left: 0,
  355. top: 0,
  356. orient: 'horizontal',
  357. text: ['高', '低'],
  358. splitNumber: 6,
  359. calculable: true,
  360. inverse: true,
  361. dimension: 3,
  362. backgroundColor: '#eee',
  363. inRange: 'colorSaturation'
  364. });
  365. makeChart({
  366. right: 0,
  367. top: 20,
  368. orient: 'horizontal',
  369. text: ['高', '低'],
  370. splitNumber: 5,
  371. align: 'bottom',
  372. calculable: true,
  373. dimension: 3,
  374. backgroundColor: '#eee',
  375. inRange: 'colorLightness'
  376. });
  377. makeChart({
  378. top: 40,
  379. splitNumber: 6,
  380. orient: 'horizontal',
  381. text: ['高', '低'],
  382. calculable: true,
  383. dimension: 3,
  384. backgroundColor: '#eee',
  385. inRange: 'colorAlpha'
  386. });
  387. makeChart({
  388. left: 'center',
  389. bottom: 0,
  390. orient: 'horizontal',
  391. splitNumber: 6,
  392. text: ['高', '低'],
  393. calculable: true,
  394. dimension: 3,
  395. backgroundColor: '#eee',
  396. inRange: 'colorAlpha'
  397. });
  398. function makeChart(opt) {
  399. var label = JSON.stringify(opt, null, 4);
  400. opt = {visualMap: opt || {}};
  401. var containerEl = document.getElementById('main');
  402. var el = document.createElement('div');
  403. el.className = 'block';
  404. el.innerHTML = '<div class="ec"></div><label><pre>' + encodeHTML(label) + '</pre></label>';
  405. containerEl.appendChild(el);
  406. var chart = echarts.init(el.firstChild, null, {renderer: 'canvas'});
  407. chart.setOption(zrUtil.merge(opt, getOption()));
  408. }
  409. function encodeHTML(source) {
  410. return source == null
  411. ? ''
  412. : String(source)
  413. .replace(/&/g, '&amp;')
  414. .replace(/</g, '&lt;')
  415. .replace(/>/g, '&gt;')
  416. .replace(/"/g, '&quot;')
  417. .replace(/'/g, '&#39;');
  418. };
  419. function getOption() {
  420. return {
  421. grid: {top: 'center', left: 'center', width: 50, height: 50},
  422. xAxis: {type: 'value', splitLine: {show: false}},
  423. yAxis: {type: 'value', splitLine: {show: false}},
  424. series: [
  425. {
  426. name: 'scatter',
  427. type: 'scatter',
  428. itemStyle: {
  429. normal: {
  430. opacity: 0.8,
  431. shadowBlur: 10,
  432. shadowOffsetX: 0,
  433. shadowOffsetY: 0,
  434. shadowColor: 'rgba(0, 0, 0, 0.5)'
  435. }
  436. },
  437. symbolSize: 20,
  438. data: [[50, 50, 50, 50, 50]]
  439. }
  440. ]
  441. };
  442. }
  443. });
  444. </script>
  445. </body>
  446. </html>