You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`type: maintenance`| source code cleanup resulting in no enhancement for users |
@@ -96,6 +97,13 @@ Three additional helpers exist that are refreshed every second:
96
97
There is also a search bar in the top right of the dashboard. This fuzzy-searches
97
98
image mocks based on their file name and trace type.
98
99
100
+
#### Alternative to test dashboard
101
+
102
+
Use the [`plotly-mock-viewer`](https://github.com/rreusser/plotly-mock-viewer)
103
+
which has live-reloading and a bunch of other cool features.
104
+
An online version of `plotly-mock-viewer` is available at https://rreusser.github.io/plotly-mock-viewer/
105
+
which uses https://cdn.plot.ly/plotly-latest.min.js
106
+
99
107
#### Other npm scripts
100
108
101
109
-`npm run preprocess`: pre-processes the css and svg source file in js. This
@@ -175,11 +183,23 @@ which shows the baseline image, the generated image, the diff and the json mocks
175
183
176
184
To view the results of a run on CircleCI, download the `build/test_images/` and `build/test_images_diff/` artifacts into your local repo and then run `npm run start-image_viewer`.
177
185
178
-
### Writing interaction tests
186
+
### Using the developer console in karma to write/debug jasmine tests
187
+
188
+
- Click on the `DEBUG` button
189
+
- In the `DEBUG RUNNER` window, open the console (e.g. with `<ctrl-shift-j>`)
190
+
- Find test file (e.g. with `<ctrl-o>` + typing the name of the file), look out
191
+
for "bundled" files with the same name.
192
+
- Set `debugger` on relevant line(s)
193
+
- Rerun the test suite by refreshing the page (e.g. with `<crtl-r>`)
Keep in mind that the interaction coordinates are relative to the top-left corner of the plot, including the margins. To produce a reliable interaction test,
180
200
it may be necessary to fix the width, height, margins, X axis range and Y axis range of the plot. For example:
181
201
182
-
```
202
+
```js
183
203
Plotly.newPlot(gd, [{
184
204
x: [1, 1, 1, 2, 2, 2, 3, 3, 3],
185
205
y: [1, 2, 3, 1, 2, 3, 1, 2, 3],
@@ -196,18 +216,67 @@ This will produce the following plot, and say you want to simulate a selection p
- Sources files are in `src/`, including the index
223
+
- Sources files are in `src/`
205
224
- Build and repo management scripts are in `tasks/`
206
225
- All tasks can be run using [`npm run-script`](https://docs.npmjs.com/cli/run-script)
207
226
- Tests are `test/`, they are partitioned into `image` and `jasmine` tests
208
227
- Test dashboard and image viewer code is in `devtools/`
209
-
- Built files are in `build/` (most files in here are git-ignored, the css and font built files are exceptions)
210
-
228
+
- Built files are in `build/` (the files in here are git-ignored, except for `plotcss.js`)
229
+
230
+
## Trace module design
231
+
232
+
The trace modules (found in [`src/traces`](https://github.com/plotly/plotly.js/tree/master/src/traces))
233
+
are defined as plain objects with functions and constants attached to them in an index file
234
+
(e.g. `src/traces/scatter/index.js`). The trace modules are "registered" undo the `Registry` object
235
+
(found in [`src/registry.js`](https://github.com/plotly/plotly.js/blob/master/src/registry.js)) using
236
+
`Plotly.register` (as done in the index files in `dist/`).
237
+
238
+
The trace module methods are meant to be called as part of loops during subplot-specific
239
+
(e.g. in `plots/cartesian/index.js`) and figure-wide (e.g. in `plots/plots.js`) subroutines.
240
+
That way, the subroutines work no matter which trace modules got registered.
241
+
242
+
All traces modules set:
243
+
244
+
-`_module.name`: name of the trace module as used by the trace `type` attribute.
245
+
-`_module.basePlotModule`: base plot (or subplot) module corresponding to the
246
+
trace type (e.g. `scatter` links to the `Cartesian` base plot module, `scatter3d` links to `gl3d`).
247
+
-`_module.attributes`: JSON-serializable object of attribute declarations.
248
+
This object is used to generate the plot-schema JSON.
249
+
-`_module.supplyDefaults`: Takes in input trace settings and coerces them into "full" settings
250
+
under `gd._fullData`. This one is called during the figure-wide `Plots.supplyDefaults` routine.
251
+
Note that the `supplyDefaults` method performance should scale with the number of attributes (**not** the
252
+
number of data points - so it should not loop over any data arrays).
253
+
-`_module.calc`: Converts inputs data into "calculated" (or sanitized) data. This one is called during
254
+
the figure-wide `Plots.doCalcdata` routine. The `calc` method is allowed to
255
+
scale with the number of data points and is in general more costly than `supplyDefaults`.
256
+
Please note that some edit pathways skip `Plots.doCalcdata` (as determined by the
257
+
`editType` flags in the attributes files).
258
+
-`_module.plot`: Draws the trace on screen. This one is called by the defined `basePlotModule`.
259
+
260
+
Other methods used by some trace modules:
261
+
262
+
-`_module.categories`: list of string identifiers used to group traces by behavior. Traces that
263
+
have a given category can then be detected using [`Registry.traceIs`](https://github.com/plotly/plotly.js/blob/8f049fddbac0ca0382816984b8526857e9714fe6/src/registry.js#L129-L155)
264
+
-`_module.layoutAttributes`: JSON-serializable object of attribute declarations
265
+
coerced in the layout (e.g. `barmode` for `bar` traces)
266
+
-`_module.supplyLayoutDefaults`: Defaults logic for layout attributes.
267
+
-`_module.crossTraceDefaults`: Defaults logic that depends on input setting of multiple traces.
268
+
-`_module.crossTraceCalc`: Computations that depend on the data of multiple traces.
269
+
-`_module.colorbar`: Defines the colorbar appearance for traces that support it.
270
+
-`_module.hoverPoints`: Point-picking logic called during hover.
271
+
-`_module.selectPoints`: Polygon-containing logic called during selections.
272
+
-`_module.style`: Sometimes split from `_module.plot` where `_module.plot` only
273
+
draws the elements and `_module.style` styles them.
274
+
-`_module.styleOnSelect`: Optimization of `_module.style` called during
275
+
selections.
276
+
-`_module.convert`: Sometimes separated from `_module.plot` or `_module.calc` to convert the
277
+
plotly.js settings to another framework e.g. to `gl-plot3d` for `gl3d` traces, to
278
+
`mapbox-gl` from `mapbox` traces. This split can make the logic easier to test.
279
+
If you make a `convert`, you should call it from either `calc` or `plot`.
@@ -63,7 +63,7 @@ Fastly supports Plotly.js with free CDN service. Read more at https://www.fastly
63
63
64
64
and use the plotly.js `dist` file(s). More info [here](https://github.com/plotly/plotly.js/blob/master/dist/README.md).
65
65
66
-
#### Read the [Getting started page](https://plot.ly/javascript/getting-started/) for more examples.
66
+
#### Read the [Getting started page](https://plotly.com/javascript/getting-started/) for more examples.
67
67
68
68
69
69
## Modules
@@ -93,8 +93,6 @@ Then elsewhere in your code:
93
93
var Plotly =require('./path/to/custom-plotly');
94
94
```
95
95
96
-
To learn more about the plotly.js module architecture, refer to our [modularizing monolithic JS projects](https://plot.ly/javascript/modularizing-monolithic-javascript-projects/) post.
97
-
98
96
#### Non-ascii characters
99
97
100
98
Important: the plotly.js code base contains some non-ascii characters. Therefore, please make sure to set the `charset` attribute to `"utf-8"` in the script tag that imports your plotly.js bundle. For example:
@@ -113,13 +111,11 @@ Have a bug or a feature request? Please first read the [issues guidelines](https
113
111
114
112
## Documentation
115
113
116
-
Official plotly.js documentation is hosted on [plot.ly/javascript](https://plot.ly/javascript).
114
+
Official plotly.js documentation is hosted on [plotly.com/javascript](https://plotly.com/javascript).
117
115
118
-
These pages are generated by the Plotly [documentation repo](https://github.com/plotly/documentation/tree/gh-pages) built with [Jekyll](http://jekyllrb.com) and publicly hosted on GitHub Pages.
116
+
These pages are generated by the Plotly [graphing-library-docs repo](https://github.com/plotly/graphing-library-docs) built with [Jekyll](https://jekyllrb.com/) and publicly hosted on GitHub Pages.
119
117
For more info about contributing to Plotly documentation, please read through [contributing guidelines](https://github.com/plotly/documentation/blob/source/Contributing.md).
120
118
121
-
You can also suggest new documentation examples by submitting a [Codepen](http://codepen.io/tag/plotly/) on community.plot.ly with tag [`plotly-js`](http://community.plot.ly/c/plotly-js).
122
-
123
119
## Contributing
124
120
125
121
Please read through our [contributing guidelines](https://github.com/plotly/plotly.js/blob/master/CONTRIBUTING.md). Included are directions for opening issues, using plotly.js in your project and notes on development.
@@ -128,14 +124,13 @@ Please read through our [contributing guidelines](https://github.com/plotly/plot
128
124
129
125
* Follow [@plotlygraphs](https://twitter.com/plotlygraphs) on Twitter for the latest Plotly news.
130
126
* Follow [@plotly_js](https://twitter.com/plotly_js) on Twitter for plotly.js release updates.
131
-
* Implementation help may be found on community.plot.ly (tagged [`plotly-js`](http://community.plot.ly/c/plotly-js)) or
127
+
* Implementation help may be found on community.plot.com (tagged [`plotly-js`](https://community.plotly.com/c/plotly-js)) or
132
128
on Stack Overflow (tagged [`plotly`](https://stackoverflow.com/questions/tagged/plotly)).
133
129
* Developers should use the keyword `plotly` on packages which modify or add to the functionality of plotly.js when distributing through [npm](https://www.npmjs.com/browse/keyword/plotly).
134
-
* Direct developer email support can be purchased through a [Plotly Support Plan](https://support.plot.ly/libraries/javascript).
135
130
136
131
## Versioning
137
132
138
-
This project is maintained under the [Semantic Versioning guidelines](http://semver.org/).
133
+
This project is maintained under the [Semantic Versioning guidelines](https://semver.org/).
139
134
140
135
See the [Releases section](https://github.com/plotly/plotly.js/releases) of our GitHub project for changelogs for each release version of plotly.js.
141
136
@@ -145,15 +140,10 @@ Open-source clients to the plotly.js APIs are available at these links:
Copy file name to clipboardExpand all lines: SECURITY.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -9,17 +9,17 @@ untrusted data being graphed by plotly.js. However, XSS or other issues may sti
9
9
Note that the typical use case for plotly.js is for visualizing data from trusted sources. For example if you use plotly.js to add a dashboard to your site and you control all the input data that's sent to plotly.js, you are not dependent on plotly.js for XSS protection.
10
10
11
11
If you require a higher degree of assurance, please consider purchasing our
12
-
[Plotly On-Premise](https://plot.ly/product/enterprise/) product, or [contact the Plotly sales team](mailto:sales@plot.ly)
12
+
[Plotly On-Premise](https://plotly.com/get-pricing/) product, or [contact the Plotly sales team](mailto:sales@plotly.com)
13
13
for more options.
14
14
15
15
## Reports
16
16
17
-
To report a security vulnerability, please email security@plot.ly with steps to reproduce the problem. Please allow up to
17
+
To report a security vulnerability, please email security@plotly.com with steps to reproduce the problem. Please allow up to
18
18
24 hours for an initial response.
19
19
20
20
## Bounties
21
21
22
-
In some cases, we offer monetary compensation (bounties) for reports of security vulnerabilities. Please see the [Plotly Security Vulnerability Bounty Program](http://help.plot.ly/security/) page for more information.
22
+
In some cases, we offer monetary compensation (bounties) for reports of security vulnerabilities. Please see the [Plotly Security Vulnerability Bounty Program](https://plotly.com/chart-studio-help/security/) page for more information.
23
23
24
24
## Release Process
25
25
@@ -31,4 +31,4 @@ Since the typical plotly.js use case involves trusted data, we do not remove old
31
31
32
32
## Advisories
33
33
34
-
All plotly.js security advisories released after August 1, 2016 are available at the [Plotly Security Advisories](http://help.plot.ly/security-advisories/) page.
34
+
All plotly.js security advisories released after August 1, 2016 are available at the [Plotly Security Advisories](https://plotly.com/chart-studio-help/security-advisories/) page.
0 commit comments