Skip to content

Fixed issues of first applications run #753

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 1, 2024
9 changes: 6 additions & 3 deletions src/graph_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,18 @@ export function GraphConfig(graphConfig) {
const matches = field.name.match(/^(.+)\[all\]$/);
const logFieldNames = flightLog.getMainFieldNames();
const fields = [];
const setupColor = field?.color == -1;
if (matches) {
const
nameRoot = matches[1],
nameRegex = new RegExp("^" + escapeRegExp(nameRoot) + "\[[0-9]+\]$");

let colorIndex = 0;
for (const fieldName of logFieldNames) {
if (fieldName.match(nameRegex)) {
// forceNewCurve must be true for min max computing extended curves.
const forceNewCurve = true;
field.color = undefined;
const color = GraphConfig.PALETTE[colorIndex++ % GraphConfig.PALETTE.length].color;
field.color = setupColor ? color : undefined;
fields.push(adaptField(flightLog, $.extend({}, field, {curve: $.extend({}, field.curve), name: fieldName, friendlyName: FlightLogFieldPresenter.fieldNameToFriendly(fieldName, flightLog.getSysConfig().debug_mode)}), forceNewCurve));
}
}
Expand Down Expand Up @@ -1395,7 +1397,8 @@ GraphConfig.load = function(config) {

for (const srcFieldName of srcGraph.fields) {
const destField = {
name: srcFieldName
name: srcFieldName,
color: -1,
};

destGraph.fields.push(destField);
Expand Down
8 changes: 5 additions & 3 deletions src/graph_config_dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,14 @@ export function GraphConfigurationDialog(dialog, onSave) {
$('select.graph-height', graphElem).replaceWith(chooseHeight(graph.height?(graph.height):1));

// Add Field List
let colorIndex = 0;
for (const field of graph.fields) {
const extendedFields = activeGraphConfig.extendFields(activeFlightLog, field);
let colorIndex = 0;
for (const extField of extendedFields) {
const color = extField.color ?? GraphConfig.PALETTE[colorIndex++ % GraphConfig.PALETTE.length].color;
const fieldElem = renderField(flightLog, extField, color);
if (!extField.color || extField.color == -1) {
extField.color = GraphConfig.PALETTE[colorIndex++ % GraphConfig.PALETTE.length].color;
}
const fieldElem = renderField(flightLog, extField, extField.color);
fieldList.append(fieldElem);
}
}
Expand Down
Loading