defaultOptions.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. export const defaultOpts = {
  2. //图表配置
  3. chart: {
  4. spacing: [2,10,2,10]
  5. },
  6. title: {
  7. enabled: false
  8. },
  9. exporting: {
  10. enabled: false,
  11. },
  12. //默认颜色配置
  13. colors:['#00f','#f00','#999','#000','#7cb5ec', '#90ed7d', '#f7a35c', '#8085e9',
  14. '#f15c80', '#e4d354', '#2b908f', '#f45b5b', '#91e8e1'],
  15. //版权信息
  16. credits: {enabled:false},
  17. //数据列通用配置
  18. plotOptions: {
  19. series: {
  20. turboThreshold: 0, //不限制数据点个数
  21. dataGrouping: {
  22. enabled: false,
  23. },//取消数据大自动数据合并
  24. animation: {
  25. duration: 1000
  26. }
  27. },
  28. areaspline: {
  29. lineWidth: 1,
  30. stacking: 'normal',
  31. marker: {
  32. enabled: false,
  33. },
  34. // fillOpacity: 0.5,
  35. },
  36. column:{
  37. pointPadding: 0.05,
  38. stacking: 'normal',
  39. },
  40. scatter: {
  41. turboThreshold: 0,
  42. marker: {
  43. symbol: 'circle',
  44. radius: 5,
  45. states: {
  46. hover: {
  47. enabled: true,
  48. }
  49. }
  50. },
  51. states: {
  52. hover: {
  53. marker: {
  54. enabled: true
  55. }
  56. }
  57. },
  58. }
  59. },
  60. //范围选择器
  61. rangeSelector: {
  62. enabled: false,
  63. selected: 2,
  64. },
  65. //悬浮提示框
  66. tooltip: {
  67. split: false,
  68. shared: true,
  69. dateTimeLabelFormats: {
  70. // 时间格式化字符
  71. day: '%Y/%m/%d',
  72. week: "%Y/%m",
  73. month: '%Y/%m',
  74. year: '%Y/%m',
  75. },
  76. xDateFormat:'%Y/%m/%d',
  77. // valueDecimals: 4,
  78. },
  79. //图例
  80. legend: {
  81. enabled: true,
  82. verticalAlign: 'top',
  83. margin:12,
  84. itemMarginBottom:0,
  85. itemMarginTop: 0
  86. // layout: 'vertical'
  87. },
  88. //滚动条
  89. scrollbar: {
  90. enabled: false,
  91. },
  92. //导航器
  93. navigator: {
  94. enabled: false,
  95. },
  96. //范围选择器
  97. rangeSelector: {
  98. enabled: false,
  99. },
  100. xAxis: {
  101. tickPosition: 'inside',
  102. lineColor: '#bfbfbf',
  103. tickColor: '#bfbfbf',
  104. tickLength:5,
  105. type: 'datetime',
  106. ordinal: false,
  107. dateTimeLabelFormats: {
  108. day: '%y/%m',
  109. week: '%y/%m',
  110. month: '%y/%m',
  111. year: '%y/%m',
  112. }
  113. // gridLineWidth:0
  114. }
  115. };
  116. /* 图表分类弹窗校验 */
  117. export const formRules = {
  118. level_1:[
  119. { required: true, message: '分类名称不能为空', trigger: 'blur' },
  120. ],
  121. level_2:[
  122. { required: true, message: '分类名称不能为空', trigger: 'blur' },
  123. ],
  124. level_3:[
  125. { required: true, message: '分类名称不能为空', trigger: 'blur' },
  126. ],
  127. level_4:[
  128. { required: true, message: '图表名称不能为空', trigger: 'blur' },
  129. ],
  130. level_menu:[
  131. { required: true, message: '所属分类不能为空', trigger: 'blur' },
  132. ],
  133. }
  134. /* 添加图表表单校验 */
  135. export const chartRules = {
  136. style:[
  137. { required: true, message: '生成样式不能为空', trigger: 'blur' },
  138. ],
  139. name:[
  140. { required: true, message: '图表名称不能为空', trigger: 'blur' },
  141. ],
  142. classify:[
  143. { required: true, message: '图表分类不能为空', trigger: 'blur' },
  144. ],
  145. }
  146. /* 公用指标单位 */
  147. export const unitArr = [
  148. '无',
  149. '万吨',
  150. '亿元',
  151. '元',
  152. '元/吨',
  153. '元/湿吨',
  154. '千克',
  155. '吨',
  156. '短吨',
  157. '美元/吨',
  158. '万平方米',
  159. '美元/桶',
  160. '美分/加仑',
  161. '手'
  162. ]
  163. /* 季节性图配置 */
  164. export const seasonOptions = {
  165. //默认颜色配置
  166. /* '#4B0082','#7FFFAA','#FF4500','#808000','#EEE8AA', */
  167. colors:['#849EC1','#8A4294','#578B5A','#FDA8C7','#53B3FF','#999999','#000000','#FFDF0C','#FF0000','#0033FF'],
  168. yAxis: {
  169. lineWidth: 1,
  170. lineColor: '#bfbfbf',
  171. tickColor: '#bfbfbf',
  172. // offset: 0,
  173. opposite: false,
  174. reversed: false,
  175. visible: true,
  176. gridLineWidth: 0,
  177. tickWidth: 1,
  178. tickLength:5,
  179. tickPosition: 'inside',
  180. endOnTick: false,
  181. startOnTick: false,
  182. showLastLabel: true, //显示最后刻度值
  183. tickPixelInterval: 50
  184. }
  185. }
  186. /* 散点图颜色 */
  187. export const scatterColorsOptions = [ 'rgba(119, 152, 191, .5)','rgba(223, 83, 83, .5)' ]
  188. /* 复制图片额外option */
  189. export const copyOtherOptions = {
  190. legend: {
  191. align: 'center',
  192. layout: 'horizontal',
  193. itemStyle: {
  194. fontSize: "14px",
  195. color: '#444',
  196. textOverflow:undefined
  197. },
  198. itemMarginBottom:0,
  199. itemDistance: 0,
  200. padding: 0,
  201. margin: 10
  202. },
  203. seasonLegend:{
  204. align: 'center',
  205. layout: 'horizontal',
  206. itemStyle: {
  207. fontSize: "14px",
  208. color: '#444',
  209. }
  210. }
  211. }
  212. /* 图表年份筛选框 */
  213. export const yearSelector = [
  214. {
  215. name: '15年至今',
  216. value: 3,
  217. },
  218. // {
  219. // name: '18年至今',
  220. // value: 7,
  221. // },
  222. // {
  223. // name: '19年至今',
  224. // value: 8,
  225. // },
  226. {
  227. name: '20年至今',
  228. value: 9,
  229. },
  230. {
  231. name: '21年至今',
  232. value: 4,
  233. },
  234. {
  235. name: '22年至今',
  236. value: 11,
  237. },
  238. ]
  239. export const browser = () => {
  240. // 取得浏览器的userAgent字符串
  241. var userAgent = navigator.userAgent
  242. // 判断是否Opera浏览器
  243. var isOpera = userAgent.indexOf('Opera') > -1
  244. // 判断是否IE浏览器
  245. var isIE =
  246. userAgent.indexOf('compatible') > -1 &&
  247. userAgent.indexOf('MSIE') > -1 &&
  248. !isOpera
  249. // 判断是否IE的Edge浏览器
  250. var isEdge = userAgent.indexOf('Edge') > -1
  251. // 判断是否Firefox浏览器
  252. var isFF = userAgent.indexOf('Firefox') > -1
  253. // 判断是否Safari浏览器
  254. var isSafari =
  255. userAgent.indexOf('Safari') > -1 && userAgent.indexOf('Chrome') === -1
  256. // 判断Chrome浏览器
  257. var isChrome =
  258. userAgent.indexOf('Chrome') > -1 && userAgent.indexOf('Safari') > -1
  259. if (isIE) {
  260. var reIE = new RegExp('MSIE (\\d+\\.\\d+);')
  261. reIE.test(userAgent)
  262. var fIEVersion = parseFloat(RegExp['$1'])
  263. if (fIEVersion === 7) {
  264. return 'IE7'
  265. } else if (fIEVersion === 8) {
  266. return 'IE8'
  267. } else if (fIEVersion === 9) {
  268. return 'IE9'
  269. } else if (fIEVersion === 10) {
  270. return 'IE10'
  271. } else if (fIEVersion === 11) {
  272. return 'IE11'
  273. } else {
  274. return 'IE'
  275. }
  276. }else if (isOpera) {
  277. return 'Opera'
  278. }else if (isEdge) {
  279. return 'Edge'
  280. }else if (isFF) {
  281. return 'FF'
  282. }else if (isSafari) {
  283. return 'Safari'
  284. }else if (isChrome) {
  285. return 'Chrome'
  286. }else {
  287. return ''
  288. }
  289. }
  290. // 判断设备
  291. export const getTerminal = () => {
  292. // 获取终端的相关信息
  293. var Terminal = {
  294. // 辨别移动终端类型
  295. platform: function () {
  296. var u = navigator.userAgent,
  297. app = navigator.appVersion;
  298. return {
  299. // android终端或者uc浏览器
  300. android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1,
  301. // 是否为iPhone或者QQHD浏览器
  302. iPhone: u.indexOf('iPhone') > -1,
  303. // 是否iPad
  304. iPad: u.indexOf('iPad') > -1
  305. };
  306. }()
  307. }
  308. // 根据不同的终端,跳转到不同的地址
  309. if (Terminal.platform.android) {
  310. return 'android';
  311. } else if (Terminal.platform.iPhone || Terminal.platform.iPad) {
  312. return 'ios';
  313. }
  314. }