diff --git a/lpro/src/main/webapp/page/visual/index.html b/lpro/src/main/webapp/page/visual/index.html
index 59de6f7..bc5a660 100644
--- a/lpro/src/main/webapp/page/visual/index.html
+++ b/lpro/src/main/webapp/page/visual/index.html
@@ -1015,7 +1015,7 @@
-
+
仪表盘刻度最小值
@@ -1038,7 +1038,7 @@
-
+
图表设置
@@ -1059,7 +1059,6 @@
-
@@ -2004,6 +2003,7 @@
cl.attr("pi-rect",JSON.stringify( this.piRect));
updateChartsOptions(new Map([["startAngle",value[0]],["endAngle",value[1]]]));
},
+ // 修改预设角度
changeAngleStyle(){
var cl = cfg.current_edit_obj ;
if(this.angleStyle=="style1"){
@@ -2019,10 +2019,12 @@
cl.attr("angle-style",this.angleStyle);
},
+ // 修改开始角度
changeStartAngle(e){
this.piRect=[Number(e.target.value),this.piRect[1]];
this.changePiRect(this.piRect);
},
+ // 修改结束角度
changeEndAngle(e){
this.piRect=[this.piRect[0],Number(e.target.value)];
this.changePiRect(this.piRect);
diff --git a/lpro/src/main/webapp/page/visual/js/cfg.js b/lpro/src/main/webapp/page/visual/js/cfg.js
index 7993727..ddc07ea 100644
--- a/lpro/src/main/webapp/page/visual/js/cfg.js
+++ b/lpro/src/main/webapp/page/visual/js/cfg.js
@@ -94,6 +94,7 @@ var cfg = {
return deg>=360?0:deg;
},
+ // 拖拽克隆元素到画布的方法
elementDragCopyInfo :function(selector){
$(selector).droppable({
activeClass: "ui-state-default",
@@ -220,7 +221,6 @@ var cfg = {
})
},
generateNewNode:function(obj,style){
- console.log('generateNewNode');
//新节点 添加属性 更新全局变量
obj.attr("id","node"+ this.zIndexT); //用于标识唯一
style['z-index'] = this.zIndexT;
@@ -1105,25 +1105,36 @@ function updateChartsOptions(modiflyMap){
const option=JSON.parse(optionStr);
const nid=current_edit_obj.attr("nid");
const cid=current_edit_obj.attr("cid");
+ // 在液压表的时候添加formatter属性,360度时候,因为0和100重合故而不显示0,界面上显示为整数
if(nid=="5"&&cid=="6"){
const rectAttr=current_edit_obj.attr("pi-rect");
+ // 获取开始角和结束角
const rect=JSON.parse(rectAttr);
+ // 最大角度
const max_m= Math.max(...rect);
+ // 最小角度
const min_m= Math.min(...rect);
let isCircle=null;
+ // 因取值范围为[-360,360],故最大值小于0,不是圆
if(max_m<0){
isCircle=false;
+ // 因取值范围为[-360,360],故最小值大于0,不是圆
}else if(min_m>0){
isCircle=false;
}else{
+ // 判断最大值减最小值的绝对值是否等于360度,已判断是否为圆
isCircle=Math.abs(rect[0])+Math.abs(rect[1])==360;
}
+ // 最小刻度
const pimin=Number(current_edit_obj.attr('pimin'));
+ // 是否是一个圆(360度)
if(isCircle){
option.series[0].axisLabel.formatter=function (value){
+ // 值等于最小刻度,则不显示
if(value==pimin){
return ;
}
+ // 显示整数
return Number(value).toFixed(0);
};
}else {
@@ -1134,31 +1145,37 @@ function updateChartsOptions(modiflyMap){
}
// 获取地图
var chart = getEchartObj();
-
+ // 要修改的属性集合
if(modiflyMap.size>0){
modiflyMap.forEach(
(value,key,map)=>{
+ // 调用修改属性方法
analysisProp(option,key,value);
}
)
}
- // 写入属性
+ // 写入元素属性
optionNode.setAttribute("option",JSON.stringify(option));
// 更新地图
chart.setOption(option);
}
+// 解析属性并更改方法
function analysisProp(option,propName,value){
if(propName){
+ // 解析属性名是否是顶级属性,或者多级属性。例如: 顶级属性 xxx 多级属性 xxx.a.c
const propertys=propName.split('.');
const pLen=propertys.length;
+ // 固定更改第一个echar对象数据
let data=option.series[0];
let finally_obj=null;
+ // 顶级属性修改
if(propertys.length==1){
data[propName]=value;
return;
}
+ // 多级属性修改
for (let i=0;i