Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit 9cf334f

Browse files
authored
Merge pull request #43 from plotly/plot-config
Adding plotly.js config arguments
2 parents f615cbe + 9a6a137 commit 9cf334f

File tree

5 files changed

+448
-5
lines changed

5 files changed

+448
-5
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,28 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [0.9.0] - 2017-07-28
6+
### Added
7+
- A `config` property of the `Graph` component that exposes the [plotly.js config properties](https://plot.ly/javascript/configuration-options/). Here's an example that hides 2 buttons and makes the elements in the graph "editable":
8+
```
9+
import dash
10+
import dash_core_components as dcc
11+
import dash_html_components as html
12+
13+
app = dash.Dash()
14+
15+
app.layout = html.Div([
16+
dcc.Graph(
17+
id='my-graph',
18+
figure={'data': [{'x': [1, 2, 3]}]},
19+
config={'editable': True, 'modeBarButtonsToRemove': ['pan2d', 'lasso2d']}
20+
)
21+
])
22+
23+
if __name__ == '__main__':
24+
app.run_server(debug=True)
25+
```
26+
527
## [0.8.0] - 2017-07-27
628
### Added
729
- A new `Textarea` component for displaying the simple Textarea HTML element. The content of the `Textarea` is controlled through the `value` property:

dash_core_components/metadata.json

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,212 @@
385385
"computed": false
386386
}
387387
},
388+
"config": {
389+
"type": {
390+
"name": "shape",
391+
"value": {
392+
"staticPlot": {
393+
"name": "bool",
394+
"description": "no interactivity, for export or image generation",
395+
"required": false
396+
},
397+
"editable": {
398+
"name": "bool",
399+
"description": "we can edit titles, move annotations, etc - sets all pieces of `edits`\nunless a separate `edits` config item overrides individual parts",
400+
"required": false
401+
},
402+
"edits": {
403+
"name": "shape",
404+
"value": {
405+
"annotationPosition": {
406+
"name": "bool",
407+
"description": "annotationPosition: the main anchor of the annotation, which is the\ntext (if no arrow) or the arrow (which drags the whole thing leaving\nthe arrow length & direction unchanged)",
408+
"required": false
409+
},
410+
"annotationTail": {
411+
"name": "bool",
412+
"description": "just for annotations with arrows, change the length and direction of the arrow",
413+
"required": false
414+
},
415+
"annotationText": {
416+
"name": "bool",
417+
"required": false
418+
},
419+
"axisTitleText": {
420+
"name": "bool",
421+
"required": false
422+
},
423+
"colorbarPosition": {
424+
"name": "bool",
425+
"required": false
426+
},
427+
"colorbarTitleText": {
428+
"name": "bool",
429+
"required": false
430+
},
431+
"legendPosition": {
432+
"name": "bool",
433+
"required": false
434+
},
435+
"legendText": {
436+
"name": "bool",
437+
"description": "edit the trace name fields from the legend",
438+
"required": false
439+
},
440+
"shapePosition": {
441+
"name": "bool",
442+
"required": false
443+
},
444+
"titleText": {
445+
"name": "bool",
446+
"description": "the global `layout.title`",
447+
"required": false
448+
}
449+
},
450+
"description": "a set of editable properties",
451+
"required": false
452+
},
453+
"autosizable": {
454+
"name": "bool",
455+
"description": "DO autosize once regardless of layout.autosize\n(use default width or height values otherwise)",
456+
"required": false
457+
},
458+
"queueLength": {
459+
"name": "number",
460+
"description": "set the length of the undo/redo queue",
461+
"required": false
462+
},
463+
"fillFrame": {
464+
"name": "bool",
465+
"description": "if we DO autosize, do we fill the container or the screen?",
466+
"required": false
467+
},
468+
"frameMargins": {
469+
"name": "number",
470+
"description": "if we DO autosize, set the frame margins in percents of plot size",
471+
"required": false
472+
},
473+
"scrollZoom": {
474+
"name": "bool",
475+
"description": "mousewheel or two-finger scroll zooms the plot",
476+
"required": false
477+
},
478+
"doubleClick": {
479+
"name": "enum",
480+
"value": [
481+
{
482+
"value": "false",
483+
"computed": false
484+
},
485+
{
486+
"value": "'reset'",
487+
"computed": false
488+
},
489+
{
490+
"value": "'autosize'",
491+
"computed": false
492+
},
493+
{
494+
"value": "'reset+autosize'",
495+
"computed": false
496+
}
497+
],
498+
"description": "double click interaction (false, 'reset', 'autosize' or 'reset+autosize')",
499+
"required": false
500+
},
501+
"showTips": {
502+
"name": "bool",
503+
"description": "new users see some hints about interactivity",
504+
"required": false
505+
},
506+
"showAxisDragHandles": {
507+
"name": "bool",
508+
"description": "enable axis pan/zoom drag handles",
509+
"required": false
510+
},
511+
"showAxisRangeEntryBoxes": {
512+
"name": "bool",
513+
"description": "enable direct range entry at the pan/zoom drag points\n(drag handles must be enabled above)",
514+
"required": false
515+
},
516+
"showLink": {
517+
"name": "bool",
518+
"description": "link to open this plot in plotly",
519+
"required": false
520+
},
521+
"sendData": {
522+
"name": "bool",
523+
"description": "if we show a link, does it contain data or just link to a plotly file?",
524+
"required": false
525+
},
526+
"linkText": {
527+
"name": "string",
528+
"description": "text appearing in the sendData link",
529+
"required": false
530+
},
531+
"displayModeBar": {
532+
"name": "enum",
533+
"value": [
534+
{
535+
"value": "true",
536+
"computed": false
537+
},
538+
{
539+
"value": "false",
540+
"computed": false
541+
},
542+
{
543+
"value": "'hover'",
544+
"computed": false
545+
}
546+
],
547+
"description": "display the mode bar (true, false, or 'hover')",
548+
"required": false
549+
},
550+
"modeBarButtonsToRemove": {
551+
"name": "array",
552+
"description": "remove mode bar button by name.\nAll modebar button names at https://github.com/plotly/plotly.js/blob/master/src/components/modebar/buttons.js\nCommon names include:\n - sendDataToCloud\n- (2D): zoom2d, pan2d, select2d, lasso2d, zoomIn2d, zoomOut2d, autoScale2d, resetScale2d\n- (Cartesian): hoverClosestCartesian, hoverCompareCartesian\n- (3D): zoom3d, pan3d, orbitRotation, tableRotation, handleDrag3d, resetCameraDefault3d, resetCameraLastSave3d, hoverClosest3d\n- (Geo): zoomInGeo, zoomOutGeo, resetGeo, hoverClosestGeo\n- hoverClosestGl2d, hoverClosestPie, toggleHover, resetViews",
553+
"required": false
554+
},
555+
"modeBarButtonsToAdd": {
556+
"name": "array",
557+
"description": "add mode bar button using config objects",
558+
"required": false
559+
},
560+
"modeBarButtons": {
561+
"name": "any",
562+
"description": "fully custom mode bar buttons as nested array,\nwhere the outer arrays represents button groups, and\nthe inner arrays have buttons config objects or names of default buttons",
563+
"required": false
564+
},
565+
"displaylogo": {
566+
"name": "bool",
567+
"description": "add the plotly logo on the end of the mode bar",
568+
"required": false
569+
},
570+
"plotGlPixelRatio": {
571+
"name": "number",
572+
"description": "increase the pixel ratio for Gl plot images",
573+
"required": false
574+
},
575+
"topojsonURL": {
576+
"name": "string",
577+
"description": "URL to topojson files used in geo charts",
578+
"required": false
579+
},
580+
"mapboxAccessToken": {
581+
"name": "any",
582+
"description": "Mapbox access token (required to plot mapbox trace types)\nIf using an Mapbox Atlas server, set this option to '',\nso that plotly.js won't attempt to authenticate to the public Mapbox server.",
583+
"required": false
584+
}
585+
}
586+
},
587+
"required": false,
588+
"description": "Plotly.js config options.\nSee https://plot.ly/javascript/configuration-options/\nfor more info.",
589+
"defaultValue": {
590+
"value": "{\n staticPlot: false,\n editable: false,\n edits: {\n annotationPosition: false,\n annotationTail: false,\n annotationText: false,\n axisTitleText: false,\n colorbarPosition: false,\n colorbarTitleText: false,\n legendPosition: false,\n legendText: false,\n shapePosition: false,\n titleText: false\n },\n autosizable: false,\n queueLength: 0,\n fillFrame: false,\n frameMargins: 0,\n scrollZoom: false,\n doubleClick: 'reset+autosize',\n showTips: true,\n showAxisDragHandles: true,\n showAxisRangeEntryBoxes: true,\n showLink: false,\n sendData: true,\n linkText: 'Edit chart',\n showSources: false,\n displayModeBar: 'hover',\n modeBarButtonsToRemove: [],\n modeBarButtonsToAdd: [],\n modeBarButtons: false,\n displaylogo: true,\n plotGlPixelRatio: 2,\n topojsonURL: 'https://cdn.plot.ly/',\n mapboxAccessToken: null\n}",
591+
"computed": false
592+
}
593+
},
388594
"dashEvents": {
389595
"type": {
390596
"name": "enum",

dash_core_components/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.8.0'
1+
__version__ = '0.9.0'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dash-core-components",
3-
"version": "0.8.0",
3+
"version": "0.9.0",
44
"description": "Core component suite for Dash",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)