123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322 |
- export const defaultOpts = {
- //图表配置
- chart: {
- spacing: [2,10,2,10]
- },
- title: {
- enabled: false
- },
- exporting: {
- enabled: false,
- },
- //默认颜色配置
- colors:['#00f','#f00','#999','#000','#7cb5ec', '#90ed7d', '#f7a35c', '#8085e9',
- '#f15c80', '#e4d354', '#2b908f', '#f45b5b', '#91e8e1'],
- //版权信息
- credits: {enabled:false},
- //数据列通用配置
- plotOptions: {
- series: {
- turboThreshold: 0, //不限制数据点个数
- dataGrouping: {
- enabled: false,
- },//取消数据大自动数据合并
- animation: {
- duration: 1000
- }
- },
- areaspline: {
- lineWidth: 1,
- stacking: 'normal',
- marker: {
- enabled: false,
- },
- // fillOpacity: 0.5,
- },
- column:{
- pointPadding: 0.05,
- stacking: 'normal',
- },
- scatter: {
- turboThreshold: 0,
- marker: {
- symbol: 'circle',
- radius: 5,
- states: {
- hover: {
- enabled: true,
- }
- }
- },
- states: {
- hover: {
- marker: {
- enabled: true
- }
- }
- },
- }
- },
- //范围选择器
- rangeSelector: {
- enabled: false,
- selected: 2,
- },
- //悬浮提示框
- tooltip: {
- split: false,
- shared: true,
- dateTimeLabelFormats: {
- // 时间格式化字符
- day: '%Y/%m/%d',
- week: "%Y/%m",
- month: '%Y/%m',
- year: '%Y/%m',
- },
- xDateFormat:'%Y/%m/%d',
- // valueDecimals: 4,
- },
- //图例
- legend: {
- enabled: true,
- verticalAlign: 'top',
- margin:5,
- // layout: 'vertical'
- },
- //滚动条
- scrollbar: {
- enabled: false,
- },
- //导航器
- navigator: {
- enabled: false,
- },
- //范围选择器
- rangeSelector: {
- enabled: false,
- },
- xAxis: {
- tickPosition: 'inside',
- lineColor: '#bfbfbf',
- tickColor: '#bfbfbf',
- tickLength:5,
- type: 'datetime',
- ordinal: false,
- dateTimeLabelFormats: {
- day: '%y/%m',
- week: '%y/%m',
- month: '%y/%m',
- year: '%y/%m',
- }
- // gridLineWidth:0
- }
- };
- /* 图表分类弹窗校验 */
- export const formRules = {
- level_1:[
- { required: true, message: '分类名称不能为空', trigger: 'blur' },
- ],
- level_2:[
- { required: true, message: '分类名称不能为空', trigger: 'blur' },
- ],
- level_3:[
- { required: true, message: '分类名称不能为空', trigger: 'blur' },
- ],
- level_4:[
- { required: true, message: '图表名称不能为空', trigger: 'blur' },
- ],
- level_menu:[
- { required: true, message: '所属分类不能为空', trigger: 'blur' },
- ],
- }
- /* 添加图表表单校验 */
- export const chartRules = {
- style:[
- { required: true, message: '生成样式不能为空', trigger: 'blur' },
- ],
- name:[
- { required: true, message: '图表名称不能为空', trigger: 'blur' },
- ],
- classify:[
- { required: true, message: '图表分类不能为空', trigger: 'blur' },
- ],
- }
- /* 公用指标单位 */
- export const unitArr = [
- '无',
- '万吨',
- '亿元',
- '元',
- '元/吨',
- '元/湿吨',
- '千克',
- '吨',
- '短吨',
- '美元/吨',
- '万平方米',
- '美元/桶',
- '美分/加仑',
- '手'
- ]
- /* 季节性图配置 */
- export const seasonOptions = {
- //默认颜色配置
- colors:['#4B0082','#7FFFAA','#FF4500','#808000','#EEE8AA','#849EC1','#8A4294','#578B5A','#FDA8C7','#53B3FF','#999999','#000000','#FFDF0C','#FF0000','#0033FF'],
- yAxis: {
- lineWidth: 1,
- lineColor: '#bfbfbf',
- tickColor: '#bfbfbf',
- offset: 0,
- opposite: false,
- reversed: false,
- visible: true,
- gridLineWidth: 0,
- tickWidth: 1,
- tickLength:5,
- tickPosition: 'inside',
- endOnTick: false,
- startOnTick: false,
- showLastLabel: true, //显示最后刻度值
- tickPixelInterval: 50
- }
- }
- /* 散点图颜色 */
- export const scatterColorsOptions = [ 'rgba(119, 152, 191, .5)','rgba(223, 83, 83, .5)' ]
- /* 复制图片额外option */
- export const copyOtherOptions = {
- legend: {
- align: 'center',
- layout: 'horizontal',
- itemStyle: {
- fontSize: "14px",
- color: '#444',
- textOverflow:undefined
- },
- itemMarginBottom:5,
- itemDistance: 0,
- padding: 0,
- margin: 10
- },
- seasonLegend:{
- align: 'center',
- layout: 'horizontal',
- itemStyle: {
- fontSize: "14px",
- color: '#444',
- }
- }
- }
- /* 图表年份筛选框 */
- export const yearSelector = [
- {
- name: '15年至今',
- value: 3,
- },
- // {
- // name: '18年至今',
- // value: 7,
- // },
- // {
- // name: '19年至今',
- // value: 8,
- // },
- {
- name: '20年至今',
- value: 9,
- },
- {
- name: '21年至今',
- value: 4,
- },
- {
- name: '22年至今',
- value: 11,
- },
- ]
- export const browser = () => {
- // 取得浏览器的userAgent字符串
- var userAgent = navigator.userAgent
- // 判断是否Opera浏览器
- var isOpera = userAgent.indexOf('Opera') > -1
- // 判断是否IE浏览器
- var isIE =
- userAgent.indexOf('compatible') > -1 &&
- userAgent.indexOf('MSIE') > -1 &&
- !isOpera
- // 判断是否IE的Edge浏览器
- var isEdge = userAgent.indexOf('Edge') > -1
- // 判断是否Firefox浏览器
- var isFF = userAgent.indexOf('Firefox') > -1
- // 判断是否Safari浏览器
- var isSafari =
- userAgent.indexOf('Safari') > -1 && userAgent.indexOf('Chrome') === -1
- // 判断Chrome浏览器
- var isChrome =
- userAgent.indexOf('Chrome') > -1 && userAgent.indexOf('Safari') > -1
- if (isIE) {
- var reIE = new RegExp('MSIE (\\d+\\.\\d+);')
- reIE.test(userAgent)
- var fIEVersion = parseFloat(RegExp['$1'])
- if (fIEVersion === 7) {
- return 'IE7'
- } else if (fIEVersion === 8) {
- return 'IE8'
- } else if (fIEVersion === 9) {
- return 'IE9'
- } else if (fIEVersion === 10) {
- return 'IE10'
- } else if (fIEVersion === 11) {
- return 'IE11'
- } else {
- return 'IE'
- }
- }else if (isOpera) {
- return 'Opera'
- }else if (isEdge) {
- return 'Edge'
- }else if (isFF) {
- return 'FF'
- }else if (isSafari) {
- return 'Safari'
- }else if (isChrome) {
- return 'Chrome'
- }else {
- return ''
- }
- }
- // 判断设备
- export const getTerminal = () => {
- // 获取终端的相关信息
- var Terminal = {
- // 辨别移动终端类型
- platform: function () {
- var u = navigator.userAgent,
- app = navigator.appVersion;
- return {
- // android终端或者uc浏览器
- android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1,
- // 是否为iPhone或者QQHD浏览器
- iPhone: u.indexOf('iPhone') > -1,
- // 是否iPad
- iPad: u.indexOf('iPad') > -1
- };
- }()
- }
- // 根据不同的终端,跳转到不同的地址
- if (Terminal.platform.android) {
- return 'android';
- } else if (Terminal.platform.iPhone || Terminal.platform.iPad) {
- return 'ios';
- }
- }
|