visualMap-layout.html 16 KB

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