Skip to content

Commit 09f0115

Browse files
authored
Merge pull request #1020 from plotly/JS-text-webGL-doc-update
Created JS doc for WebGL text example
2 parents 3745303 + 6a43394 commit 09f0115

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
name: WebGL Text and Annotations
3+
plot_url: https://codepen.io/plotly/embed/PBVYeY/?height=400&theme-id=15263&default-tab=result
4+
language: plotly_js
5+
suite: annotations
6+
order: 8
7+
sitemap: false
8+
arrangement: horizontal
9+
---
10+
11+
var n = 250;
12+
var t = 12;
13+
var x = [];
14+
var y = [];
15+
var z = [];
16+
var text = [];
17+
var arr = ["A","T","G", "C"];
18+
19+
for (var j = 0; j < t; j++){
20+
ztemp = [];
21+
for (var i = 0; i < n; i++) {
22+
x.push(i);
23+
y.push(j);
24+
ztemp.push(Math.floor(Math.random() * 10));
25+
text.push(arr[Math.floor(Math.random() * 4)])
26+
}
27+
z.push(ztemp)
28+
}
29+
30+
var steps = [];
31+
for (var e = 0; e < n-30; e++){
32+
steps.push({
33+
label: e,
34+
value: e,
35+
method: 'relayout',
36+
args: ['xaxis', {range: [-0.5 + e, 30.5 + e]}]
37+
})
38+
}
39+
40+
data1 = {
41+
x: x,
42+
y: y,
43+
mode: "text",
44+
text: text,
45+
type: "scattergl",
46+
textfont: {
47+
size: 20
48+
}
49+
}
50+
51+
data2 = {
52+
z: z,
53+
type: "heatmap"
54+
}
55+
56+
sliders = [{
57+
active: 0,
58+
steps: steps
59+
}]
60+
61+
layout = {
62+
sliders: sliders,
63+
xaxis: {
64+
range: [-0.5, 30.5],
65+
showline: false,
66+
zeroline: false,
67+
showgrid: false
68+
},
69+
yaxis: {
70+
showline: false,
71+
zeroline: false,
72+
showgrid: false
73+
}
74+
}
75+
76+
data = [data1, data2]
77+
Plotly.plot('graph', {data:data,
78+
layout:layout});

0 commit comments

Comments
 (0)