echats.ts 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. export const lineChartOption = {
  2. tooltip: {
  3. trigger: 'axis',
  4. axisPointer: {
  5. lineStyle: {
  6. width: 2,
  7. color: '#FFA3C2'
  8. }
  9. }
  10. },
  11. legend: {
  12. show: false,
  13. selected: {
  14. //在这里设置默认展示就ok了
  15. 训练时长: true,
  16. 使用次数: true
  17. }
  18. },
  19. xAxis: {
  20. type: 'category',
  21. boundaryGap: true,
  22. axisLabel: {
  23. show: true,
  24. interval: 0
  25. },
  26. data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
  27. // splitLine: {
  28. // show: true,
  29. // lineStyle: {
  30. // width: 2,
  31. // type: 'solid',
  32. // color: 'rgba(226,226,226,0.5)'
  33. // }
  34. // }
  35. // axisTick: {
  36. // show: false
  37. // }
  38. },
  39. yAxis: [
  40. {
  41. type: 'value',
  42. axisLabel: {
  43. formatter: '{value}'
  44. },
  45. axisTick: {
  46. show: false
  47. },
  48. splitArea: {
  49. show: false,
  50. areaStyle: {
  51. color: ['rgba(255,255,255,0.2)']
  52. }
  53. },
  54. minInterval: 1,
  55. splitNumber: 5
  56. }
  57. ],
  58. grid: {
  59. left: '1%',
  60. right: '1%',
  61. top: '5%',
  62. bottom: 0,
  63. containLabel: true
  64. },
  65. series: [
  66. {
  67. // smooth: true,
  68. data: ['0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00'],
  69. symbolSize: 10,
  70. type: 'line',
  71. name: '训练时长',
  72. symbol: 'circle',
  73. smooth: true,
  74. itemStyle: {
  75. color: '#FF7AA7',
  76. borderColor: '#fff',
  77. borderWidth: 3
  78. },
  79. lineStyle: {
  80. width: 3 //设置线条粗细
  81. },
  82. areaStyle: {
  83. color: {
  84. type: 'linear',
  85. x: 0,
  86. y: 0,
  87. x2: 0,
  88. y2: 1,
  89. colorStops: [
  90. {
  91. offset: 0,
  92. color: 'rgba(255, 243, 246, 1)'
  93. // 0% 处的颜色
  94. },
  95. {
  96. offset: 1,
  97. // 100% 处的颜色
  98. color: 'rgba(255, 246, 248, 0)'
  99. }
  100. ]
  101. }
  102. },
  103. emphasis: {
  104. disabled: true
  105. }
  106. },
  107. {
  108. data: ['0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00'],
  109. type: 'line',
  110. name: '使用次数',
  111. symbolSize: 10,
  112. symbol: 'circle',
  113. smooth: true,
  114. itemStyle: {
  115. color: '#3583FA',
  116. borderColor: '#fff',
  117. borderWidth: 3
  118. },
  119. lineStyle: {
  120. width: 2 //设置线条粗细
  121. },
  122. areaStyle: {
  123. color: {
  124. type: 'linear',
  125. x: 0,
  126. y: 0,
  127. x2: 0,
  128. y2: 1,
  129. colorStops: [
  130. {
  131. offset: 0,
  132. color: 'rgba(212, 231, 255, 1)'
  133. // 0% 处的颜色
  134. },
  135. {
  136. offset: 1,
  137. color: 'rgba(221, 235, 254, 0)' // 100% 处的颜色
  138. }
  139. ]
  140. }
  141. },
  142. emphasis: {
  143. disabled: true
  144. }
  145. }
  146. ],
  147. formatter: (item: any) => {
  148. if (Array.isArray(item)) {
  149. // console.log(item, 'formatter')
  150. return [
  151. item[0].axisValueLabel,
  152. ...item.map(
  153. (d: any, index: number) =>
  154. `<br/>${
  155. d.marker
  156. }<span style="margin-top:10px;margin-left:5px;font-size: 13px;font-weight: 500;
  157. color: #333333;
  158. line-height: 18px;">${d.seriesName}: ${d.value}${
  159. index === 0 ? '分钟' : '次'
  160. } </span>`
  161. )
  162. ].join('')
  163. } else {
  164. return item
  165. }
  166. }
  167. // dataZoom: [
  168. // {
  169. // type: 'slider',
  170. // start: 5,
  171. // end: 100,
  172. // filterMode: 'empty'
  173. // }
  174. // ]
  175. }
  176. // export const lineChartOption = {
  177. // legend: { show: false },
  178. // emphasis: { lineStyle: { width: 2 } },
  179. // xAxis: {
  180. // boundaryGap: false,
  181. // data: [
  182. // '01月',
  183. // '02月',
  184. // '03月',
  185. // '04月',
  186. // '05月',
  187. // '06月',
  188. // '07月',
  189. // '08月',
  190. // '09月',
  191. // '10月',
  192. // '11月',
  193. // '12月'
  194. // ],
  195. // type: 'category',
  196. // axisLine: { lineStyle: { color: '#8C8C8C' } }
  197. // },
  198. // color: [
  199. // '#5B8FF9',
  200. // '#2DC7AA',
  201. // '#91DD1C',
  202. // '#FFA92C',
  203. // '#BE7E2E',
  204. // '#1C96DD',
  205. // '#D22CFF',
  206. // '#FF3C3C',
  207. // '#1AEE3E',
  208. // '#00c9ff',
  209. // '#7c47ff'
  210. // ],
  211. // series: [
  212. // {
  213. // lineStyle: { width: 1 },
  214. // data: [
  215. // '0.00',
  216. // '0.00',
  217. // '0.00',
  218. // '0.00',
  219. // '0.00',
  220. // '0.00',
  221. // '0.00',
  222. // '0.00',
  223. // '0.00',
  224. // '0.00',
  225. // '0.00',
  226. // '0.00'
  227. // ],
  228. // symbol: 'circle',
  229. // name: '陪练课',
  230. // type: 'line',
  231. // emphasis: { lineStyle: { width: 1 } }
  232. // },
  233. // {
  234. // lineStyle: { width: 1 },
  235. // data: [
  236. // '0.00',
  237. // '0.00',
  238. // '0.00',
  239. // '0.00',
  240. // '0.00',
  241. // '0.00',
  242. // '0.00',
  243. // '0.00',
  244. // '0.00',
  245. // '0.00',
  246. // '0.00',
  247. // '0.00'
  248. // ],
  249. // symbol: 'circle',
  250. // name: '直播课',
  251. // type: 'line',
  252. // emphasis: { lineStyle: { width: 1 } }
  253. // },
  254. // {
  255. // lineStyle: { width: 1 },
  256. // data: [
  257. // '0.00',
  258. // '0.00',
  259. // '0.00',
  260. // '0.00',
  261. // '0.00',
  262. // '0.00',
  263. // '0.00',
  264. // '0.00',
  265. // '0.00',
  266. // '0.00',
  267. // '0.00',
  268. // '0.00'
  269. // ],
  270. // symbol: 'circle',
  271. // name: '视频课',
  272. // type: 'line',
  273. // emphasis: { lineStyle: { width: 1 } }
  274. // },
  275. // {
  276. // lineStyle: { width: 1 },
  277. // data: [
  278. // '0.00',
  279. // '0.00',
  280. // '0.00',
  281. // '0.00',
  282. // '0.00',
  283. // '0.00',
  284. // '0.00',
  285. // '0.00',
  286. // '0.00',
  287. // '0.00',
  288. // '0.00',
  289. // '0.00'
  290. // ],
  291. // symbol: 'circle',
  292. // name: '乐谱',
  293. // type: 'line',
  294. // emphasis: { lineStyle: { width: 1 } }
  295. // },
  296. // {
  297. // lineStyle: { width: 1 },
  298. // data: [
  299. // '0.00',
  300. // '0.00',
  301. // '0.00',
  302. // '0.00',
  303. // '0.00',
  304. // '0.00',
  305. // '0.00',
  306. // '0.00',
  307. // '0.00',
  308. // '0.00',
  309. // '0.00',
  310. // '0.00'
  311. // ],
  312. // symbol: 'circle',
  313. // name: '小酷Ai推广',
  314. // type: 'line',
  315. // emphasis: { lineStyle: { width: 1 } }
  316. // },
  317. // {
  318. // lineStyle: { width: 1 },
  319. // data: [
  320. // '0.00',
  321. // '0.00',
  322. // '0.00',
  323. // '0.00',
  324. // '0.00',
  325. // '0.00',
  326. // '0.00',
  327. // '0.00',
  328. // '0.00',
  329. // '0.00',
  330. // '0.00',
  331. // '0.00'
  332. // ],
  333. // symbol: 'circle',
  334. // name: '直播课推荐',
  335. // type: 'line',
  336. // emphasis: { lineStyle: { width: 1 } }
  337. // },
  338. // {
  339. // lineStyle: { width: 1 },
  340. // data: [
  341. // '0.00',
  342. // '0.00',
  343. // '0.00',
  344. // '0.00',
  345. // '0.00',
  346. // '0.00',
  347. // '0.00',
  348. // '0.00',
  349. // '0.00',
  350. // '0.00',
  351. // '0.00',
  352. // '0.00'
  353. // ],
  354. // symbol: 'circle',
  355. // name: '视频课推荐',
  356. // type: 'line',
  357. // emphasis: { lineStyle: { width: 1 } }
  358. // },
  359. // {
  360. // lineStyle: { width: 1 },
  361. // data: [
  362. // '0.00',
  363. // '0.00',
  364. // '0.00',
  365. // '0.00',
  366. // '0.00',
  367. // '0.00',
  368. // '0.00',
  369. // '0.00',
  370. // '0.00',
  371. // '0.00',
  372. // '0.00',
  373. // '0.00'
  374. // ],
  375. // symbol: 'circle',
  376. // name: '商品推荐',
  377. // type: 'line',
  378. // emphasis: { lineStyle: { width: 1 } }
  379. // },
  380. // {
  381. // lineStyle: { width: 1 },
  382. // data: [
  383. // '0.00',
  384. // '0.00',
  385. // '0.00',
  386. // '0.00',
  387. // '0.00',
  388. // '0.00',
  389. // '0.00',
  390. // '0.00',
  391. // '0.00',
  392. // '0.00',
  393. // '0.00',
  394. // '0.00'
  395. // ],
  396. // symbol: 'circle',
  397. // name: '乐谱推荐',
  398. // type: 'line',
  399. // emphasis: { lineStyle: { width: 1 } }
  400. // },
  401. // {
  402. // lineStyle: { width: 1 },
  403. // data: [
  404. // '0.00',
  405. // '0.00',
  406. // '0.00',
  407. // '0.00',
  408. // '0.00',
  409. // '0.00',
  410. // '0.00',
  411. // '0.00',
  412. // '0.00',
  413. // '0.00',
  414. // '0.00',
  415. // '0.00'
  416. // ],
  417. // symbol: 'circle',
  418. // name: '专辑推荐',
  419. // type: 'line',
  420. // emphasis: { lineStyle: { width: 1 } }
  421. // },
  422. // {
  423. // lineStyle: { width: 1 },
  424. // data: [
  425. // '0.00',
  426. // '0.00',
  427. // '0.00',
  428. // '0.00',
  429. // '0.00',
  430. // '0.00',
  431. // '0.00',
  432. // '0.00',
  433. // '0.00',
  434. // '0.00',
  435. // '0.00',
  436. // '0.00'
  437. // ],
  438. // symbol: 'circle',
  439. // name: '活动报名',
  440. // type: 'line',
  441. // emphasis: { lineStyle: { width: 1 } }
  442. // }
  443. // ],
  444. // title: { show: false },
  445. // grid: {
  446. // bottom: '3%',
  447. // containLabel: true,
  448. // left: '3%',
  449. // right: '5%',
  450. // top: '7%'
  451. // },
  452. // tooltip: {
  453. // trigger: 'axis',
  454. // confine: true
  455. // // position: function (point, params, dom, rect, size) {
  456. // // // 鼠标坐标和提示框位置的参考坐标系是:以外层div的左上角那一点为原点,x轴向右,y轴向下
  457. // // // 提示框位置
  458. // // var x = 0 // x坐标位置
  459. // // var y = 0 // y坐标位置
  460. // // // 当前鼠标位置
  461. // // var pointX = point[0]
  462. // // var pointY = point[1]
  463. // // // 外层div大小
  464. // // // var viewWidth = size.viewSize[0];
  465. // // // var viewHeight = size.viewSize[1];
  466. // // // 提示框大小
  467. // // var boxWidth = size.contentSize[0]
  468. // // var boxHeight = size.contentSize[1]
  469. // // // boxWidth > pointX 说明鼠标左边放不下提示框 --- 情况
  470. // // if (boxWidth > pointX) {
  471. // // x = 5 // 自己定个x坐标值,以防出屏
  472. // // y -= 15 // 防止点被覆盖住,可根据情况自行调节
  473. // // } else {
  474. // // // 左边放的下
  475. // // x = pointX - boxWidth - 15
  476. // // }
  477. // // // boxHeight > pointY 说明鼠标上边放不下提示框 --- 情况
  478. // // if (boxHeight + 20 > pointY) {
  479. // // y = pointY + 15
  480. // // } else if (boxHeight > pointY) {
  481. // // y = 5
  482. // // } else {
  483. // // // 上边放得下
  484. // // y += pointY - boxHeight
  485. // // }
  486. // // //return [x, y]
  487. // // return [x, '20%'] //这里采用固定y轴 x轴随鼠标位置变化
  488. // // // return [point[0], '10%']
  489. // // }
  490. // },
  491. // yAxis: {
  492. // type: 'value',
  493. // splitLine: {
  494. // axisLine: { lineStyle: { color: '#8C8C8C' } },
  495. // lineStyle: { color: ['#E2E2E2'] }
  496. // }
  497. // },
  498. // dataZoom: [{ type: 'inside', throttle: 100 }],
  499. // toolbox: { feature: { saveAsImage: { show: false } } }
  500. // }
  501. export const pieChartOption = {
  502. tooltip: {
  503. position: ['30%', '30%'],
  504. trigger: 'item',
  505. padding: 3,
  506. textStyle: { fontSize: 12 },
  507. borderWidth: 0,
  508. formatter: '{b} : {c} ({d}%)'
  509. },
  510. series: [
  511. {
  512. avoidLabelOverlap: false,
  513. label: { show: false },
  514. data: [
  515. { name: '陪练课', value: '0.00' },
  516. { name: '直播课', value: '0.00' },
  517. { name: '视频课', value: '0.00' },
  518. { name: '乐谱', value: '0.00' },
  519. { name: '小酷Ai推广', value: '0.00' },
  520. { name: '直播课推荐', value: '0.00' },
  521. { name: '视频课推荐', value: '0.00' },
  522. { name: '商品推荐', value: '0.00' },
  523. { name: '乐谱推荐', value: '0.00' },
  524. { name: '专辑推荐', value: '0.00' },
  525. { name: '活动报名', value: '0.00' }
  526. ],
  527. type: 'pie',
  528. radius: ['50%', '80%']
  529. }
  530. ],
  531. grid: {
  532. bottom: '0%',
  533. containLabel: true,
  534. left: '0%',
  535. right: '0%',
  536. top: '0%'
  537. },
  538. toolbox: { feature: { saveAsImage: { show: false } } },
  539. color: [
  540. '#5B8FF9',
  541. '#2DC7AA',
  542. '#91DD1C',
  543. '#FFA92C',
  544. '#BE7E2E',
  545. '#1C96DD',
  546. '#D22CFF',
  547. '#FF3C3C',
  548. '#1AEE3E',
  549. '#00c9ff',
  550. '#7c47ff'
  551. ]
  552. }