Skip to content

Commit 02e39a9

Browse files
committed
Merge pull request #433 from plotly/devdocs-update
Update CONTRIBUTING devdocs
2 parents 6d2e5f3 + bcae21a commit 02e39a9

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

CONTRIBUTING.md

+26-9
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ We use the following [labels](https://github.com/plotly/plotly.js/labels) to tra
3030
| `status: discussion needed` | Issue or PR that required discussion among maintaners before moving forward |
3131
| `status: in progress` | PRs that required some intial feedback but not ready to merge |
3232
| `status: reviewable` | PRs that are completed from the author's perspective |
33-
| `status: on hold` | PRs that are put on hold |
33+
| `status: on hold` | PRs that are put on hold |
3434

3535
### Development
3636

@@ -52,7 +52,7 @@ npm install
5252
**Step 2** Start the test dashboard
5353

5454
```
55-
npm run start-test_dashboard
55+
npm start
5656
```
5757

5858
This command bundles up the source files with source maps using
@@ -63,15 +63,32 @@ tab in your browser.
6363

6464
**Step 3** Open up the console and start developing
6565

66-
Make some modifications to the source, refresh the page and check the results
67-
by for example pasting in the console:
66+
A typical workflow is to make some modifications to the source, update the
67+
test dashboard, inspect and debug the changes, then repeat. The test dashboard
68+
comes bundled with some useful tools while developing - all bundled under the
69+
`Tabs` object:
6870

69-
```js
70-
Plotly.plot(Tabs.fresh(), [{x:[1,2,3], y:[2,1,2]}]);
71-
```
7271

73-
- `Tabs.fresh()` creates a fresh graph div and return it and
74-
- `Tabs.getGraph()` returns the current graph div.
72+
| Method/Property | Description |
73+
|-|-|
74+
| `Tabs.fresh([id])` | Creates a fresh graph div and returns it (default id of `graph`). |
75+
| `Tabs.getGraph([id])` | Returns the default or specified graph div. |
76+
| `Tabs.plotMock(mock, [id]) | Plots the specified mock (`.json` extension is not required). |
77+
| `Tabs.snapshot([id]) | Creates a png snapshot of the plot and places it below. |
78+
| `Tabs.reload()` | Reloads the plotly.js script and will execute `Tabs.onReload` once completed. |
79+
| `Tabs.onReload()` | By default, set to `noop` but you may set `Tabs.onReload` to any function you wish. This is useful for replotting a mock or test every time you reload the plotly.js script. |
80+
| `Tabs.purge()` | Destroys all plots. |
81+
82+
View [the source](https://github.com/plotly/plotly.js/blob/master/devtools/test_dashboard/devtools.js) for more info.
83+
84+
Three additional helpers exist that are refreshed every second:
85+
86+
* `gd` - this is the default plot div
87+
* `fullData` - shortcut to `gd._fullData`
88+
* `fullLayout` - shortcut to `gd._fullLayout`
89+
90+
There is also a search bar in the top right of the dashboard. This fuzzy-searches
91+
image mocks based on their file name and trace type.
7592

7693
**Other npm scripts**:
7794

0 commit comments

Comments
 (0)