Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 052c96e

Browse files
committed
add javascript documentation for 3D hover options
1 parent 63cc683 commit 052c96e

File tree

3 files changed

+115
-0
lines changed

3 files changed

+115
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
name: Customize Hover for Spikelines
3+
plot_url: https://codepen.io/plotly/embed/NOgjrR/?height=500&theme-id=15263&default-tab=result
4+
language: plotly_js
5+
suite: 3d-hover
6+
order: 1
7+
sitemap: false
8+
arrangement: horizontal
9+
markdown_content: |
10+
By default, Plotly's 3D plots display lines called "spikelines" while hovering over a point.
11+
These lines project from the hover point to each of the three axes' normal planes and
12+
then extend from those projection data points to the planes' wall boundaries.
13+
---
14+
15+
function getrandom(num , mul)
16+
{
17+
var value = [ ];
18+
for(i=0;i<=num;i++)
19+
{
20+
var rand = Math.random() * mul;
21+
value.push(rand);
22+
}
23+
return value;
24+
}
25+
26+
27+
var data=[
28+
{
29+
opacity:0.4,
30+
type: 'scatter3d',
31+
x: getrandom(50 , -75),
32+
y: getrandom(50 , -75),
33+
z: getrandom(50 , -75),
34+
},
35+
];
36+
var layout = {
37+
scene:{
38+
xaxis: {
39+
spikecolor: '#1fe5bd',
40+
spikesides: false,
41+
spikethickness: 6
42+
},
43+
yaxis: {
44+
spikecolor: '#1fe5bd',
45+
spikesides: false,
46+
spikethickness: 6
47+
},
48+
zaxis: {
49+
spikecolor: '#1fe5bd',
50+
spikethickness: 6
51+
}
52+
},
53+
};
54+
Plotly.newPlot('myDiv', data, layout);
55+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: Customize Hover for Surface Contours
3+
plot_url: https://codepen.io/plotly/embed/qJjmbQ/?height=500&theme-id=15263&default-tab=result
4+
language: plotly_js
5+
suite: 3d-hover
6+
order: 2
7+
sitemap: false
8+
arrangement: horizontal
9+
markdown_content: |
10+
In addition to spikelines, Plotly 3D Surface plots also display surface contours on hover by default.
11+
These are customized by styling the [`contours`](https://plot.ly/javascript/reference/#surface-contours)
12+
attribute in the surface trace.
13+
---
14+
15+
x = [10,20,30,40]
16+
y = [0,1,2,3]
17+
z = [
18+
[2,2,2,3],
19+
[1,1,1,1],
20+
[1,1,0,0],
21+
[0,0,0,0]
22+
];
23+
24+
var data=[
25+
{
26+
opacity:0.9,
27+
type: 'surface',
28+
x:x, y:y, z:z,
29+
contours: {
30+
x: {
31+
highlight: true,
32+
highlightcolor: "#41a7b3"
33+
},
34+
y: { highlight: false },
35+
z: { highlight: false}
36+
}
37+
},
38+
];
39+
var layout = {
40+
scene:{
41+
xaxis: { showspikes: false },
42+
yaxis: { showspikes: false },
43+
zaxis: { showspikes: false }
44+
},
45+
};
46+
Plotly.newPlot('myDiv', data, layout);
47+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Javascript Graphing Library D3.js-based Charts with 3d Hover Options | Examples | Plotly
3+
name: 3D Hover Options
4+
permalink: javascript/3d-hover/
5+
description: How to customize hover options for 3d charts.
6+
layout: base
7+
language: plotly_js
8+
page_type: example_index
9+
has_thumbnail: false
10+
display_as: layout_opt
11+
---
12+
{% assign examples = site.posts | where:"language","plotly_js" | where:"suite","3d-hover" | sort: "order" %}
13+
{% include auto_examples.html examples=examples %}

0 commit comments

Comments
 (0)