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

Skip to content

Commit d77e39e

Browse files
author
Joseph Damiba
authored
Merge pull request #1668 from plotly/update-modebar
update modebar docs
2 parents 3b8c0d1 + 3b876d7 commit d77e39e

17 files changed

+118
-76
lines changed

_posts/plotly_js/fundamentals/config-options/2015-09-24-config-locale.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
name: Change the Default Locale
3-
plot_url: https://codepen.io/plotly/embed/rqrgEQ/?height=600&theme-id=15263&default-tab=result
43
language: plotly_js
54
suite: configuration
65
order: 7.5
@@ -36,5 +35,4 @@
3635

3736
var config = {locale: 'fr'};
3837

39-
Plotly.newPlot('myDiv', data, layout, config);
40-
38+
Plotly.newPlot('myDiv', data, layout, config);

_posts/plotly_js/fundamentals/config-options/2015-09-24-config-opt-display-modebar.html

Lines changed: 0 additions & 24 deletions
This file was deleted.

_posts/plotly_js/fundamentals/config-options/2015-09-24-config-opt-displaylogo.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
name: Hide the Plotly Logo on the Modebar
3-
plot_url: https://codepen.io/plotly/embed/EVgeWb/?height=450&theme-id=15263&default-tab=result
43
language: plotly_js
54
suite: configuration
65
order: 8

_posts/plotly_js/fundamentals/config-options/2015-09-24-config-opt-hide-modebar.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
---
2-
name: Hide the Modebar
3-
plot_url: https://codepen.io/plotly/embed/YyGOLg/?height=450&theme-id=15263&default-tab=result
2+
name: Never Display The Modebar
43
language: plotly_js
54
suite: configuration
65
order: 5
76
sitemap: false
87
arrangement: horizontal
8+
markdown_content: |
9+
When users hover over a figure generated with `plotly.js`, a `modebar` appears in the top-right of the figure. This presents users with several options for interacting with the figure.
10+
11+
By default, the `modebar` is only visible while the user is hovering over the chart. If you would like the `modebar` to never be visible, then set the `displayModeBar` attribute in the `config` of your figure to `false`.
912
---
1013
var trace1 = {
1114
x:['Zebras', 'Lions', 'Pelicans'],
Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
---
2-
name: Modify the "Edit Chart" Link Text
3-
plot_url: https://codepen.io/plotly/embed/WQGgbe/?height=600&theme-id=15263&default-tab=result
2+
name: Customize The `Edit Chart` Link Text
43
language: plotly_js
54
suite: configuration
65
order: 7
76
sitemap: false
87
arrangement: horizontal
98
---
10-
var trace1 = {
11-
z: [[0, 1, 2, 3, 4, 5, 6], [1, 9, 4, 7, 5, 2, 4], [2, 4, 2, 1, 6, 9, 3]],
12-
type: 'heatmap'
13-
};
9+
var data = [{
10+
z: [[0, 1, 2, 3, 4, 5, 6],
11+
[1, 9, 4, 7, 5, 2, 4],
12+
[2, 4, 2, 1, 6, 9, 3]],
13+
type: 'heatmap'}]
1414

15-
var data = [trace1];
16-
17-
var layout = {
18-
title: 'Change the Link Text'
19-
};
20-
21-
Plotly.newPlot('myDiv', data, layout, {linkText: 'Change this text'});
15+
var layout = {title: 'Customize The Edit Chart Link Text'}
16+
Plotly.newPlot('myDiv', data, layout, {showLink: true, linkText: 'This text is custom!'})

_posts/plotly_js/fundamentals/config-options/2015-09-24-config-opt-scrollzoom.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
name: Scroll and Zoom
3-
plot_url: https://codepen.io/plotly/embed/QjKZbg/?height=450&theme-id=15263&default-tab=result
43
language: plotly_js
54
suite: configuration
65
order: 1

_posts/plotly_js/fundamentals/config-options/2015-09-24-config-opt-showlink.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
2-
name: Display the "Edit Chart" Link
3-
plot_url: https://codepen.io/plotly/embed/epdjem/?height=600&theme-id=15263&default-tab=result
2+
name: Display the `Edit Chart` Link
43
language: plotly_js
54
suite: configuration
65
order: 6
@@ -18,7 +17,9 @@
1817
};
1918

2019
var data = [trace1];
20+
2121
var layout = {
2222
title: 'Display the Edit Chart Link'
2323
};
24+
2425
Plotly.newPlot('myDiv', data, layout, {showLink: true});

_posts/plotly_js/fundamentals/config-options/2015-09-24-config-opt-static-plot.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
name: Making a Static Chart
3-
plot_url: https://codepen.io/plotly/embed/YyGjda/?height=450&theme-id=15263&default-tab=result
43
language: plotly_js
54
suite: configuration
65
order: 3

_posts/plotly_js/fundamentals/config-options/2015-09-24-config-opt-toImageButtonOptions.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
name: Customize Download Plot Options
3-
plot_url: https://codepen.io/plotly/embed/MZjYRB/?height=450&theme-id=15263&default-tab=result
43
language: plotly_js
54
suite: configuration
65
order: 3.1

_posts/plotly_js/fundamentals/config-options/2015-09-24-config-showSendToCloud.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
name: Display Edit in Chart Studio Button
3-
plot_url: https://codepen.io/plotly/embed/aPpzzw/?height=600&theme-id=15263&default-tab=result
43
language: plotly_js
54
suite: configuration
65
order: 7.1

_posts/plotly_js/fundamentals/config-options/2015-09-24-config_options_index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
thumbnail: thumbnail/modebar-icons.png
99
display_as: reference
1010
---
11+
<script src="https://cdn.plot.ly/plotly-locale-fr-latest.js"></script>
1112

1213
The plotly.js <code>config</code> argument sets properties like the mode bar buttons and the interactivity in the chart.
1314
It's the last argument in <code>Plotly.newPlot</code> and <code>Plotly.newPlot</code> calls.

_posts/plotly_js/fundamentals/config-options/2017-03-01-edit_mode.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
---
2-
name: Edit Mode
3-
plot_url: https://codepen.io/plotly/embed/VpeMKo/?height=450&theme-id=15263&default-tab=result
2+
name: Editable Mode
43
language: plotly_js
54
suite: configuration
65
order: 2
76
sitemap: false
87
arrangement: horizontal
8+
markdown_content: |
9+
In editable mode, users can edit the chart title, axis labels and trace names in the legend.
910
---
1011
var trace1 = {
1112
x: [0, 1, 2, 3, 4],
@@ -22,7 +23,6 @@
2223
};
2324

2425
var data = [trace1, trace2];
25-
var layout = {
26-
title: 'Click Here<br>to Edit Chart Title'};
26+
var layout = {title: 'Click Here<br>to Edit Chart Title'};
2727

2828
Plotly.newPlot('myDiv', data, layout, {editable: true});

_posts/plotly_js/fundamentals/config-options/2018-02-04-config-opt-modebarButtons.html

Lines changed: 0 additions & 21 deletions
This file was deleted.

_posts/plotly_js/fundamentals/config-options/2018-09-12-config-opt-responsive.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
name: Making a Responsive Chart
3-
plot_url: https://codepen.io/plotly/embed/BOxMXz/?height=550&theme-id=15263&default-tab=result
43
language: plotly_js
54
suite: configuration
65
order: 10
@@ -22,7 +21,7 @@
2221
var data = [ trace1 ];
2322

2423
var layout = {
25-
title: 'Responsive to window's size!',
24+
title: 'Responsive to window size!',
2625
font: {size: 18}
2726
};
2827

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
name: Add Buttons to ModeBar
3+
language: plotly_js
4+
suite: configuration
5+
order: 5.7
6+
sitemap: false
7+
arrangement: horizontal
8+
markdown_content: |
9+
The following example shows how to add a button to your modebar, either by using one of the [Plotly icons](https://github.com/plotly/plotly.js/blob/master/src/fonts/ploticon.js) or an [arbitrary icon](https://fontawesome.com/icons?d=gallery&m=free) with a custom behaviour.
10+
---
11+
var icon1 = {
12+
'width': 500,
13+
'height': 600,
14+
'path': 'M224 512c35.32 0 63.97-28.65 63.97-64H160.03c0 35.35 28.65 64 63.97 64zm215.39-149.71c-19.32-20.76-55.47-51.99-55.47-154.29 0-77.7-54.48-139.9-127.94-155.16V32c0-17.67-14.32-32-31.98-32s-31.98 14.33-31.98 32v20.84C118.56 68.1 64.08 130.3 64.08 208c0 102.3-36.15 133.53-55.47 154.29-6 6.45-8.66 14.16-8.61 21.71.11 16.4 12.98 32 32.1 32h383.8c19.12 0 32-15.6 32.1-32 .05-7.55-2.61-15.27-8.61-21.71z'
15+
}
16+
17+
var colors = ['green', 'red', 'blue']
18+
var data = [{
19+
mode: 'lines',
20+
y: [2, 1, 2],
21+
line: {color: colors[0], width: 3, shape: 'spline'}
22+
}]
23+
24+
var layout = {
25+
title: 'add mode bar button with custom icon',
26+
modebardisplay: false}
27+
28+
var config = {
29+
modeBarButtonsToAdd: [
30+
{
31+
name: 'color toggler',
32+
icon: icon1,
33+
click: function(gd) {
34+
var newColor = colors[Math.floor(3 * Math.random())]
35+
Plotly.restyle(gd, 'line.color', newColor)
36+
}},
37+
{
38+
name: 'button1',
39+
icon: Plotly.Icons.pencil,
40+
direction: 'up',
41+
click: function(gd) {alert('button1')
42+
}}],
43+
modeBarButtonsToRemove: ['pan2d','select2d','lasso2d','resetScale2d','zoomOut2d']}
44+
45+
Plotly.newPlot('myDiv', data, layout, config)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Force The Modebar to Always Be Visible
3+
language: plotly_js
4+
suite: configuration
5+
order: 4
6+
sitemap: false
7+
arrangement: horizontal
8+
markdown_content: |
9+
When users hover over a figure generated with `plotly.js`, a `modebar` appears in the top-right of the figure. This presents users with several options for interacting with the figure.
10+
11+
By default, the `modebar` is only visible while the user is hovering over the chart. If you would like the `modebar` to always be visible regardless of whether or not the user is currently hovering over the figure, set the `displayModeBar` attribute in the `config` of your figure to `true`.
12+
---
13+
var data = [{
14+
y:['Marc', 'Henrietta', 'Jean', 'Claude', 'Jeffrey', 'Jonathan', 'Jennifer', 'Zacharias'],
15+
x: [90, 40, 60, 80, 75, 92, 87, 73],
16+
type: 'bar',
17+
orientation: 'h'}]
18+
19+
var layout = {
20+
title: 'Always Display the Modebar',
21+
showlegend: false}
22+
23+
Plotly.newPlot('myDiv', data, layout, {displayModeBar: true})
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Remove ModeBar Buttons
3+
language: plotly_js
4+
suite: configuration
5+
order: 5.5
6+
sitemap: false
7+
arrangement: horizontal
8+
markdown_content: |
9+
To delete buttons from the modebar, pass an array of strings containing the names of the buttons you want to remove to the `modeBarButtonsToRemove` attribute in the figure's configuration object. Note that different chart types have different default modebars. The following is a list of all the modebar buttons and the chart types they are associated with:
10+
<ul>
11+
<li> -'2D', `zoom2d`, `pan2d`, `select2d`, `lasso2d`, `zoomIn2d`, `zoomOut2d`, `autoScale2d`, `resetScale2d` </li>
12+
<li> -'3D', `zoom3d`, `pan3d`, `orbitRotation`, `tableRotation`, `handleDrag3d`, `resetCameraDefault3d`, `resetCameraLastSave3d`, `hoverClosest3d` </li>
13+
<li> -'Cartesian', `hoverClosestCartesian`, `hoverCompareCartesian` </li>
14+
<li> -'Geo', `zoomInGeo`, `zoomOutGeo`, `resetGeo`, `hoverClosestGeo` </li>
15+
<li> -'Other', `hoverClosestGl2d`, `hoverClosestPie`, `toggleHover`, `resetViews`, `toImage`, `sendDataToCloud`, `toggleSpikelines`, `resetViewMapbox` </li>
16+
</ul>
17+
---
18+
var data = [{
19+
x:['trees', 'flowers', 'hedges'],
20+
y: [90, 130, 40],
21+
type: 'bar'}]
22+
23+
var layout = {
24+
title: 'Remove Modebar Buttons',
25+
showlegend: false}
26+
27+
Plotly.newPlot('myDiv', data, layout, {modeBarButtonsToRemove: ['toImage']})

0 commit comments

Comments
 (0)