add graph

This commit is contained in:
gabrielkheisa 2022-11-16 14:30:12 +07:00
parent c958df8633
commit 56a6402beb

52
graph.html Normal file
View File

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script>
<body>
<canvas id="myChart" style="width:100%;max-width:600px"></canvas>
<script>
var xValues = [1,2,4,8,16,32,64];
var data = [227.454, 115.605, 60.774, 30.498, 26.556, 24.960, 24.707];
var d_data = [];
var i = 1;
while(i < data.length){
d_data[i] = data[i+1] - data[i];
i++;
}
/*
1 Thread: 227.454 sec
2 Thread: 115.605 sec
4 Thread: 60.744 sec
8 Thread: 30.498 sec
16 Thread: 26.556 sec
32 Thread: 24.960 sec
64 Thread: 24.707 sec
*/
new Chart("myChart", {
type: "line",
data: {
labels: xValues,
datasets: [{
data: data,
borderColor: "black",
fill: false
}, {
data: d_data,
borderColor: "green",
fill: false
}, {
data: [300,700,2000,5000,6000,4000,2000,1000,200,100],
borderColor: "blue",
fill: false
}]
},
options: {
legend: {display: false}
}
});
</script>