echarts-data.ts 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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 pieOptions2 : EChartsOption = {
  108. title: {
  109. // text: '今日订单',
  110. left: 'center'
  111. },
  112. tooltip: {
  113. trigger: 'item',
  114. formatter: '{a} <br/>{b} : {c} ({d}%)'
  115. },
  116. legend: {
  117. orient: 'vertical',
  118. left: 'left',
  119. data: [
  120. t('analysis.directAccess'),
  121. t('analysis.mailMarketing'),
  122. t('analysis.allianceAdvertising'),
  123. t('analysis.videoAdvertising'),
  124. t('analysis.searchEngines')
  125. ]
  126. },
  127. series: [
  128. {
  129. name: t('analysis.userAccessSource'),
  130. type: 'pie',
  131. radius: '55%',
  132. center: ['50%', '60%'],
  133. data: [
  134. { value: 335, name: t('analysis.directAccess') },
  135. { value: 310, name: t('analysis.mailMarketing') },
  136. { value: 234, name: t('analysis.allianceAdvertising') },
  137. { value: 135, name: t('analysis.videoAdvertising') },
  138. { value: 1548, name: t('analysis.searchEngines') }
  139. ]
  140. }
  141. ]
  142. }
  143. export const barOptions : EChartsOption = {
  144. title: {
  145. // text: t('analysis.weeklyUserActivity'),
  146. left: 'center'
  147. },
  148. tooltip: {
  149. trigger: 'axis',
  150. axisPointer: {
  151. type: 'shadow'
  152. }
  153. },
  154. grid: {
  155. left: 50,
  156. right: 20,
  157. bottom: 20
  158. },
  159. xAxis: {
  160. type: 'category',
  161. data: [
  162. t('analysis.monday'),
  163. t('analysis.tuesday'),
  164. t('analysis.wednesday'),
  165. t('analysis.thursday'),
  166. t('analysis.friday'),
  167. t('analysis.saturday'),
  168. t('analysis.sunday')
  169. ],
  170. axisTick: {
  171. alignWithLabel: true
  172. }
  173. },
  174. yAxis: {
  175. type: 'value'
  176. },
  177. series: [
  178. {
  179. name: t('analysis.activeQuantity'),
  180. data: [13253, 34235, 26321, 12340, 24643, 1322, 1324],
  181. type: 'bar'
  182. }
  183. ]
  184. }
  185. export const radarOption : EChartsOption = {
  186. legend: {
  187. data: [t('workplace.personal'), t('workplace.team')]
  188. },
  189. radar: {
  190. // shape: 'circle',
  191. indicator: [
  192. { name: t('workplace.quote'), max: 65 },
  193. { name: t('workplace.contribution'), max: 160 },
  194. { name: t('workplace.hot'), max: 300 },
  195. { name: t('workplace.yield'), max: 130 },
  196. { name: t('workplace.follow'), max: 100 }
  197. ]
  198. },
  199. series: [
  200. {
  201. name: `xxx${t('workplace.index')}`,
  202. type: 'radar',
  203. data: [
  204. {
  205. value: [42, 30, 20, 35, 80],
  206. name: t('workplace.personal')
  207. },
  208. {
  209. value: [50, 140, 290, 100, 90],
  210. name: t('workplace.team')
  211. }
  212. ]
  213. }
  214. ]
  215. }
  216. export const wordOptions = {
  217. series: [
  218. {
  219. type: 'wordCloud',
  220. gridSize: 2,
  221. sizeRange: [12, 50],
  222. rotationRange: [-90, 90],
  223. shape: 'pentagon',
  224. width: 600,
  225. height: 400,
  226. drawOutOfBound: true,
  227. textStyle: {
  228. color: function () {
  229. return (
  230. 'rgb(' +
  231. [
  232. Math.round(Math.random() * 160),
  233. Math.round(Math.random() * 160),
  234. Math.round(Math.random() * 160)
  235. ].join(',') +
  236. ')'
  237. )
  238. }
  239. },
  240. emphasis: {
  241. textStyle: {
  242. shadowBlur: 10,
  243. shadowColor: '#333'
  244. }
  245. },
  246. data: [
  247. {
  248. name: 'Sam S Club',
  249. value: 10000,
  250. textStyle: {
  251. color: 'black'
  252. },
  253. emphasis: {
  254. textStyle: {
  255. color: 'red'
  256. }
  257. }
  258. },
  259. {
  260. name: 'Macys',
  261. value: 6181
  262. },
  263. {
  264. name: 'Amy Schumer',
  265. value: 4386
  266. },
  267. {
  268. name: 'Jurassic World',
  269. value: 4055
  270. },
  271. {
  272. name: 'Charter Communications',
  273. value: 2467
  274. },
  275. {
  276. name: 'Chick Fil A',
  277. value: 2244
  278. },
  279. {
  280. name: 'Planet Fitness',
  281. value: 1898
  282. },
  283. {
  284. name: 'Pitch Perfect',
  285. value: 1484
  286. },
  287. {
  288. name: 'Express',
  289. value: 1112
  290. },
  291. {
  292. name: 'Home',
  293. value: 965
  294. },
  295. {
  296. name: 'Johnny Depp',
  297. value: 847
  298. },
  299. {
  300. name: 'Lena Dunham',
  301. value: 582
  302. },
  303. {
  304. name: 'Lewis Hamilton',
  305. value: 555
  306. },
  307. {
  308. name: 'KXAN',
  309. value: 550
  310. },
  311. {
  312. name: 'Mary Ellen Mark',
  313. value: 462
  314. },
  315. {
  316. name: 'Farrah Abraham',
  317. value: 366
  318. },
  319. {
  320. name: 'Rita Ora',
  321. value: 360
  322. },
  323. {
  324. name: 'Serena Williams',
  325. value: 282
  326. },
  327. {
  328. name: 'NCAA baseball tournament',
  329. value: 273
  330. },
  331. {
  332. name: 'Point Break',
  333. value: 265
  334. }
  335. ]
  336. }
  337. ]
  338. }