This repository was archived by the owner on Mar 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariable_width.html
More file actions
104 lines (88 loc) · 2.32 KB
/
Copy pathvariable_width.html
File metadata and controls
104 lines (88 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Scatterplot Test</title>
<link rel="stylesheet" type="text/css" href="scatterplot.css" />
<style>
.datavisyn-scatterplot {
height: 500px;
width: 1058px;
}
.datavisyn-scatterplot.active {
width: 558px;
}
#root {
flex: 1 1 100vw;
}
#sidebar {
flex: 0 0 0;
}
#sidebar.active {
flex: 1 1 50vw;
}
</style>
</head>
<body>
<h1>
Scatterplot variable width test
</h1>
<label>Number of Points:
<input type="number" step="1000" value="10000">
</label>
<section>
<button id="toggle-sidebar">Toggle Sidebar</button>
<div id="wrapper">
<div id="root"></div>
<div id="sidebar">this is a sidebar</div>
</div>
</section>
<section>
<pre>
Notes:
* drag/zoom as usual
* tooltip after a while
* lasso selection using ctrl/alt key
* single selection should work
* debug output with rendering information
* build with Typescript + Webpack2
</pre>
</section>
<script src="scatterplot.js"></script>
<script>
(function () {
let s;
function rebuild(count) {
var data = [];
console.time('gen');
for (var i = 0; i < count; ++i) {
//data.push({x: 100*i/count, y: 100*(count-i)/count});
data.push({x: Math.random()*100, y: Math.random()*100});
}
console.timeEnd('gen');
var div = document.querySelector('#root');
div.innerHTML = ''; //clear existing stuff
s = new datavisyn.scatterplot.Scatterplot(data, div, { xlim: [0,100], ylim: [0,100], scale: 0});
//var m = new datavisyn.scatterplot.MiniMap(s, document.querySelector('#minimap'));
s.render();
s.window = {xMinMax: [75, 100], yMinMax: [0, 100]};
s.render();
s.on('windowChanged', (window) => console.log(window));
}
document.querySelector('input').onchange = function() {
rebuild(+this.value);
};
rebuild(10000);
const button = document.querySelector('#toggle-sidebar');
button.addEventListener('click', () => {
document.querySelector('.datavisyn-scatterplot').classList.toggle('active');
s.render();
});
})();
//React.render(
// <MyComponent>Body</MyComponent>,
// body
//);
</script>
</body>
</html>