Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
iCityDigitalTwinFramework
HFT Digital Twin
Commits
9c562202
Commit
9c562202
authored
Jul 11, 2024
by
Rushikesh Padsala
Browse files
testing data from good vibration project results
parent
4b02a2c1
Pipeline
#9799
passed with stages
in 51 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
public/GoodVibrationTest.html
0 → 100644
View file @
9c562202
<!DOCTYPE html>
<html>
<head>
<title>
Frequency vs Vibration Chart
</title>
<script
src=
"https://cdn.jsdelivr.net/npm/chart.js"
></script>
</head>
<body>
<canvas
id=
"frequencyVibrationChart"
width=
"800"
height=
"400"
></canvas>
<script>
// URL of the web service
const
dataUrl
=
'
https://w2.iaf-ex.hft-stuttgart.de/HFT/frequency_vibration_data.json
'
;
// Function to fetch data from the web service
async
function
fetchData
()
{
try
{
const
response
=
await
fetch
(
dataUrl
);
const
jsonData
=
await
response
.
json
();
return
jsonData
.
data
;
}
catch
(
error
)
{
console
.
error
(
'
Error fetching data:
'
,
error
);
return
[];
}
}
// Function to create the chart
async
function
createChart
()
{
const
data
=
await
fetchData
();
const
frequencies
=
data
.
map
(
item
=>
item
.
Frequenzen
);
const
vibrationTimes
=
data
.
map
(
item
=>
item
.
Nachhallzeit
);
const
chartData
=
{
labels
:
frequencies
,
datasets
:
[{
label
:
'
Vibration Time (Nachhallzeit)
'
,
data
:
vibrationTimes
,
borderColor
:
'
rgba(75, 192, 192, 1)
'
,
backgroundColor
:
'
rgba(75, 192, 192, 0.2)
'
,
fill
:
false
,
tension
:
0.1
}]
};
const
config
=
{
type
:
'
line
'
,
data
:
chartData
,
options
:
{
scales
:
{
x
:
{
title
:
{
display
:
true
,
text
:
'
Frequency (Hz)
'
}
},
y
:
{
title
:
{
display
:
true
,
text
:
'
Vibration Time (s)
'
}
}
}
}
};
const
myChart
=
new
Chart
(
document
.
getElementById
(
'
frequencyVibrationChart
'
),
config
);
}
// Call the function to create the chart
createChart
();
</script>
</body>
</html>
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment