index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <template>
  2. <div class="chart-wrap">
  3. <v-chart autoresize :option="option"/>
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. name: 'SyjhdxqkChart',
  9. data() {
  10. return {
  11. option: {}
  12. }
  13. },
  14. created() {
  15. this.getOption()
  16. },
  17. methods: {
  18. getOption() {
  19. const baseWidth = 20
  20. const offsetWidth = 15
  21. const triangleHeight = 8
  22. this.option = {
  23. backgroundColor: 'rgb(2, 10, 33)',
  24. color: [],
  25. grid: {
  26. containLabel: true,
  27. left: 20,
  28. right: 20,
  29. bottom: 60,
  30. top: 40
  31. },
  32. xAxis: {
  33. data: ['第一季度', '第二季度', '第三季度', '第四季度'],
  34. position: 'bottom',
  35. type: 'category'
  36. },
  37. yAxis: {
  38. axisLabel: {
  39. color: '#ffffff',
  40. fontSize: 14
  41. },
  42. axisTick: {
  43. lineStyle: {
  44. color: '#384267',
  45. width: 0
  46. },
  47. show: true
  48. },
  49. splitLine: {
  50. show: false,
  51. lineStyle: {
  52. color: '#384267',
  53. type: 'dashed'
  54. }
  55. },
  56. axisLine: {
  57. lineStyle: {
  58. color: '#ffffff',
  59. width: 0,
  60. type: 'dashed'
  61. },
  62. show: true
  63. },
  64. name: ''
  65. },
  66. series: [
  67. {
  68. data: [200, 85, 112, 275],
  69. type: 'pictorialBar',
  70. symbol: 'rect',
  71. symbolSize: ['100%', '100%'],
  72. symbolOffset: [-offsetWidth, 0],
  73. barMaxWidth: 'auto',
  74. barWidth: baseWidth,
  75. itemStyle: {
  76. color: {
  77. x: 0,
  78. y: 0,
  79. x2: 0,
  80. y2: 1,
  81. type: 'linear',
  82. global: false,
  83. colorStops: [
  84. {
  85. offset: 0,
  86. color: 'rgb(106, 169, 216)'
  87. },
  88. {
  89. offset: 1,
  90. color: 'rgb(54, 125, 181)'
  91. }
  92. ]
  93. }
  94. },
  95. zlevel: 1
  96. },
  97. {
  98. data: [1, 1, 1, 1],
  99. type: 'pictorialBar',
  100. symbol: 'triangle',
  101. symbolRotate: 180,
  102. symbolOffset: [-offsetWidth, '96%'],
  103. symbolSize: ['100%', triangleHeight],
  104. barMaxWidth: 'auto',
  105. barWidth: baseWidth,
  106. itemStyle: {
  107. color: 'rgb(54, 125, 181)'
  108. },
  109. zlevel: 1
  110. },
  111. {
  112. data: [200, 85, 112, 275],
  113. type: 'pictorialBar',
  114. symbolPosition: 'end',
  115. symbol: 'triangle',
  116. symbolRotate: 180,
  117. symbolSize: [baseWidth, triangleHeight],
  118. symbolOffset: [-offsetWidth, '-0%'],
  119. barMaxWidth: 'auto',
  120. barWidth: baseWidth,
  121. itemStyle: {
  122. color: 'rgb(159, 214, 253)'
  123. },
  124. zlevel: 2
  125. },
  126. {
  127. data: [600, 541, 741, 741],
  128. type: 'pictorialBar',
  129. symbol: 'rect',
  130. symbolSize: [baseWidth, '100%'],
  131. symbolOffset: [-offsetWidth, 0],
  132. barMaxWidth: 'auto',
  133. barWidth: baseWidth,
  134. itemStyle: {
  135. color: {
  136. x: 0,
  137. y: 0,
  138. x2: 0,
  139. y2: 1,
  140. type: 'linear',
  141. global: false,
  142. colorStops: [
  143. {
  144. offset: 0,
  145. color: 'rgb(35, 55, 81)'
  146. },
  147. {
  148. offset: 1,
  149. color: 'rgb(30, 52, 75)'
  150. }
  151. ]
  152. }
  153. },
  154. label: {
  155. show: true,
  156. distance: 10,
  157. color: '#fff',
  158. position: [-baseWidth + 5, -20]
  159. },
  160. zlevel: -1
  161. },
  162. {
  163. data: [600, 541, 741, 741],
  164. type: 'pictorialBar',
  165. symbolPosition: 'end',
  166. symbol: 'triangle',
  167. symbolRotate: 180,
  168. symbolSize: [baseWidth, triangleHeight],
  169. symbolOffset: [-offsetWidth, '0%'],
  170. barMaxWidth: 'auto',
  171. barWidth: baseWidth,
  172. itemStyle: {
  173. color: 'rgb(49, 70, 97)'
  174. },
  175. zlevel: 1
  176. },
  177. // 2
  178. {
  179. data: [160, 410, 112, 275],
  180. type: 'pictorialBar',
  181. symbol: 'rect',
  182. symbolSize: [baseWidth, '100%'],
  183. symbolOffset: [offsetWidth, '0%'],
  184. barMaxWidth: 'auto',
  185. barWidth: baseWidth,
  186. itemStyle: {
  187. color: {
  188. x: 0,
  189. y: 0,
  190. x2: 0,
  191. y2: 1,
  192. type: 'linear',
  193. global: false,
  194. colorStops: [
  195. {
  196. offset: 0,
  197. color: 'rgb(107, 204, 220)'
  198. },
  199. {
  200. offset: 1,
  201. color: 'rgb(57, 154, 178)'
  202. }
  203. ]
  204. }
  205. },
  206. zlevel: 1
  207. },
  208. {
  209. data: [1, 1, 1, 1],
  210. type: 'pictorialBar',
  211. symbol: 'triangle',
  212. symbolRotate: 180,
  213. symbolSize: [baseWidth, triangleHeight],
  214. symbolOffset: [offsetWidth, '96%'],
  215. barMaxWidth: 'auto',
  216. barWidth: baseWidth,
  217. itemStyle: {
  218. color: 'rgb(57, 154, 178)'
  219. },
  220. zlevel: 1
  221. },
  222. {
  223. data: [160, 410, 112, 275],
  224. type: 'pictorialBar',
  225. symbolPosition: 'end',
  226. symbol: 'triangle',
  227. symbolRotate: 180,
  228. symbolSize: [baseWidth, triangleHeight],
  229. symbolOffset: [offsetWidth, '0%'],
  230. barMaxWidth: 'auto',
  231. barWidth: baseWidth,
  232. itemStyle: {
  233. color: 'rgb(159, 214, 253)'
  234. },
  235. zlevel: 2
  236. },
  237. {
  238. data: [580, 541, 741, 420],
  239. type: 'pictorialBar',
  240. symbol: 'rect',
  241. symbolSize: [baseWidth, '100%'],
  242. symbolOffset: [offsetWidth, '0%'],
  243. barMaxWidth: 'auto',
  244. barWidth: baseWidth,
  245. itemStyle: {
  246. color: {
  247. x: 0,
  248. y: 0,
  249. x2: 0,
  250. y2: 1,
  251. type: 'linear',
  252. global: false,
  253. colorStops: [
  254. {
  255. offset: 0,
  256. color: 'rgb(33, 59, 72)'
  257. },
  258. {
  259. offset: 1,
  260. color: 'rgb(30, 64, 78)'
  261. }
  262. ]
  263. }
  264. },
  265. label: {
  266. show: true,
  267. distance: 10,
  268. color: '#fff',
  269. position: [baseWidth - 5, -20]
  270. },
  271. zlevel: -1
  272. },
  273. {
  274. data: [580, 541, 741, 420],
  275. type: 'pictorialBar',
  276. symbolPosition: 'end',
  277. symbol: 'triangle',
  278. symbolRotate: 180,
  279. symbolSize: [baseWidth, triangleHeight],
  280. symbolOffset: [offsetWidth, '0%'],
  281. barMaxWidth: 'auto',
  282. barWidth: baseWidth,
  283. itemStyle: {
  284. color: 'rgb(49, 70, 97)'
  285. },
  286. zlevel: 1
  287. }
  288. ],
  289. tooltip: {
  290. trigger: 'axis',
  291. show: false
  292. }
  293. }
  294. }
  295. }
  296. }
  297. </script>
  298. <style scoped lang="scss">
  299. $xHeight: 120px;
  300. .chart-wrap {
  301. width: 100%;
  302. height: 100%;
  303. .left-bar {
  304. width: 35px;
  305. display: inline-block;
  306. }
  307. .right-conent {
  308. width: calc(100% - 35px);
  309. height: 100%;
  310. display: grid;
  311. grid-template-columns: 1fr 1fr 1fr 1fr;
  312. grid-template-rows: auto $xHeight;
  313. }
  314. }
  315. </style>