Browse Source

优化压力表

master
谕仙 2 years ago
parent
commit
0c56b8125d
  1. 530
      lpro/src/main/webapp/page/visual/index.html
  2. 61
      lpro/src/main/webapp/page/visual/js/cfg.js
  3. 28
      lpro/src/main/webapp/page/visual/js/show.js

530
lpro/src/main/webapp/page/visual/index.html

File diff suppressed because it is too large

61
lpro/src/main/webapp/page/visual/js/cfg.js

@ -917,8 +917,13 @@ function initSensorPiezometerchart(){
}, },
axisLabel: { axisLabel: {
fontSize: 24, fontSize: 24,
distance: 12, distance: 24,
formatter: '{value}' formatter: function (value){
if(value==0){
return ;
}
return value;
}
}, },
pointer: { pointer: {
show:true, show:true,
@ -1098,6 +1103,31 @@ function updateChartsOptions(modiflyMap){
// 获取数据属性 // 获取数据属性
const optionStr= optionNode.getAttribute("option"); const optionStr= optionNode.getAttribute("option");
const option=JSON.parse(optionStr); const option=JSON.parse(optionStr);
const rect=JSON.parse(current_edit_obj.attr("pi-rect"));
const max_m= Math.max(...rect);
const min_m= Math.min(...rect);
let isCircle=null;
if(max_m<0){
isCircle=false;
}else if(min_m>0){
isCircle=false;
}else{
isCircle=Math.abs(rect[0])+Math.abs(rect[1])==360;
}
const pimin=Number(current_edit_obj.attr('pimin'));
if(isCircle){
option.series[0].axisLabel.formatter=function (value){
if(value==pimin){
return ;
}
return Number(value).toFixed(0);
};
}else {
option.series[0].axisLabel.formatter = function (value) {
return Number(value).toFixed(0);
};
}
// 获取地图 // 获取地图
var chart = getEchartObj(); var chart = getEchartObj();
@ -1559,14 +1589,29 @@ function reinitChartObj(){
var json = $(this).attr("option"); var json = $(this).attr("option");
var option=JSON.parse(json); var option=JSON.parse(json);
if(nid=='5'&&cid=='6'){ if(nid=='5'&&cid=='6'){
var picompany=parentEl.attr('picompany'); const rect=JSON.parse(parentEl.attr("pi-rect"));
if(picompany){ const max_m= Math.max(...rect);
const min_m= Math.min(...rect);
let isCircle=null;
if(max_m<0){
isCircle=false;
}else if(min_m>0){
isCircle=false;
}else{
isCircle=Math.abs(rect[0])+Math.abs(rect[1])==360;
}
const pimin=Number(parentEl.attr('pimin'));
if(isCircle){
option.series[0].axisLabel.formatter=function (value){ option.series[0].axisLabel.formatter=function (value){
if (value === 0) { if(value==pimin){
return ''; return ;
} }
return value + picompany; return Number(value).toFixed(0);
} };
}else {
option.series[0].axisLabel.formatter = function (value) {
return Number(value).toFixed(0);
};
} }
} }
var myChart = echarts.init($(this)[0]); var myChart = echarts.init($(this)[0]);

28
lpro/src/main/webapp/page/visual/js/show.js

@ -339,16 +339,32 @@ function reinitChartObj(){
}else if(cid == '6'&& nid =='5'){ // 液压图 }else if(cid == '6'&& nid =='5'){ // 液压图
var json = $(this).attr("option"); var json = $(this).attr("option");
var piCompany = $(this).parent().attr("picompany"); var parentEl = $(this).parent();
var myChart = echarts.init($(this)[0]); var myChart = echarts.init($(this)[0]);
var option = JSON.parse(json) ; var option = JSON.parse(json) ;
if(piCompany!=null){ const rect=JSON.parse(parentEl.attr("pi-rect"));
const max_m= Math.max(...rect);
const min_m= Math.min(...rect);
let isCircle=null;
if(max_m<0){
isCircle=false;
}else if(min_m>0){
isCircle=false;
}else{
isCircle=Math.abs(rect[0])+Math.abs(rect[1])==360;
}
const pimin=Number(parentEl.attr('pimin'));
if(isCircle){
option.series[0].axisLabel.formatter=function (value){ option.series[0].axisLabel.formatter=function (value){
if (value === 0) { if(value==pimin){
return ''; return ;
} }
return value + piCompany; return Number(value).toFixed(0);
} };
}else {
option.series[0].axisLabel.formatter = function (value) {
return Number(value).toFixed(0);
};
} }
myChart.setOption(option); myChart.setOption(option);
app.chartMap[id] = myChart; app.chartMap[id] = myChart;

Loading…
Cancel
Save