echarts.ts 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. import { position } from 'html2canvas/dist/types/css/property-descriptors/position'
  2. export const lineChartOption = {
  3. legend: { show: false },
  4. emphasis: { lineStyle: { width: 2 } },
  5. xAxis: {
  6. boundaryGap: false,
  7. data: [
  8. '01月',
  9. '02月',
  10. '03月',
  11. '04月',
  12. '05月',
  13. '06月',
  14. '07月',
  15. '08月',
  16. '09月',
  17. '10月',
  18. '11月',
  19. '12月'
  20. ],
  21. type: 'category',
  22. axisLine: { lineStyle: { color: '#8C8C8C' } }
  23. },
  24. color: [
  25. '#5B8FF9',
  26. '#2DC7AA',
  27. '#91DD1C',
  28. '#FFA92C',
  29. '#BE7E2E',
  30. '#1C96DD',
  31. '#D22CFF',
  32. '#FF3C3C',
  33. '#1AEE3E',
  34. '#00c9ff',
  35. '#7c47ff'
  36. ],
  37. series: [
  38. {
  39. lineStyle: { width: 1 },
  40. data: [
  41. '0.00',
  42. '0.00',
  43. '0.00',
  44. '0.00',
  45. '0.00',
  46. '0.00',
  47. '0.00',
  48. '0.00',
  49. '0.00',
  50. '0.00',
  51. '0.00',
  52. '0.00'
  53. ],
  54. symbol: 'circle',
  55. name: '陪练课',
  56. type: 'line',
  57. emphasis: { lineStyle: { width: 1 } }
  58. },
  59. {
  60. lineStyle: { width: 1 },
  61. data: [
  62. '0.00',
  63. '0.00',
  64. '0.00',
  65. '0.00',
  66. '0.00',
  67. '0.00',
  68. '0.00',
  69. '0.00',
  70. '0.00',
  71. '0.00',
  72. '0.00',
  73. '0.00'
  74. ],
  75. symbol: 'circle',
  76. name: '直播课',
  77. type: 'line',
  78. emphasis: { lineStyle: { width: 1 } }
  79. },
  80. {
  81. lineStyle: { width: 1 },
  82. data: [
  83. '0.00',
  84. '0.00',
  85. '0.00',
  86. '0.00',
  87. '0.00',
  88. '0.00',
  89. '0.00',
  90. '0.00',
  91. '0.00',
  92. '0.00',
  93. '0.00',
  94. '0.00'
  95. ],
  96. symbol: 'circle',
  97. name: '视频课',
  98. type: 'line',
  99. emphasis: { lineStyle: { width: 1 } }
  100. },
  101. {
  102. lineStyle: { width: 1 },
  103. data: [
  104. '0.00',
  105. '0.00',
  106. '0.00',
  107. '0.00',
  108. '0.00',
  109. '0.00',
  110. '0.00',
  111. '0.00',
  112. '0.00',
  113. '0.00',
  114. '0.00',
  115. '0.00'
  116. ],
  117. symbol: 'circle',
  118. name: '乐谱',
  119. type: 'line',
  120. emphasis: { lineStyle: { width: 1 } }
  121. },
  122. {
  123. lineStyle: { width: 1 },
  124. data: [
  125. '0.00',
  126. '0.00',
  127. '0.00',
  128. '0.00',
  129. '0.00',
  130. '0.00',
  131. '0.00',
  132. '0.00',
  133. '0.00',
  134. '0.00',
  135. '0.00',
  136. '0.00'
  137. ],
  138. symbol: 'circle',
  139. name: '小酷Ai推广',
  140. type: 'line',
  141. emphasis: { lineStyle: { width: 1 } }
  142. },
  143. {
  144. lineStyle: { width: 1 },
  145. data: [
  146. '0.00',
  147. '0.00',
  148. '0.00',
  149. '0.00',
  150. '0.00',
  151. '0.00',
  152. '0.00',
  153. '0.00',
  154. '0.00',
  155. '0.00',
  156. '0.00',
  157. '0.00'
  158. ],
  159. symbol: 'circle',
  160. name: '直播课推荐',
  161. type: 'line',
  162. emphasis: { lineStyle: { width: 1 } }
  163. },
  164. {
  165. lineStyle: { width: 1 },
  166. data: [
  167. '0.00',
  168. '0.00',
  169. '0.00',
  170. '0.00',
  171. '0.00',
  172. '0.00',
  173. '0.00',
  174. '0.00',
  175. '0.00',
  176. '0.00',
  177. '0.00',
  178. '0.00'
  179. ],
  180. symbol: 'circle',
  181. name: '视频课推荐',
  182. type: 'line',
  183. emphasis: { lineStyle: { width: 1 } }
  184. },
  185. {
  186. lineStyle: { width: 1 },
  187. data: [
  188. '0.00',
  189. '0.00',
  190. '0.00',
  191. '0.00',
  192. '0.00',
  193. '0.00',
  194. '0.00',
  195. '0.00',
  196. '0.00',
  197. '0.00',
  198. '0.00',
  199. '0.00'
  200. ],
  201. symbol: 'circle',
  202. name: '商品推荐',
  203. type: 'line',
  204. emphasis: { lineStyle: { width: 1 } }
  205. },
  206. {
  207. lineStyle: { width: 1 },
  208. data: [
  209. '0.00',
  210. '0.00',
  211. '0.00',
  212. '0.00',
  213. '0.00',
  214. '0.00',
  215. '0.00',
  216. '0.00',
  217. '0.00',
  218. '0.00',
  219. '0.00',
  220. '0.00'
  221. ],
  222. symbol: 'circle',
  223. name: '乐谱推荐',
  224. type: 'line',
  225. emphasis: { lineStyle: { width: 1 } }
  226. },
  227. {
  228. lineStyle: { width: 1 },
  229. data: [
  230. '0.00',
  231. '0.00',
  232. '0.00',
  233. '0.00',
  234. '0.00',
  235. '0.00',
  236. '0.00',
  237. '0.00',
  238. '0.00',
  239. '0.00',
  240. '0.00',
  241. '0.00'
  242. ],
  243. symbol: 'circle',
  244. name: '专辑推荐',
  245. type: 'line',
  246. emphasis: { lineStyle: { width: 1 } }
  247. },
  248. {
  249. lineStyle: { width: 1 },
  250. data: [
  251. '0.00',
  252. '0.00',
  253. '0.00',
  254. '0.00',
  255. '0.00',
  256. '0.00',
  257. '0.00',
  258. '0.00',
  259. '0.00',
  260. '0.00',
  261. '0.00',
  262. '0.00'
  263. ],
  264. symbol: 'circle',
  265. name: '活动报名',
  266. type: 'line',
  267. emphasis: { lineStyle: { width: 1 } }
  268. }
  269. ],
  270. title: { show: false },
  271. grid: {
  272. bottom: '3%',
  273. containLabel: true,
  274. left: '3%',
  275. right: '5%',
  276. top: '7%'
  277. },
  278. tooltip: {
  279. trigger: 'axis',
  280. confine: true
  281. // position: function (point, params, dom, rect, size) {
  282. // // 鼠标坐标和提示框位置的参考坐标系是:以外层div的左上角那一点为原点,x轴向右,y轴向下
  283. // // 提示框位置
  284. // var x = 0 // x坐标位置
  285. // var y = 0 // y坐标位置
  286. // // 当前鼠标位置
  287. // var pointX = point[0]
  288. // var pointY = point[1]
  289. // // 外层div大小
  290. // // var viewWidth = size.viewSize[0];
  291. // // var viewHeight = size.viewSize[1];
  292. // // 提示框大小
  293. // var boxWidth = size.contentSize[0]
  294. // var boxHeight = size.contentSize[1]
  295. // // boxWidth > pointX 说明鼠标左边放不下提示框 --- 情况
  296. // if (boxWidth > pointX) {
  297. // x = 5 // 自己定个x坐标值,以防出屏
  298. // y -= 15 // 防止点被覆盖住,可根据情况自行调节
  299. // } else {
  300. // // 左边放的下
  301. // x = pointX - boxWidth - 15
  302. // }
  303. // // boxHeight > pointY 说明鼠标上边放不下提示框 --- 情况
  304. // if (boxHeight + 20 > pointY) {
  305. // y = pointY + 15
  306. // } else if (boxHeight > pointY) {
  307. // y = 5
  308. // } else {
  309. // // 上边放得下
  310. // y += pointY - boxHeight
  311. // }
  312. // //return [x, y]
  313. // return [x, '20%'] //这里采用固定y轴 x轴随鼠标位置变化
  314. // // return [point[0], '10%']
  315. // }
  316. },
  317. yAxis: {
  318. type: 'value',
  319. splitLine: {
  320. axisLine: { lineStyle: { color: '#8C8C8C' } },
  321. lineStyle: { color: ['#E2E2E2'] }
  322. }
  323. },
  324. dataZoom: [{ type: 'inside', throttle: 100 }],
  325. toolbox: { feature: { saveAsImage: { show: false } } }
  326. }
  327. export const pieChartOption = {
  328. tooltip: {
  329. position: ['30%', '30%'],
  330. trigger: 'item',
  331. padding: 3,
  332. textStyle: { fontSize: 12 },
  333. borderWidth: 0,
  334. formatter: '{b} : {c} ({d}%)'
  335. },
  336. series: [
  337. {
  338. avoidLabelOverlap: false,
  339. label: { show: false },
  340. data: [
  341. { name: '陪练课', value: '0.00' },
  342. { name: '直播课', value: '0.00' },
  343. { name: '视频课', value: '0.00' },
  344. { name: '乐谱', value: '0.00' },
  345. { name: '小酷Ai推广', value: '0.00' },
  346. { name: '直播课推荐', value: '0.00' },
  347. { name: '视频课推荐', value: '0.00' },
  348. { name: '商品推荐', value: '0.00' },
  349. { name: '乐谱推荐', value: '0.00' },
  350. { name: '专辑推荐', value: '0.00' },
  351. { name: '活动报名', value: '0.00' }
  352. ],
  353. type: 'pie',
  354. radius: ['50%', '80%']
  355. }
  356. ],
  357. grid: {
  358. bottom: '0%',
  359. containLabel: true,
  360. left: '0%',
  361. right: '0%',
  362. top: '0%'
  363. },
  364. toolbox: { feature: { saveAsImage: { show: false } } },
  365. color: [
  366. '#5B8FF9',
  367. '#2DC7AA',
  368. '#91DD1C',
  369. '#FFA92C',
  370. '#BE7E2E',
  371. '#1C96DD',
  372. '#D22CFF',
  373. '#FF3C3C',
  374. '#1AEE3E',
  375. '#00c9ff',
  376. '#7c47ff'
  377. ]
  378. }