列车曲线图调整

This commit is contained in:
dong 2023-10-23 16:13:45 +08:00
parent b5794cd854
commit 40061eef03

View File

@ -40,6 +40,9 @@ let tractionForceList: [Date, number][] = [];
let brakeForceList: [Date, number][] = [];
let kmList: number[] = [];
let km_speedList: [number, number][] = [];
let km_accelerationList: [number, number][] = [];
let km_tractionForceList: [number, number][] = [];
let km_brakeForceList: [number, number][] = [];
let maxKm: number;
let minKm: number;
@ -62,6 +65,9 @@ function getDataList() {
brakeForceList = [];
kmList = [];
km_speedList = [];
km_accelerationList = [];
km_tractionForceList = [];
km_brakeForceList = [];
lineStore.trainStateMap.forEach((list, key) => {
const find = list.find((ii) => {
return ii.id == props.trainId;
@ -74,6 +80,18 @@ function getDataList() {
if (!kmList.includes(find.trainKilometer)) {
kmList.push(find.trainKilometer);
km_speedList.push([find.trainKilometer, find.dynamicState.speed / 100]);
km_accelerationList.push([
find.trainKilometer,
find.dynamicState.acceleration,
]);
km_tractionForceList.push([
find.trainKilometer,
find.vobcState.tractionForce / 100,
]);
km_brakeForceList.push([
find.trainKilometer,
find.vobcState.brakeForce / 100,
]);
}
}
});
@ -121,6 +139,28 @@ let km_series: SeriesObj[] = [
data: km_speedList,
unit: 'km/h',
},
{
name: '加速度',
type: 'line',
showSymbol: false,
yAxisIndex: 1,
data: km_accelerationList,
unit: 'm/s',
},
{
name: '牵引力',
type: 'line',
showSymbol: false,
data: km_tractionForceList,
unit: 'kn',
},
{
name: '制动力',
type: 'line',
showSymbol: false,
data: brakeForceList,
unit: 'kn',
},
];
function trainKilometerFormat(v: number) {
@ -295,7 +335,7 @@ function initEcharts() {
},
},
legend: {
data: ['速度'],
data: ['速度', '加速度', '牵引力', '制动力'],
},
xAxis: {
type: 'value',
@ -308,13 +348,26 @@ function initEcharts() {
yAxis: [
{
type: 'value',
max: 100,
// max: 100,
axisLine: {
show: false,
},
axisTick: {
show: false,
},
boundaryGap: [0, 0.1],
},
{
type: 'value',
scale: true,
name: '加速度 m/s',
axisLine: {
show: false,
},
axisTick: {
show: false,
},
boundaryGap: [0, 0.4],
},
],
series: km_series,
@ -349,6 +402,15 @@ watch(
{
data: km_speedList,
},
{
data: km_accelerationList,
},
{
data: km_tractionForceList,
},
{
data: km_brakeForceList,
},
],
};
}