修改正负值显示

master
夜笙歌 2 years ago
parent 11d6d89ec9
commit 9333d1ac10

@ -264,7 +264,7 @@ body.FoamerScada {
body.Foamer2 { body.Foamer2 {
height: auto; height: auto;
width: auto; width: auto;
background: url(../img/foamer2.jpg) no-repeat center fixed; background: url(../img/foamer21.jpg) no-repeat center fixed;
-webkit-background-size: cover; -webkit-background-size: cover;
-moz-background-size: cover; -moz-background-size: cover;
-o-background-size: cover; -o-background-size: cover;

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

@ -946,7 +946,7 @@ const barChartAndLineChartFour = function (data, id) {
} }
// 折线图 // 折线图
const lineChart = function (data, id, unit = '',smooth=false,color='#14bd2d') { const lineChart = function (data, id, unit = '', smooth = false, color = '#14bd2d') {
let charts = echarts.init(id); let charts = echarts.init(id);
if (!data) { if (!data) {
data = { data = {
@ -976,13 +976,13 @@ const lineChart = function (data, id, unit = '',smooth=false,color='#14bd2d') {
}, },
legend: { legend: {
top: '5%', top: '5%',
itemWidth:20, itemWidth: 20,
itemHeight:10, itemHeight: 10,
itemStyle:{ itemStyle: {
borderWidth:1, borderWidth: 1,
borderHeight:1, borderHeight: 1,
}, },
formatter:function (val) { formatter: function (val) {
return `${val} ` return `${val} `
}, },
textStyle: { textStyle: {
@ -1010,7 +1010,7 @@ const lineChart = function (data, id, unit = '',smooth=false,color='#14bd2d') {
}, },
yAxis: [ yAxis: [
{ {
name:'合格率', name: '合格率',
min: (min - 2 < 0) ? 0 : min - 2, min: (min - 2 < 0) ? 0 : min - 2,
max: (max + 2 > 100) ? 100 : max + 2, max: (max + 2 > 100) ? 100 : max + 2,
type: 'value', type: 'value',
@ -1031,7 +1031,7 @@ const lineChart = function (data, id, unit = '',smooth=false,color='#14bd2d') {
}, },
axisLabel: { axisLabel: {
show: true, show: true,
interval:0, interval: 0,
textStyle: { textStyle: {
color: '#ffffff', color: '#ffffff',
}, },
@ -1042,7 +1042,7 @@ const lineChart = function (data, id, unit = '',smooth=false,color='#14bd2d') {
{ {
name: data.yDataName, name: data.yDataName,
type: 'line', type: 'line',
smooth:smooth, smooth: smooth,
showAllSymbol: true, //显示所有图形。 showAllSymbol: true, //显示所有图形。
symbol: 'circle', //标记的图形为实心圆 symbol: 'circle', //标记的图形为实心圆
symbolSize: 4, //标记的大小 symbolSize: 4, //标记的大小
@ -1079,7 +1079,7 @@ const lineChart = function (data, id, unit = '',smooth=false,color='#14bd2d') {
} }
const lineChartTwo = function (data, id, unit = '') { const lineChartTwo = function (data, id, unit = '') {
let charts = echarts.init(id); let charts = echarts.init(id);
let color = ['#3094ea','#2fd032','#6ba72c','#7b6931','#8909E5'] let color = ['#3094ea', '#2fd032', '#6ba72c', '#7b6931', '#8909E5']
if (!data) { if (!data) {
data = { data = {
xName: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], xName: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
@ -1098,7 +1098,7 @@ const lineChartTwo = function (data, id, unit = '') {
let num = data.yData.map(val => val.data).flat(Infinity) let num = data.yData.map(val => val.data).flat(Infinity)
let min = Math.ceil(Math.min(...num)) let min = Math.ceil(Math.min(...num))
let max = Math.ceil(Math.max(...num)) let max = Math.ceil(Math.max(...num))
let series = data.yData.map((val,index) => { let series = data.yData.map((val, index) => {
return { return {
name: val.name, name: val.name,
type: 'line', type: 'line',
@ -1150,14 +1150,15 @@ const lineChartTwo = function (data, id, unit = '') {
}, },
legend: { legend: {
top: '5%', top: '5%',
itemWidth:20, itemWidth: 20,
itemHeight:10, itemHeight: 10,
formatter:function (val) { formatter: function (val) {
return `${val}` return `${val}`
}, },
textStyle: { textStyle: {
fontSize: 0.75 * vw, fontSize: 0.75 * vw,
color: () => {}, color: () => {
},
}, },
}, },
xAxis: { xAxis: {
@ -1210,7 +1211,7 @@ const lineChartTwo = function (data, id, unit = '') {
charts.setOption(option); charts.setOption(option);
$(window).resize(charts.resize); $(window).resize(charts.resize);
} }
const lineChartThree = function (data, id, unit = '',smooth=false) { const lineChartThree = function (data, id, unit = '', smooth = false) {
let charts = echarts.init(id); let charts = echarts.init(id);
if (!data) { if (!data) {
data = { data = {
@ -1221,8 +1222,8 @@ const lineChartThree = function (data, id, unit = '',smooth=false) {
yDataTwoName: "百分比" yDataTwoName: "百分比"
} }
} }
let min = Math.ceil(Math.min(...data.yData,...(data.yDataTwo || []))) let min = Math.ceil(Math.min(...data.yData, ...(data.yDataTwo || [])))
let max = Math.ceil(Math.max(...data.yData,...(data.yDataTwo || []))) let max = Math.ceil(Math.max(...data.yData, ...(data.yDataTwo || [])))
let option = { let option = {
grid: { grid: {
top: '28%', top: '28%',
@ -1242,13 +1243,13 @@ const lineChartThree = function (data, id, unit = '',smooth=false) {
}, },
legend: { legend: {
top: '5%', top: '5%',
itemWidth:20, itemWidth: 20,
itemHeight:10, itemHeight: 10,
itemStyle:{ itemStyle: {
borderWidth:1, borderWidth: 1,
borderHeight:1, borderHeight: 1,
}, },
formatter:function (val) { formatter: function (val) {
return `${val} ` return `${val} `
}, },
textStyle: { textStyle: {
@ -1276,7 +1277,7 @@ const lineChartThree = function (data, id, unit = '',smooth=false) {
}, },
yAxis: [ yAxis: [
{ {
name:'(元/台)', name: '(元/台)',
min: (min - 2 < 0) ? 0 : min - 2, min: (min - 2 < 0) ? 0 : min - 2,
max: (max + 2 > 100) ? 100 : max + 2, max: (max + 2 > 100) ? 100 : max + 2,
type: 'value', type: 'value',
@ -1297,7 +1298,7 @@ const lineChartThree = function (data, id, unit = '',smooth=false) {
}, },
axisLabel: { axisLabel: {
show: true, show: true,
interval:0, interval: 0,
textStyle: { textStyle: {
color: '#ffffff', color: '#ffffff',
}, },
@ -1308,7 +1309,7 @@ const lineChartThree = function (data, id, unit = '',smooth=false) {
{ {
name: data.yDataName, name: data.yDataName,
type: 'line', type: 'line',
smooth:smooth, smooth: smooth,
showAllSymbol: true, //显示所有图形。 showAllSymbol: true, //显示所有图形。
symbol: 'circle', //标记的图形为实心圆 symbol: 'circle', //标记的图形为实心圆
symbolSize: 4, //标记的大小 symbolSize: 4, //标记的大小
@ -1340,7 +1341,7 @@ const lineChartThree = function (data, id, unit = '',smooth=false) {
{ {
name: data.yDataTwoName, name: data.yDataTwoName,
type: 'line', type: 'line',
smooth:smooth, smooth: smooth,
showAllSymbol: true, //显示所有图形。 showAllSymbol: true, //显示所有图形。
symbol: 'circle', //标记的图形为实心圆 symbol: 'circle', //标记的图形为实心圆
symbolSize: 4, //标记的大小 symbolSize: 4, //标记的大小
@ -1528,11 +1529,11 @@ const pieChartTwo = function (data, id, unit = '次') {
// color: ["rgb(131,249,103)", "#FBFE27", "#FE5050", "#1DB7E5"], //'#FBFE27','rgb(11,228,96)','#FE5050' // color: ["rgb(131,249,103)", "#FBFE27", "#FE5050", "#1DB7E5"], //'#FBFE27','rgb(11,228,96)','#FE5050'
data: data, data: data,
roseType: "radius", roseType: "radius",
overflow:'break', overflow: 'break',
label: { label: {
overflow:'break', overflow: 'break',
normal: { normal: {
overflow:'break', overflow: 'break',
formatter: `{b|{b}} \n {c|{c}${unit}}`, formatter: `{b|{b}} \n {c|{c}${unit}}`,
rich: { rich: {
c: { c: {
@ -1630,7 +1631,7 @@ const verticalBarChart = function (data, id, unit = '次') {
series: [ series: [
{ {
type: "bar", type: "bar",
barWidth: data.yData.length<4? 2*vw:'75%', barWidth: data.yData.length < 4 ? 2 * vw : '75%',
label: { label: {
show: true, show: true,
position: 'top', position: 'top',
@ -1674,6 +1675,36 @@ const verticalBarChart = function (data, id, unit = '次') {
// 多个垂直柱状图 // 多个垂直柱状图
const multipleVerticalBarChart1 = function (data, id) { const multipleVerticalBarChart1 = function (data, id) {
let charts = echarts.init(id); let charts = echarts.init(id);
let num1 = data.yDataOne.slice(0,4)
let num2 = data.yDataTwo.slice(0,4)
let num3 = data.yDataThree.slice(0,4)
num1 = num1.map(e => {
if (e > 14) {
return 14
} else if (e < 10) {
return 10
} else {
return e
}
})
num2 = num2.map(e => {
if (e > 14) {
return 14
} else if (e < 10) {
return 10
} else {
return e
}
})
num3 = num3.map(e => {
if (e > 14) {
return 14
} else if (e < 10) {
return 10
} else {
return e
}
})
if (!data) { if (!data) {
data = { data = {
xName: [ xName: [
@ -1703,20 +1734,6 @@ const multipleVerticalBarChart1 = function (data, id) {
}, },
}, },
}, },
// trigger: "axis",
// formatter: `{b}<br />{a0}: {c0}<br />{a1}: {c1}`,
// axisPointer: {
// type: "shadow",
// label: {
// backgroundColor: "#6a7985",
// },
// },
// textStyle: {
// color: "#fff",
// fontStyle: "normal",
// fontFamily: "微软雅黑",
// fontSize: 12,
// },
}, },
grid: { grid: {
left: "1%", left: "1%",
@ -1745,7 +1762,7 @@ const multipleVerticalBarChart1 = function (data, id) {
{ {
type: "category", type: "category",
boundaryGap: true, //坐标轴两边留白 boundaryGap: true, //坐标轴两边留白
data: data.xName, data: ['A1', 'A2', 'A3', 'A4'],
axisLabel: { axisLabel: {
show: true, show: true,
color: '#fff' color: '#fff'
@ -2193,7 +2210,7 @@ const multipleVerticalBarChart = function (data, id) {
charts.setOption(option); charts.setOption(option);
$(window).resize(charts.resize); $(window).resize(charts.resize);
} }
const multipleVerticalBarChartTwo = function (data, id, rotate = 0, unit = '',margin=20,isColor=true) { const multipleVerticalBarChartTwo = function (data, id, rotate = 0, unit = '', margin = 20, isColor = true) {
let charts = echarts.init(id); let charts = echarts.init(id);
if (!data) { if (!data) {
data = { data = {
@ -2219,7 +2236,7 @@ const multipleVerticalBarChartTwo = function (data, id, rotate = 0, unit = '',ma
} }
}, },
legend: { legend: {
right:'0', right: '0',
data: [data.yDataOneName, data.yDataTwoName], data: [data.yDataOneName, data.yDataTwoName],
textStyle: { textStyle: {
fontSize: 0.75 * vw, fontSize: 0.75 * vw,
@ -2270,7 +2287,7 @@ const multipleVerticalBarChartTwo = function (data, id, rotate = 0, unit = '',ma
itemStyle: { itemStyle: {
//图形样式 //图形样式
normal: { normal: {
color: isColor? '#db8151': "#64BCEC", color: isColor ? '#db8151' : "#64BCEC",
}, },
}, },
label: { label: {
@ -2305,7 +2322,7 @@ const multipleVerticalBarChartTwo = function (data, id, rotate = 0, unit = '',ma
itemStyle: { itemStyle: {
//图形样式 //图形样式
normal: { normal: {
color: isColor? '#9ce375': "#4FD3B9", color: isColor ? '#9ce375' : "#4FD3B9",
}, },
}, },
data: data.yDataTwo data: data.yDataTwo
@ -2935,7 +2952,7 @@ const multipleBrokenLineAreaDiagram1 = (data, ids) => {
dataZoom: [], dataZoom: [],
xAxis: [ xAxis: [
{ {
show:false, show: false,
type: "category", type: "category",
boundaryGap: false, boundaryGap: false,
axisLine: { axisLine: {

Loading…
Cancel
Save