Skip to content

Commit 7efa662

Browse files
committed
quick fix for absent overview data or older logs
1 parent 08202ba commit 7efa662

File tree

1 file changed

+69
-60
lines changed

1 file changed

+69
-60
lines changed

static/js/tree-overview.js

Lines changed: 69 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -89,58 +89,58 @@ const Overview = (function (dispatch, data, dimensions) {
8989
unit: 'quantrinoin'
9090
}],
9191
[{
92-
data: data['vehicle_attitude'],
93-
log: 'vehicle_attitude',
94-
x: 'timestamp',
95-
y: 'q[2]',
96-
title: 'Yaw Angle Estimated (Degs)',
97-
color: color1,
98-
unit: 'quantrinoin'
99-
},
100-
{
101-
data: data['vehicle_attitude_setpoint'],
102-
log: 'vehicle_attitude_setpoint',
103-
x: 'timestamp',
104-
y: 'q_d[2]',
105-
title: 'Yaw Angle Setpoint (Degs)',
106-
color: color5,
107-
unit: 'quantrinoin'
92+
data: data['vehicle_attitude'],
93+
log: 'vehicle_attitude',
94+
x: 'timestamp',
95+
y: 'q[2]',
96+
title: 'Yaw Angle Estimated (Degs)',
97+
color: color1,
98+
unit: 'quantrinoin'
99+
},
100+
{
101+
data: data['vehicle_attitude_setpoint'],
102+
log: 'vehicle_attitude_setpoint',
103+
x: 'timestamp',
104+
y: 'q_d[2]',
105+
title: 'Yaw Angle Setpoint (Degs)',
106+
color: color5,
107+
unit: 'quantrinoin'
108108
}],
109109
[{
110-
data: data['vehicle_attitude'],
111-
log: 'vehicle_attitude',
112-
x: 'timestamp',
113-
y: 'rollspeed',
114-
title: 'Roll Anguler Rate Estimated (Degs/s)',
115-
color: color1,
116-
unit: 'quantrinoin'
117-
},
118-
{
119-
data: data['vehicle_rates_setpoint'],
120-
log: 'vehicle_rates_setpoint',
121-
x: 'timestamp',
122-
y: 'roll',
123-
title: 'Roll Angular Rate Setpoint (Degs/s)',
124-
color: color5,
125-
unit: 'quantrinoin'
126-
}],
110+
data: data['vehicle_attitude'],
111+
log: 'vehicle_attitude',
112+
x: 'timestamp',
113+
y: 'rollspeed',
114+
title: 'Roll Anguler Rate Estimated (Degs/s)',
115+
color: color1,
116+
unit: 'quantrinoin'
117+
},
118+
{
119+
data: data['vehicle_rates_setpoint'],
120+
log: 'vehicle_rates_setpoint',
121+
x: 'timestamp',
122+
y: 'roll',
123+
title: 'Roll Angular Rate Setpoint (Degs/s)',
124+
color: color5,
125+
unit: 'quantrinoin'
126+
}],
127127
[{
128-
data: data['vehicle_attitude'],
129-
log: 'vehicle_attitude',
130-
x: 'timestamp',
131-
y: 'pitchspeed',
132-
title: 'Pitch Angular Rate Estimated (Degs/s)',
133-
color: color1,
134-
unit: 'quantrinoin'
128+
data: data['vehicle_attitude'],
129+
log: 'vehicle_attitude',
130+
x: 'timestamp',
131+
y: 'pitchspeed',
132+
title: 'Pitch Angular Rate Estimated (Degs/s)',
133+
color: color1,
134+
unit: 'quantrinoin'
135135
},
136-
{
137-
data: data['vehicle_rates_setpoint'],
138-
log: 'vehicle_rates_setpoint',
139-
x: 'timestamp',
140-
y: 'pitch',
141-
title: 'Pitch Angular Rate Setpoint (Degs/s)',
142-
color: color5,
143-
unit: 'quantrinoin'
136+
{
137+
data: data['vehicle_rates_setpoint'],
138+
log: 'vehicle_rates_setpoint',
139+
x: 'timestamp',
140+
y: 'pitch',
141+
title: 'Pitch Angular Rate Setpoint (Degs/s)',
142+
color: color5,
143+
unit: 'quantrinoin'
144144
}],
145145
[{
146146
data: data['vehicle_attitude'],
@@ -260,12 +260,16 @@ const Overview = (function (dispatch, data, dimensions) {
260260
pinned: false,
261261
default: true
262262
}
263-
263+
264264

265265

266266
for (let i = 0; i < multicharts.length; i++) {
267-
let starter = overviewChartGen('overview', multicharts[i], defaultPinnedLineChartSpec);
268-
if (i == 0) dispatch.call('mapped', this, starter);
267+
try {
268+
let starter = overviewChartGen('overview', multicharts[i], defaultPinnedLineChartSpec);
269+
if (i == 0) dispatch.call('mapped', this, starter);
270+
} catch {
271+
console.log('something went wrong with these charts', multicharts[i]);
272+
}
269273
}
270274

271275

@@ -279,6 +283,11 @@ const Overview = (function (dispatch, data, dimensions) {
279283
let yVal = what[0].y || what.y
280284
let xVal = what[0].x || what.x
281285

286+
if(chartData == undefined){
287+
return ""
288+
}
289+
console.log(chartData)
290+
282291
if (what[0].unit == 'millimeters') {
283292
chartData = convertMillimeters(chartData, yVal);
284293
}
@@ -304,8 +313,8 @@ const Overview = (function (dispatch, data, dimensions) {
304313

305314

306315
for (let i = 0; i < what.length; i++) {
307-
308-
let id = 'chart' + (chartNo + i);
316+
317+
let id = 'chart' + (chartNo + i);
309318

310319
var title = div.append("span")
311320
.attr("x", margin.right + margin.left + 10)
@@ -327,10 +336,10 @@ const Overview = (function (dispatch, data, dimensions) {
327336
.attr('id', 'mapSel' + (chartNo + i))
328337
.style('float', 'right')
329338
.style('color', 'lightgrey')
330-
.style("font-size", "14px")
339+
.style("font-size", "14px")
331340
.append('i')
332341
.attr('class', 'mdi mdi-map')
333-
342+
334343
.on('click', function () {
335344
console.log(chartLedger)
336345
dispatch.call('mapped', this, chartLedger[i])
@@ -360,10 +369,10 @@ const Overview = (function (dispatch, data, dimensions) {
360369
dispatch.call('unpinned', this, spec, id)
361370
}
362371
})
363-
.style("font-size", "14px")
372+
.style("font-size", "14px")
364373
.append('i')
365374
.attr('class', "mdi mdi-pin")
366-
375+
367376

368377
div.append('br')
369378
}
@@ -458,7 +467,7 @@ const Overview = (function (dispatch, data, dimensions) {
458467
}).left;
459468

460469

461-
470+
462471

463472
svg
464473
.append('rect')
@@ -585,7 +594,7 @@ const Overview = (function (dispatch, data, dimensions) {
585594
dispatch.call('chartCreated', this, chartInfo)
586595

587596
}
588-
597+
589598
var focus = lineChart
590599
.append('g')
591600
.append('rect')
@@ -602,7 +611,7 @@ const Overview = (function (dispatch, data, dimensions) {
602611
.style("opacity", 0)
603612
.attr("text-anchor", "left")
604613
.attr("alignment-baseline", "middle")
605-
614+
606615

607616

608617
return chartInfo

0 commit comments

Comments
 (0)