Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dccviewer-js
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Benedikt
dccviewer-js
Commits
c05e9786
Commit
c05e9786
authored
1 month ago
by
Benedikt
Browse files
Options
Downloads
Patches
Plain Diff
added conformity limts that are shown on demand
parent
e61460bd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
data/sin_acceleration_example_dcc_WithExampleConformatyStatment.xml
+2
-2
2 additions, 2 deletions
...cceleration_example_dcc_WithExampleConformatyStatment.xml
src/renderers/MeasurementRenderer.js
+72
-34
72 additions, 34 deletions
src/renderers/MeasurementRenderer.js
with
74 additions
and
36 deletions
data/sin_acceleration_example_dcc_WithExampleConformatyStatment.xml
+
2
−
2
View file @
c05e9786
...
...
@@ -659,8 +659,8 @@ Entsprechend ISO 2041 ist die Phasenverschiebung definiert zu Δφqa = φq - φa
<dcc:metaData
refType=
"basic_conformity"
>
<dcc:convention>
customer
</dcc:convention>
<dcc:conformityXMLList>
pass pass pass pass pass pass pass pass pass pass pass
pass pass pass pass pass pass pass pass pass pass pass
fail fail fail fail
fail fail
fail fail fail
</dcc:conformityXMLList>
pass pass pass pass pass pass pass pass pass pass pass
pass pass pass pass
pass pass
fail fail fail
</dcc:conformityXMLList>
<dcc:data>
<dcc:quantity
refType=
"basic_toleranceLimitLower"
>
<dcc:name>
...
...
This diff is collapsed.
Click to expand it.
src/renderers/MeasurementRenderer.js
+
72
−
34
View file @
c05e9786
import
Plotly
from
'
plotly.js-dist
'
;
import
{
DCCRealListQuantity
}
from
'
../dccQuantity.js
'
;
import
{
DCCRealListQuantity
,
DCCConformity
}
from
'
../dccQuantity.js
'
;
const
palette
=
[
'
#1f77b4
'
,
...
...
@@ -67,9 +67,7 @@ export function renderMeasurementResults(measurementResults, language) {
if
(
Array
.
isArray
(
content
))
{
const
match
=
content
.
find
(
item
=>
item
.
$
&&
item
.
$
.
lang
===
language
)
||
content
[
0
];
resultName
=
match
.
_
||
match
;
}
else
{
resultName
=
content
.
_
||
content
;
}
}
else
{
resultName
=
content
.
_
||
content
;
}
}
const
tabTitle
=
document
.
createElement
(
'
h2
'
);
tabTitle
.
textContent
=
resultName
;
...
...
@@ -101,6 +99,7 @@ export function renderMeasurementResults(measurementResults, language) {
const
indexQuantities
=
[];
const
dataQuantities
=
[];
// extraInfo stores { uncertainty, conformity } for each data quantity.
const
extraInfo
=
[];
quantityJSONs
.
forEach
(
q
=>
{
if
(
q
.
$
&&
q
.
$
.
refType
&&
q
.
$
.
refType
.
match
(
/basic_tableIndex/
))
{
...
...
@@ -109,31 +108,16 @@ export function renderMeasurementResults(measurementResults, language) {
const
quantity
=
new
DCCRealListQuantity
(
q
);
dataQuantities
.
push
(
quantity
);
let
uncertainty
=
quantity
.
getUncertainty
();
let
comment
=
''
;
let
conformity
=
null
;
if
(
q
[
'
dcc:measurementMetaData
'
]
&&
q
[
'
dcc:measurementMetaData
'
][
'
dcc:metaData
'
])
{
let
md
=
q
[
'
dcc:measurementMetaData
'
][
'
dcc:metaData
'
];
if
(
!
Array
.
isArray
(
md
))
{
md
=
[
md
];
}
md
.
forEach
(
item
=>
{
if
(
item
.
$
&&
item
.
$
.
refType
&&
item
.
$
.
refType
.
includes
(
'
basic_tableRowComment
'
))
{
if
(
item
[
'
dcc:description
'
]
&&
item
[
'
dcc:description
'
][
'
dcc:content
'
])
{
let
desc
=
item
[
'
dcc:description
'
][
'
dcc:content
'
];
if
(
Array
.
isArray
(
desc
))
{
const
match
=
desc
.
find
(
d
=>
d
.
$
&&
d
.
$
.
lang
===
language
)
||
desc
[
0
];
comment
=
match
.
_
||
match
;
}
else
{
comment
=
desc
.
_
||
desc
;
}
}
}
if
(
item
.
$
&&
item
.
$
.
refType
&&
item
.
$
.
refType
.
includes
(
'
basic_conformity
'
))
{
if
(
item
[
'
dcc:conformityXMLList
'
])
{
conformity
=
item
[
'
dcc:conformityXMLList
'
].
trim
().
split
(
/
\s
+/
);
}
}
});
const
confMeta
=
md
.
find
(
item
=>
item
.
$
&&
item
.
$
.
refType
&&
item
.
$
.
refType
.
includes
(
'
basic_conformity
'
));
if
(
confMeta
)
{
conformity
=
new
DCCConformity
(
confMeta
,
language
);
}
}
extraInfo
.
push
({
uncertainty
,
comment
,
conformity
});
extraInfo
.
push
({
uncertainty
,
conformity
});
}
});
...
...
@@ -146,6 +130,7 @@ export function renderMeasurementResults(measurementResults, language) {
return
header
;
});
// Create scaling toggles for log axes.
const
scalingContainer
=
document
.
createElement
(
'
div
'
);
scalingContainer
.
innerHTML
=
'
<strong>Scaling:</strong>
'
;
const
logXToggle
=
document
.
createElement
(
'
input
'
);
...
...
@@ -222,7 +207,7 @@ export function renderMeasurementResults(measurementResults, language) {
if
(
info
.
conformity
)
{
headers
.
push
(
'
Conformity
'
);
}
dataValues
.
push
(
dataQuantities
[
idx
].
getValues
());
uncertaintiesArray
.
push
(
info
.
uncertainty
||
[]);
conformityArray
.
push
(
info
.
conformity
||
[]);
conformityArray
.
push
(
info
.
conformity
?
info
.
conformity
.
getConformityValues
()
:
[]);
});
headers
.
push
(
'
Comments
'
);
...
...
@@ -237,11 +222,10 @@ export function renderMeasurementResults(measurementResults, language) {
}
row
.
push
(
cellValue
);
if
(
info
.
conformity
)
{
row
.
push
(
info
.
conformity
[
i
]
||
''
);
row
.
push
(
conformity
Array
[
idx
]
[
i
]
||
''
);
}
});
// Comments column remains uncolored
row
.
push
(
extraInfo
.
map
(
info
=>
info
.
comment
).
filter
(
c
=>
c
).
join
(
'
;
'
));
row
.
push
(
extraInfo
.
map
(
info
=>
info
.
comment
||
''
).
filter
(
c
=>
c
).
join
(
'
;
'
));
tableData
.
push
(
row
);
}
renderTable
(
tableData
,
headers
);
...
...
@@ -321,8 +305,64 @@ export function renderMeasurementResults(measurementResults, language) {
type
:
logY
?
'
log
'
:
'
linear
'
},
hovermode
:
'
closest
'
,
margin
:
{
t
:
20
,
b
:
40
}
margin
:
{
t
:
20
,
b
:
40
},
shapes
:
[],
annotations
:
[]
};
// Tolerance markings from conformity limits, if enabled.
if
(
document
.
getElementById
(
'
toleranceToggle
'
).
checked
)
{
group
.
forEach
(
trace
=>
{
const
confObj
=
extraInfo
[
trace
.
index
].
conformity
;
if
(
confObj
)
{
const
lower
=
extraInfo
[
trace
.
index
].
conformity
.
getLowerLimit
();
const
upper
=
extraInfo
[
trace
.
index
].
conformity
.
getUpperLimit
();
if
(
lower
&&
typeof
lower
.
value
===
'
number
'
)
{
layout
.
shapes
.
push
({
type
:
'
line
'
,
x0
:
Math
.
min
(...
xValues
),
x1
:
Math
.
max
(...
xValues
),
y0
:
lower
.
value
,
y1
:
lower
.
value
,
line
:
{
color
:
'
#d62728
'
,
width
:
2
,
dash
:
'
dash
'
},
xref
:
'
x
'
,
yref
:
'
y
'
});
layout
.
annotations
.
push
({
x
:
Math
.
min
(...
xValues
),
y
:
lower
.
value
,
xref
:
'
x
'
,
yref
:
'
y
'
,
text
:
lower
.
name
,
showarrow
:
false
,
font
:
{
color
:
'
#d62728
'
,
size
:
12
}
});
}
if
(
upper
&&
typeof
upper
.
value
===
'
number
'
)
{
layout
.
shapes
.
push
({
type
:
'
line
'
,
x0
:
Math
.
min
(...
xValues
),
x1
:
Math
.
max
(...
xValues
),
y0
:
upper
.
value
,
y1
:
upper
.
value
,
line
:
{
color
:
'
#d62728
'
,
width
:
2
,
dash
:
'
dash
'
},
xref
:
'
x
'
,
yref
:
'
y
'
});
layout
.
annotations
.
push
({
x
:
Math
.
min
(...
xValues
),
y
:
upper
.
value
,
xref
:
'
x
'
,
yref
:
'
y
'
,
text
:
upper
.
name
,
showarrow
:
false
,
font
:
{
color
:
'
#d62728
'
,
size
:
12
}
});
}
}
});
}
Plotly
.
newPlot
(
graphDiv
,
groupTraces
,
layout
).
then
(()
=>
{
const
caption
=
document
.
createElement
(
'
div
'
);
caption
.
innerHTML
=
'
<b>
'
+
group
[
0
].
name
+
'
</b>
'
;
...
...
@@ -336,9 +376,7 @@ export function renderMeasurementResults(measurementResults, language) {
highlightTableRow
(
pointIndex
);
}
});
graphDiv
.
on
(
'
plotly_unhover
'
,
function
()
{
clearTableRowHighlights
();
});
graphDiv
.
on
(
'
plotly_unhover
'
,
function
()
{
clearTableRowHighlights
();
});
graphDiv
.
on
(
'
plotly_relayout
'
,
function
(
eventData
)
{
plotDivs
.
forEach
(
div
=>
{
if
(
div
!==
graphDiv
&&
eventData
[
'
xaxis.range[0]
'
]
&&
eventData
[
'
xaxis.range[1]
'
])
{
...
...
@@ -349,7 +387,7 @@ export function renderMeasurementResults(measurementResults, language) {
});
}
function
renderTable
(
tableData
,
header
s
)
{
function
renderTable
(
tableData
,
header
Data
)
{
const
tableContainer
=
document
.
getElementById
(
'
tableContainer
'
);
tableContainer
.
innerHTML
=
''
;
const
table
=
document
.
createElement
(
'
table
'
);
...
...
@@ -392,5 +430,5 @@ export function renderMeasurementResults(measurementResults, language) {
radios
.
forEach
(
radio
=>
{
radio
.
addEventListener
(
'
change
'
,
updateVisualization
);
});
document
.
getElementById
(
'
logXToggle
'
).
addEventListener
(
'
change
'
,
updateVisualization
);
document
.
getElementById
(
'
logYToggle
'
).
addEventListener
(
'
change
'
,
updateVisualization
);
toleranceToggle
.
addEventListener
(
'
change
'
,
()
=>
{
console
.
log
(
'
Tolerance toggle:
'
,
toleranceToggle
.
checked
);
});
toleranceToggle
.
addEventListener
(
'
change
'
,
()
=>
{
console
.
log
(
'
Tolerance toggle:
'
,
toleranceToggle
.
checked
);
updateVisualization
();
});
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment