This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
nezha-nezha-fronted/nezha-fronted/src/components/page/dashboard/overview/chartConfig.vue

153 lines
3.6 KiB
Vue
Raw Normal View History

<script>
import chartDataFormat from "../../../charts/chartDataFormat";
import bus from '../../../../libs/bus';
2020-04-22 19:45:10 +08:00
let bgColorList=['#b3424a','#7bbfea', '#f05b72', '#596032', '#bd6758',
'#cd9a5b', '#918597', '#70a19f', '#005344', '#FF00FF',
'#f7acbc', '#5f5d46', '#66ffff', '#ccFF66', '#f47920',
'#769149', '#1d953f', '#abc88b', '#7f7522', '#9b95c9',
'#f3715c', '#ea66a6', '#d1c7b7', '#9d9087', '#77787b',
'#f58220', '#c37e00', '#00ae9d', '#f26522', '#76becc',
'#76624c', '#d71345', '#2468a2', '#ca8687', '#1b315e',
]
const commonOption={
title:{
show:false,
},
color: bgColorList,
legend:{
show:false,
},
2020-04-22 19:45:10 +08:00
toolbox:{
show:false,
top:'0',
showTitle:false,
tooltip:{
show:false,
},
feature:{
dataZoom:{
yAxisIndex:false
},
magicType:{
type:['stack']
},
// restore: {},
}
},
tooltip: {
trigger: 'axis',
confine:false,
extraCssText:'z-index:1000;',
// formatter:null,
// position:null,
},
grid: {
2020-04-22 19:45:10 +08:00
top: 30,
left: 0,
right: 30,
containLabel: true,
2020-04-22 19:45:10 +08:00
bottom:8,//156
},
dataZoom: [{
type: 'slider',
show:false,
xAxisIndex: [0],
start: 0,
end: 100,
height:25,
bottom:10,//96
left:40,
right:48,
}],
xAxis: {
type: 'time',
// boundaryGap: false,//line-false; bar-true;
axisLabel: {
intervale: 0,
rotate: 0,
formatter: function (value) {
value=bus.computeTimezone(value)
var t_date = new Date(value);
return [t_date.getFullYear(), t_date.getMonth() + 1, t_date.getDate()].join('-') + "\n"
+ [t_date.getHours(), t_date.getMinutes()].join(':');
}
},
axisPointer: {//y轴上显示指针对应的值
show: true,
},
splitLine:{
show:false
}
},
yAxis: {
type: 'value',
splitLine:{
show:true
},
axisLabel: {
// formatter:null,
},
},
useUTC: false,//使用本地时间
series: [],
}
2020-03-24 13:19:18 +08:00
const mapOptions={
2020-03-24 20:25:16 +08:00
geo:{
map:'',
roam:'scale',//鼠标是否可以控制缩放
scaleLimit:{
min:0.7,
max:1.5
},
2020-03-24 20:25:16 +08:00
// center:[],//当前视角的中心点,用经纬度表示
label: { //控制显示地图名称
normal: {
show: true
},
emphasis: {
show: true
},
} ,
itemStyle:{
// areaColor:'lightgrey', //设置默认状态下地图颜色
2020-03-24 20:25:16 +08:00
},
emphasis:{
itemStyle: {
areaColor:'white'
}
},
left:0,
top:0,
right:0,
bottom:0,
},
2020-03-24 13:19:18 +08:00
tooltip : {
trigger: 'item',
type:'cross',
alwaysShowContent: false,
// backgroundColor: 'rgba(0,0,0,0.7)',
2020-03-24 20:25:16 +08:00
borderColor:'#ffffff',
2020-03-24 13:19:18 +08:00
borderRadius: 4,
borderWidth: 1,
padding: 0,
},
2020-03-24 13:19:18 +08:00
}
const chartTypes={
line:{name:'line',option:commonOption},
map:{name:'map',option:mapOptions},
}
export default {
getOption:function(type){
return Object.assign({},chartTypes[type].option);
},
2020-03-24 20:25:16 +08:00
setMap:function(map){
mapOptions.geo.map=map
},
getBgColorList:function(){
return Object.assign([],bgColorList)
2020-03-24 20:25:16 +08:00
}
}
</script>