Skip to content
Snippets Groups Projects
Commit 2e52460f authored by Benedikt's avatar Benedikt
Browse files

added conformity plotting

parent c0d636b5
Branches
No related tags found
No related merge requests found
...@@ -127,11 +127,23 @@ export class DCCConformity { ...@@ -127,11 +127,23 @@ export class DCCConformity {
return []; return [];
} }
_getTolerance(q, language) {
if (q['dcc:name'] && q['dcc:name']['dcc:content']) {
let content = q['dcc:name']['dcc:content'];
if (Array.isArray(content)) {
const match = content.find(item => item.$ && item.$.lang === language) || content[0];
return match._ || match;
}
return content._ || content;
}
return '';
}
getLowerLimit() { getLowerLimit() {
const data = this.metaDataJson['dcc:data']; const data = this.metaDataJson['dcc:data'];
if (data && data['dcc:quantity']) { if (data && data['dcc:quantity']) {
let quantities = data['dcc:quantity']; let quantities = data['dcc:quantity'];
if (!Array.isArray(quantities)) quantities = [quantities]; if (!Array.isArray(quantities)) { quantities = [quantities]; }
for (let q of quantities) { for (let q of quantities) {
if (q.$ && q.$.refType && q.$.refType.includes('basic_toleranceLimitLower')) { if (q.$ && q.$.refType && q.$.refType.includes('basic_toleranceLimitLower')) {
let lowerValue = null; let lowerValue = null;
...@@ -147,7 +159,7 @@ export class DCCConformity { ...@@ -147,7 +159,7 @@ export class DCCConformity {
lowerUnit = unit.toHTML({ oneLine: true }); lowerUnit = unit.toHTML({ oneLine: true });
} }
} }
return { value: lowerValue, unit: lowerUnit, name: this.getQuantityName(q) }; return { value: lowerValue, unit: lowerUnit, name: this._getTolerance(q, this.language) };
} }
} }
} }
...@@ -158,7 +170,7 @@ export class DCCConformity { ...@@ -158,7 +170,7 @@ export class DCCConformity {
const data = this.metaDataJson['dcc:data']; const data = this.metaDataJson['dcc:data'];
if (data && data['dcc:quantity']) { if (data && data['dcc:quantity']) {
let quantities = data['dcc:quantity']; let quantities = data['dcc:quantity'];
if (!Array.isArray(quantities)) quantities = [quantities]; if (!Array.isArray(quantities)) { quantities = [quantities]; }
for (let q of quantities) { for (let q of quantities) {
if (q.$ && q.$.refType && q.$.refType.includes('basic_toleranceLimitUpper')) { if (q.$ && q.$.refType && q.$.refType.includes('basic_toleranceLimitUpper')) {
let upperValue = null; let upperValue = null;
...@@ -174,22 +186,10 @@ export class DCCConformity { ...@@ -174,22 +186,10 @@ export class DCCConformity {
upperUnit = unit.toHTML({ oneLine: true }); upperUnit = unit.toHTML({ oneLine: true });
} }
} }
return { value: upperValue, unit: upperUnit, name: this.getQuantityName(q) }; return { value: upperValue, unit: upperUnit, name: this._getTolerance(q, this.language) };
} }
} }
} }
return null; return null;
} }
getQuantityName(q) {
if (q['dcc:name'] && q['dcc:name']['dcc:content']) {
let content = q['dcc:name']['dcc:content'];
if (Array.isArray(content)) {
const match = content.find(item => item.$ && item.$.lang === this.language) || content[0];
return match._ || match;
}
return content._ || content;
}
return '';
}
} }
...@@ -343,6 +343,14 @@ export function renderMeasurementResults(measurementResults, language) { ...@@ -343,6 +343,14 @@ export function renderMeasurementResults(measurementResults, language) {
tickfont: { family: 'Arial', size: 14, color: 'black' }, tickfont: { family: 'Arial', size: 14, color: 'black' },
type: logY ? 'log' : 'linear' type: logY ? 'log' : 'linear'
}, },
// Place legend on top over the plot without shifting x-axis scaling.
legend: {
orientation: 'h',
x: 0.5,
y: 0.98,
xanchor: 'center',
yanchor: 'top'
},
hovermode: 'closest', hovermode: 'closest',
margin: { t: 20, b: 40 } margin: { t: 20, b: 40 }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment