echarts-data.ts 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. import { EChartsOption } from 'echarts'
  2. const { t } = useI18n()
  3. export const lineOptions: EChartsOption = {
  4. title: {
  5. text: t('analysis.monthlySales'),
  6. left: 'center'
  7. },
  8. xAxis: {
  9. data: [
  10. t('analysis.january'),
  11. t('analysis.february'),
  12. t('analysis.march'),
  13. t('analysis.april'),
  14. t('analysis.may'),
  15. t('analysis.june'),
  16. t('analysis.july'),
  17. t('analysis.august'),
  18. t('analysis.september'),
  19. t('analysis.october'),
  20. t('analysis.november'),
  21. t('analysis.december')
  22. ],
  23. boundaryGap: false,
  24. axisTick: {
  25. show: false
  26. }
  27. },
  28. grid: {
  29. left: 20,
  30. right: 20,
  31. bottom: 20,
  32. top: 80,
  33. containLabel: true
  34. },
  35. tooltip: {
  36. trigger: 'axis',
  37. axisPointer: {
  38. type: 'cross'
  39. },
  40. padding: [5, 10]
  41. },
  42. yAxis: {
  43. axisTick: {
  44. show: false
  45. }
  46. },
  47. legend: {
  48. data: [t('analysis.estimate'), t('analysis.actual')],
  49. top: 50
  50. },
  51. series: [
  52. {
  53. name: t('analysis.estimate'),
  54. smooth: true,
  55. type: 'line',
  56. data: [100, 120, 161, 134, 105, 160, 165, 114, 163, 185, 118, 123],
  57. animationDuration: 2800,
  58. animationEasing: 'cubicInOut'
  59. },
  60. {
  61. name: t('analysis.actual'),
  62. smooth: true,
  63. type: 'line',
  64. itemStyle: {},
  65. data: [120, 82, 91, 154, 162, 140, 145, 250, 134, 56, 99, 123],
  66. animationDuration: 2800,
  67. animationEasing: 'quadraticOut'
  68. }
  69. ]
  70. }
  71. export const pieOptions: EChartsOption = {
  72. title: {
  73. text: t('analysis.userAccessSource'),
  74. left: 'center'
  75. },
  76. tooltip: {
  77. trigger: 'item',
  78. formatter: '{a} <br/>{b} : {c} ({d}%)'
  79. },
  80. legend: {
  81. orient: 'vertical',
  82. left: 'left',
  83. data: [
  84. t('analysis.directAccess'),
  85. t('analysis.mailMarketing'),
  86. t('analysis.allianceAdvertising'),
  87. t('analysis.videoAdvertising'),
  88. t('analysis.searchEngines')
  89. ]
  90. },
  91. series: [
  92. {
  93. name: t('analysis.userAccessSource'),
  94. type: 'pie',
  95. radius: '55%',
  96. center: ['50%', '60%'],
  97. data: [
  98. { value: 335, name: t('analysis.directAccess') },
  99. { value: 310, name: t('analysis.mailMarketing') },
  100. { value: 234, name: t('analysis.allianceAdvertising') },
  101. { value: 135, name: t('analysis.videoAdvertising') },
  102. { value: 1548, name: t('analysis.searchEngines') }
  103. ]
  104. }
  105. ]
  106. }
  107. export const barOptions: EChartsOption = {
  108. title: {
  109. text: t('analysis.weeklyUserActivity'),
  110. left: 'center'
  111. },
  112. tooltip: {
  113. trigger: 'axis',
  114. axisPointer: {
  115. type: 'shadow'
  116. }
  117. },
  118. grid: {
  119. left: 50,
  120. right: 20,
  121. bottom: 20
  122. },
  123. xAxis: {
  124. type: 'category',
  125. data: [
  126. t('analysis.monday'),
  127. t('analysis.tuesday'),
  128. t('analysis.wednesday'),
  129. t('analysis.thursday'),
  130. t('analysis.friday'),
  131. t('analysis.saturday'),
  132. t('analysis.sunday')
  133. ],
  134. axisTick: {
  135. alignWithLabel: true
  136. }
  137. },
  138. yAxis: {
  139. type: 'value'
  140. },
  141. series: [
  142. {
  143. name: t('analysis.activeQuantity'),
  144. data: [13253, 34235, 26321, 12340, 24643, 1322, 1324],
  145. type: 'bar'
  146. }
  147. ]
  148. }
  149. export const radarOption: EChartsOption = {
  150. legend: {
  151. data: [t('workplace.personal'), t('workplace.team')]
  152. },
  153. radar: {
  154. // shape: 'circle',
  155. indicator: [
  156. { name: t('workplace.quote'), max: 65 },
  157. { name: t('workplace.contribution'), max: 160 },
  158. { name: t('workplace.hot'), max: 300 },
  159. { name: t('workplace.yield'), max: 130 },
  160. { name: t('workplace.follow'), max: 100 }
  161. ]
  162. },
  163. series: [
  164. {
  165. name: `xxx${t('workplace.index')}`,
  166. type: 'radar',
  167. data: [
  168. {
  169. value: [42, 30, 20, 35, 80],
  170. name: t('workplace.personal')
  171. },
  172. {
  173. value: [50, 140, 290, 100, 90],
  174. name: t('workplace.team')
  175. }
  176. ]
  177. }
  178. ]
  179. }
  180. export const wordOptions = {
  181. series: [
  182. {
  183. type: 'wordCloud',
  184. gridSize: 2,
  185. sizeRange: [12, 50],
  186. rotationRange: [-90, 90],
  187. shape: 'pentagon',
  188. width: 600,
  189. height: 400,
  190. drawOutOfBound: true,
  191. textStyle: {
  192. color: function () {
  193. return (
  194. 'rgb(' +
  195. [
  196. Math.round(Math.random() * 160),
  197. Math.round(Math.random() * 160),
  198. Math.round(Math.random() * 160)
  199. ].join(',') +
  200. ')'
  201. )
  202. }
  203. },
  204. emphasis: {
  205. textStyle: {
  206. shadowBlur: 10,
  207. shadowColor: '#333'
  208. }
  209. },
  210. data: [
  211. {
  212. name: 'Sam S Club',
  213. value: 10000,
  214. textStyle: {
  215. color: 'black'
  216. },
  217. emphasis: {
  218. textStyle: {
  219. color: 'red'
  220. }
  221. }
  222. },
  223. {
  224. name: 'Macys',
  225. value: 6181
  226. },
  227. {
  228. name: 'Amy Schumer',
  229. value: 4386
  230. },
  231. {
  232. name: 'Jurassic World',
  233. value: 4055
  234. },
  235. {
  236. name: 'Charter Communications',
  237. value: 2467
  238. },
  239. {
  240. name: 'Chick Fil A',
  241. value: 2244
  242. },
  243. {
  244. name: 'Planet Fitness',
  245. value: 1898
  246. },
  247. {
  248. name: 'Pitch Perfect',
  249. value: 1484
  250. },
  251. {
  252. name: 'Express',
  253. value: 1112
  254. },
  255. {
  256. name: 'Home',
  257. value: 965
  258. },
  259. {
  260. name: 'Johnny Depp',
  261. value: 847
  262. },
  263. {
  264. name: 'Lena Dunham',
  265. value: 582
  266. },
  267. {
  268. name: 'Lewis Hamilton',
  269. value: 555
  270. },
  271. {
  272. name: 'KXAN',
  273. value: 550
  274. },
  275. {
  276. name: 'Mary Ellen Mark',
  277. value: 462
  278. },
  279. {
  280. name: 'Farrah Abraham',
  281. value: 366
  282. },
  283. {
  284. name: 'Rita Ora',
  285. value: 360
  286. },
  287. {
  288. name: 'Serena Williams',
  289. value: 282
  290. },
  291. {
  292. name: 'NCAA baseball tournament',
  293. value: 273
  294. },
  295. {
  296. name: 'Point Break',
  297. value: 265
  298. }
  299. ]
  300. }
  301. ]
  302. }