厚度曲线出口厚度显示三位小数、去除设定值线,横坐标从0起步长500
This commit is contained in:
@@ -323,19 +323,20 @@ const GAUGE_DEV_RANGE = { min: -5, max: 5 }
|
|||||||
* yAxisSuffix: 纵轴标签后缀,如 '%'
|
* yAxisSuffix: 纵轴标签后缀,如 '%'
|
||||||
* yRange: 可选 { min, max },不传则按全量数据自适应
|
* yRange: 可选 { min, max },不传则按全量数据自适应
|
||||||
*/
|
*/
|
||||||
function makeLine(title, xData, yData, extras = [], yAxisSuffix = '', yRange = null) {
|
function makeLine(title, xData, yData, extras = [], yAxisSuffix = '', yRange = null, xAxisOpts = null) {
|
||||||
const allVals = [yData, ...extras.map(e => e.data)].flat()
|
const allVals = [yData, ...extras.map(e => e.data)].flat()
|
||||||
const range = yRange || calcYRange(allVals)
|
const range = yRange || calcYRange(allVals)
|
||||||
const hasExtras = extras.length > 0
|
const hasExtras = extras.length > 0
|
||||||
|
const toSeriesData = arr => xAxisOpts ? xData.map((x, i) => [x, arr[i]]) : arr
|
||||||
const mainSeries = {
|
const mainSeries = {
|
||||||
name: title, type: 'line', smooth: false, symbol: 'none',
|
name: title, type: 'line', smooth: false, symbol: 'none',
|
||||||
lineStyle: { width: 1.5, color: '#409EFF' }, data: yData, z: 3
|
lineStyle: { width: 1.5, color: '#409EFF' }, data: toSeriesData(yData), z: 3
|
||||||
}
|
}
|
||||||
const extraSeries = extras.map(e => ({
|
const extraSeries = extras.map(e => ({
|
||||||
name: e.name,
|
name: e.name,
|
||||||
type: 'line', smooth: false, symbol: 'none',
|
type: 'line', smooth: false, symbol: 'none',
|
||||||
lineStyle: { width: 1, color: e.color || '#E6A23C', type: e.dash !== false ? 'dashed' : 'solid' },
|
lineStyle: { width: 1, color: e.color || '#E6A23C', type: e.dash !== false ? 'dashed' : 'solid' },
|
||||||
data: e.data, z: 2
|
data: toSeriesData(e.data), z: 2
|
||||||
}))
|
}))
|
||||||
return {
|
return {
|
||||||
title: { text: title, textStyle: { fontSize: 12, fontWeight: 'normal' }, top: 4, left: 8 },
|
title: { text: title, textStyle: { fontSize: 12, fontWeight: 'normal' }, top: 4, left: 8 },
|
||||||
@@ -350,7 +351,12 @@ function makeLine(title, xData, yData, extras = [], yAxisSuffix = '', yRange = n
|
|||||||
: undefined
|
: undefined
|
||||||
},
|
},
|
||||||
grid: { top: hasExtras ? 44 : 36, bottom: 28, left: 8, right: 16, containLabel: true },
|
grid: { top: hasExtras ? 44 : 36, bottom: 28, left: 8, right: 16, containLabel: true },
|
||||||
xAxis: {
|
xAxis: xAxisOpts
|
||||||
|
? {
|
||||||
|
type: 'value', min: xAxisOpts.min, interval: xAxisOpts.interval,
|
||||||
|
name: 'pos(m)', nameTextStyle: { fontSize: 10 }, axisLabel: { fontSize: 10 }
|
||||||
|
}
|
||||||
|
: {
|
||||||
type: 'category', data: xData,
|
type: 'category', data: xData,
|
||||||
name: 'pos(m)', nameTextStyle: { fontSize: 10 }, axisLabel: { fontSize: 10 }
|
name: 'pos(m)', nameTextStyle: { fontSize: 10 }, axisLabel: { fontSize: 10 }
|
||||||
},
|
},
|
||||||
@@ -382,6 +388,16 @@ function xLocData(rows) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function xLocNumData(rows) {
|
||||||
|
return rows.map(r => {
|
||||||
|
const v = r.XLOCATION !== undefined ? r.XLOCATION : r.xlocation
|
||||||
|
return v == null ? null : Number(v)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 厚度曲线横坐标:从 0 开始,步长 500
|
||||||
|
const GAUGE_X_AXIS_OPTS = { min: 0, interval: 500 }
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ActualPerformance',
|
name: 'ActualPerformance',
|
||||||
components: { QualityReportDialog },
|
components: { QualityReportDialog },
|
||||||
@@ -631,7 +647,7 @@ export default {
|
|||||||
renderGaugeCharts() {
|
renderGaugeCharts() {
|
||||||
const rows = this.gaugeRows
|
const rows = this.gaugeRows
|
||||||
if (!rows || !rows.length) return
|
if (!rows || !rows.length) return
|
||||||
const xData = xLocData(rows)
|
const xData = xLocNumData(rows)
|
||||||
// THICK0~THICK4 对应的参考列
|
// THICK0~THICK4 对应的参考列
|
||||||
const refColMap = { THICK0: 'THICK0REF', THICK1: 'THICK1REF', THICK4: 'THICK4REF', THICK5: 'THICK5REF' }
|
const refColMap = { THICK0: 'THICK0REF', THICK1: 'THICK1REF', THICK4: 'THICK4REF', THICK5: 'THICK5REF' }
|
||||||
const chartRefs = ['chartGauge1', 'chartGauge2', 'chartGauge3', 'chartGauge4']
|
const chartRefs = ['chartGauge1', 'chartGauge2', 'chartGauge3', 'chartGauge4']
|
||||||
@@ -641,25 +657,14 @@ export default {
|
|||||||
|
|
||||||
if (refCol) {
|
if (refCol) {
|
||||||
// ── 厚度偏差图:THICKx 即相对设定值的偏差%,纵轴直接画偏差、0 为基准 ──
|
// ── 厚度偏差图:THICKx 即相对设定值的偏差%,纵轴直接画偏差、0 为基准 ──
|
||||||
// 实测数据验证(卷 26061045000):THICK0 在 -3% 上下、THICK0REF=3.0mm,
|
|
||||||
// 与 L2 原生 HMI 一致——蓝色 0 线为设定值,曲线为实测偏差
|
|
||||||
const yData = rows.map(r => {
|
const yData = rows.map(r => {
|
||||||
const v = getRowVal(r, col)
|
const v = getRowVal(r, col)
|
||||||
const rv = getRowVal(r, refCol)
|
const rv = getRowVal(r, refCol)
|
||||||
if (v == null || rv == null || rv === 0) return null
|
if (v == null || rv == null || rv === 0) return null
|
||||||
return parseFloat(v.toFixed(3))
|
return parseFloat(v.toFixed(3))
|
||||||
})
|
})
|
||||||
// 设定值(绝对厚度 mm):取首个非空 REF,写入标题
|
const chartTitle = title
|
||||||
let refVal = null
|
|
||||||
for (const r of rows) {
|
|
||||||
const rv = getRowVal(r, refCol)
|
|
||||||
if (rv != null && rv !== 0) { refVal = rv; break }
|
|
||||||
}
|
|
||||||
const chartTitle = refVal != null ? `${title} - 设定值: ${refVal.toFixed(2)}[mm]` : title
|
|
||||||
|
|
||||||
const extras = []
|
const extras = []
|
||||||
// 设定基准线恒为 0
|
|
||||||
extras.push({ name: '设定值(0)', data: yData.map(v => v == null ? null : 0), color: '#909399', dash: false })
|
|
||||||
|
|
||||||
// TOPLIMIT/BOTLIMIT 是冷轧机出口厚度的 AGC 公差带(逐行变化,
|
// TOPLIMIT/BOTLIMIT 是冷轧机出口厚度的 AGC 公差带(逐行变化,
|
||||||
// 头尾加减速段约 ±2.5%、稳态段收紧到约 ±1%),只约束出口厚度。
|
// 头尾加减速段约 ±2.5%、稳态段收紧到约 ±1%),只约束出口厚度。
|
||||||
@@ -677,14 +682,14 @@ export default {
|
|||||||
if (upData.some(v => v != null)) extras.push({ name: '上限', data: upData, color: '#F56C6C', dash: true })
|
if (upData.some(v => v != null)) extras.push({ name: '上限', data: upData, color: '#F56C6C', dash: true })
|
||||||
if (loData.some(v => v != null)) extras.push({ name: '下限', data: loData, color: '#67C23A', dash: true })
|
if (loData.some(v => v != null)) extras.push({ name: '下限', data: loData, color: '#67C23A', dash: true })
|
||||||
}
|
}
|
||||||
return this.makeChart(ref, makeLine(chartTitle, xData, yData, extras, '%', GAUGE_DEV_RANGE))
|
return this.makeChart(ref, makeLine(chartTitle, xData, yData, extras, '%', GAUGE_DEV_RANGE, GAUGE_X_AXIS_OPTS))
|
||||||
} else {
|
} else {
|
||||||
// ── 速度等无参考值的图:保持原始单位 ──
|
// ── 速度等无参考值的图:保持原始单位 ──
|
||||||
const yData = rows.map(r => {
|
const yData = rows.map(r => {
|
||||||
const v = getRowVal(r, col)
|
const v = getRowVal(r, col)
|
||||||
return v == null ? null : parseFloat(v.toFixed(4))
|
return v == null ? null : parseFloat(v.toFixed(4))
|
||||||
})
|
})
|
||||||
return this.makeChart(ref, makeLine(title, xData, yData))
|
return this.makeChart(ref, makeLine(title, xData, yData, [], '', null, GAUGE_X_AXIS_OPTS))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.chartInstances = charts.filter(Boolean)
|
this.chartInstances = charts.filter(Boolean)
|
||||||
|
|||||||
Reference in New Issue
Block a user