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

Skip to content

Commit f0c3d6c

Browse files
authored
Merge pull request plotly#1172 from plotly/MercifulCode-source-design-merge
Merciful code source design merge
2 parents dff0a70 + 3b0a781 commit f0c3d6c

File tree

10 files changed

+68
-66
lines changed

10 files changed

+68
-66
lines changed

Contributing.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,42 @@
1-
## Repo Organization
1+
# Repo Organization
2+
23
Edit or add files in the `_posts` folder in the [source-design-merge](http://github.com/plotly/documentation/tree/source-design-merge) branch.
34

45
## Clone the Repo and Install Dependencies
6+
57
1. Clone the repo and then check out the source-design-merge branch:
68

7-
```
8-
$ git clone https://github.com/plotly/documentation.git
9-
$ git fetch origin
10-
$ git checkout source-design-merge
11-
```
9+
```sh
10+
git clone git@github.com:plotly/documentation.git
11+
git fetch origin
12+
git checkout source-design-merge
13+
```
1214

13-
2. Check Ruby version `$ ruby --version`. We recommend using the same ruby version as gh-pages: https://pages.github.com/versions/. Note [RVM](https://rvm.io/rvm/install) is helpful for installing and managing ruby versions.
15+
2. Check Ruby version `$ ruby --version`. We recommend using the same ruby version as [gh-pages](https://pages.github.com/versions/). Note [RVM](https://rvm.io/rvm/install) is helpful for installing and managing ruby versions.
1416

1517
3. Install bundler and dependencies from the `gemfile`:
1618

17-
```
18-
$ gem install bundler
19-
$ bundle install
20-
```
21-
Note these dependencies should be the same version that gh-pages is using: https://pages.github.com/versions/ .
19+
```sh
20+
gem install bundler
21+
bundle install
22+
```
23+
24+
Note these dependencies should be the same version that [gh-pages](https://pages.github.com/versions/) is using.
2225

2326
4. When we deploy, a function is run to update the plot schema. To do this successfully you have to make sure you have the `requests` python package: `pip install requests`
2427

2528
## Making Changes
26-
- For information about editing **plotly.js** docs see: https://github.com/plotly/documentation/blob/source-design-merge/_posts/plotly_js/README.md
29+
30+
- For information about editing **plotly.js** docs see: https://github.com/plotly/documentation/blob/source-design-merge/_posts/plotly_js/README.md
2731
- For information about editing **python** docs see: https://github.com/plotly/documentation/blob/source-design-merge/_posts/python/README.md
2832
- For information about editing **R** docs see: https://github.com/plotly/documentation/blob/source-design-merge/_posts/r/README.md
2933
- For information about editing chart studio documentation found at [https://help.plot.ly/tutorials/](https://help.plot.ly/tutorials/) please see this repo: [https://github.com/plotly/plotly.github.io](https://github.com/plotly/plotly.github.io)
3034

3135
## Render Changes Locally
36+
3237
Please **ALWAYS** locally serve the docs and check your changes before committing updates.
33-
1. To serve the docs locally, in the documentation repo run: `$ bundle exec jekyll serve --config _config_dev.yml`
38+
39+
1. To serve the docs locally, in the documentation repo run: `bundle exec jekyll serve --config _config_dev.yml`
3440
2. Visit the pages at: [http://localhost:4000/python/](http://localhost:4000/python/)
3541
3. When you make changes, jekyll should automatically regenerate for you. Read the messages in your terminal to check it out
3642

@@ -40,7 +46,7 @@ excluding folders in the `_config_dev.yml` file.
4046

4147
For example, change `_config_dev.yml` to this:
4248

43-
```
49+
```yml
4450
staticurl: http://localhost:4000/all_static
4551
exclude: [_posts/ggplot2, _posts/julia, _posts/matlab, _posts/matplotlib, _posts/nodejs, _posts/r] # [_posts/python,]
4652
```
@@ -49,7 +55,7 @@ and you'll only load the files in `_posts/python`.
4955

5056
Change it to this
5157

52-
```
58+
```yml
5359
staticurl: http://localhost:4000/all_static
5460
exclude: []
5561
```
@@ -61,12 +67,12 @@ Ready for your changes to be reviewed? Make a pull request against the `source-d
6167
Create a feature branch and use `git status` to list changed files.
6268

6369
(Make sure that the feature branch is a branch off from `source-design-merge` local branch in your machine and not from any other previously worked branch).
64-
```
70+
```sh
6571
git checkout -b your_feature_branch
6672
git status
6773
```
6874
Add, commit, and push the files that you'd like to add to your pr:
69-
```
75+
```sh
7076
git add file-a
7177
git add file-b
7278
git commit -m 'message about your changes'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
plotly's github-pages api documentation repository
1+
# Plotly's github-pages api documentation repository
22

33
- the [source-design-merge](http://github.com/plotly/documentation/tree/source-design-merge) branch is where edits and contributions are made
44
- the [gh-pages](http://github.com/plotly/documentation/tree/gh-pages) branch is the deploy branch, automatically updated with `$ rake deploy` inside [source-design-merge](http://github.com/plotly/documentation/tree/source-design-merge)

_posts/plotly_js/README.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
11
# Contribute to Plotly's [Javascript Documentation](https://plot.ly/javascript/)
2+
23
## Initial Steps:
4+
35
1. Clone the repo and then check out the source-design-merge branch:
46

5-
```
6-
$ git clone [email protected]:plotly/documentation.git
7-
$ git fetch origin
8-
$ git checkout source-design-merge
7+
```sh
8+
git clone [email protected]:plotly/documentation.git
9+
git fetch origin
10+
git checkout source-design-merge
911
```
1012

11-
2. Check Ruby version `$ ruby --version`. We recommend using the same ruby version as gh-pages: https://pages.github.com/versions/. Note [RVM](https://rvm.io/rvm/install) is helpful for installing and managing ruby versions.
13+
2. Check Ruby version `$ ruby --version`. We recommend using the same ruby version as [gh-pages](https://pages.github.com/versions/). Note [RVM](https://rvm.io/rvm/install) is helpful for installing and managing ruby versions.
1214

1315
3. Install bundler and a couple dependencies from the gemfile:
1416

15-
```
16-
$ gem install bundler
17-
$ bundle install
17+
```sh
18+
gem install bundler
19+
bundle install
20+
```
1821

19-
```
2022
<b>IMPORTANT</b> -If not using bundler and the gemfile, [install the same jekyll version that Github Pages is using](https://pages.github.com/versions/).
2123

2224
## Create Plotly.js Documentation:
23-
Our javascript tutorials are written in HTML files with embeded [codepen](http://codepen.io/plotly/) examples.
25+
26+
Our javascript tutorials are written in HTML files with embedded [codepen](http://codepen.io/plotly/) examples.
27+
2428
##### In `documentation/_posts/plotly_js`
25-
1. Create a folder titled with the chart type or topic you're adding to the documentation (i.e. `bar`)
29+
30+
1. Create a folder titled with the chart type or topic you're adding to the documentation (i.e. `bar`)
31+
2632
2. `cd` into the folder you created and create an html index file labeled: `yyyy-mm-dd-chart_type_plotlyjs_index.html`. Copy the index file template below and replace with the necessary information pertaining to the doc you are creating.
2733
```
2834
---

_posts/plotly_js/chart-events/events/2017-01-01-order3-1_event_data.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
curveNumber: 2, // index in data of the trace associated with the selected point
5252
pointNumber: 2, // index of the selected point
5353
lat: 50, // latitude value
54-
lon: -12, // longtitude value
54+
lon: -12, // longitude value
5555
data: {/* */}, // ref to the trace as sent to Plotly.plot associated with the selected point
5656
fullData: {/* */}, // ref to the trace including all of the default attributes
5757
location: //

_posts/plotly_js/chart-events/events/2017-01-01-order6_selected_event.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
sitemap: false
88
arrangement: horizontal
99
markdown_content: |
10-
Here's a simple example using the data returned from the `plotly_selected` event. `plotly_selected` returns event data for all points selected simultaneously. After creating a scatter plot with random data and two histograms that display the x and y distributions of that random data, we can select points by clicking and dragging on the plot. Upon `plotly_selected` the histograms will update to display the distribution of the x and y values of the selected points. The color of the scatter plot will be updated as well to highlight the selected points. For more examples of using `plotly_slected` and `plotly_selecting` events, see: https://plot.ly/javascript/lasso-selection/
10+
Here's a simple example using the data returned from the `plotly_selected` event. `plotly_selected` returns event data for all points selected simultaneously. After creating a scatter plot with random data and two histograms that display the x and y distributions of that random data, we can select points by clicking and dragging on the plot. Upon `plotly_selected` the histograms will update to display the distribution of the x and y values of the selected points. The color of the scatter plot will be updated as well to highlight the selected points. For more examples of using `plotly_selected` and `plotly_selecting` events, see: https://plot.ly/javascript/lasso-selection/
1111
---
1212
var graphDiv = document.getElementById('graph');
1313
var N = 1000;

_posts/plotly_js/fundamentals/2015-11-06-announcement.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ language: plotly_js
1111

1212
# Plotly.js Open-Source Announcement
1313

14-
1514
November 17, 2015
1615

1716
<blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">✨ Announcement ✨ 100% of Plotly&#39;s JavaScript charting library is now free and open-source.<a href="https://t.co/5bneDRdV98">https://t.co/5bneDRdV98</a> <a href="https://t.co/NADG6eaEmA">pic.twitter.com/NADG6eaEmA</a></p>&mdash; plotly (@plotlygraphs) <a href="https://twitter.com/plotlygraphs/status/666667595903459328">November 17, 2015</a></blockquote>
@@ -21,7 +20,7 @@ A growing number of graphing tools and libraries allow anyone to make beautiful,
2120

2221
**Today, Plotly is announcing that we have open-sourced plotly.js, the core technology and JavaScript graphing library behind Plotly’s products** (MIT license). It's all out there and free. Any developer can now integrate Plotly’s library into their own applications unencumbered. Plotly.js supports 20 chart types, including 3D plots, geographic maps, and statistical charts like density plots, histograms, box plots, and contour plots.
2322

24-
We’re big fans of collaboration, freedom, and perpetual motion. Open-source has become the de facto distribution for gold-standard scientific and business intelligence software. We want to support, participate in, and amplify this trend. By open-sourcing Plotly's core technology, everyone benefits from peer-review and Plotly's products will continue to be the most cutting-edge offering for exploratory visualization. Plotly.js has the quality, accessibility, and scope to be the charting standard for the Web, but we can only achieve this breadth by working across communities and making the distribution truly unencumbered, portable, and free.
23+
We’re big fans of collaboration, freedom, and perpetual motion. Open-source has become the de facto distribution for gold-standard scientific and business intelligence software. We want to support, participate in, and amplify this trend. By open-sourcing Plotlys core technology, everyone benefits from peer-review and Plotlys products will continue to be the most cutting-edge offering for exploratory visualization. Plotly.js has the quality, accessibility, and scope to be the charting standard for the Web, but we can only achieve this breadth by working across communities and making the distribution truly unencumbered, portable, and free.
2524

2625
Despite the possibilities that the web offers, the core plotting libraries in scientific software like MATLAB, R, and Python still create static image files rather than dynamic, interactive charts. Many technical and scientific projects still don't embrace web technology because of JavaScript libraries being commercially developed, expensive, narrow in scope, or difficult to learn and use. By open-sourcing Plotly’s easy-to-use, comprehensive library, Plotly hopes to bring the power of interactive plotting to every developer, team, data scientist, and analyst.
2726

@@ -105,7 +104,7 @@ The plotly.js roadmap is constantly changing, but 2016 is likely to be focused o
105104

106105
If you’re a JavaScript developer, consider taking a look at the plotly.js code on [GitHub](https://github.com/plotly/plotly.js). Submitting Codepen examples to [community.plot.ly](http://community.plot.ly/c/plotly-js) for the documentation is also a great way to contribute.
107106

108-
If you’re an R, Python, MATLAB, or Julia developer please consider contributing to one of the clients on [Plotly's GitHub](http://github.com/plotly/).
107+
If you’re an R, Python, MATLAB, or Julia developer please consider contributing to one of the clients on [Plotlys GitHub](http://github.com/plotly/).
109108

110109
## Humans behind the project
111110

_posts/plotly_js/fundamentals/2016-01-26-modularization.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ January 28, 2016
1717
modularity using a mono-repo, one npm package and several CommonJS require-able
1818
modules.
1919

20-
2120
The current era of client-side javascript stands between two major events: the
2221
npm-modules explosion is a few years behind us, but wide-spread implementation
2322
of native client-side modules by browsers is several years away.
@@ -46,8 +45,7 @@ they need.
4645
In the past two months, we surveyed library design solutions in an effort to
4746
provide the best experience for plotly.js consumers. We hope that our efforts
4847
may help maintainers of other client-side libraries make judicious design
49-
choices. We present Plotly's solution to client-side modularization below.
50-
48+
choices. We present Plotly’s solution to client-side modularization below.
5149

5250
### Problem
5351

@@ -89,7 +87,6 @@ important in 2016. Its endorsement by the version 4 of
8987
[d3](http://bost.ocks.org/mike/d3-plugin/) may make ES6 module definitions
9088
common place for the next generation of large client-side libraries.
9189

92-
9390
### Possible solution 1
9491

9592
Split up the library's modules into multiple repos, with each module linked to
@@ -113,7 +110,6 @@ discarded.
113110
- Possible code duplication unless the internal modules become npm packages too
114111
(more on that in the next section)
115112

116-
117113
### Possible solution 2
118114

119115
Another solution to the problem would place all the code under one *mono-repo*
@@ -182,7 +178,6 @@ To sum up:
182178
pulling it off.
183179
- Internal modules are prone to code duplication in the resulting bundles.
184180

185-
186181
### Possible solution 3
187182

188183
Our solution!
@@ -252,8 +247,7 @@ made the `require` statements even cleaner e.g. `require('plotly.js/core')`
252247
instead of `require('plotly.js/lib/core')`. But considering the large number of
253248
these `lib` files we have, we opt for a `lib` directory in order to not pollute
254249
the repo's root. Note that the `"main"` package.json field cannot be set to a
255-
directory (more info [here](Mention
256-
https://github.com/nodejs/node/issues/3953)).
250+
directory (more info [here](https://github.com/nodejs/node/issues/3953).
257251

258252
Our solution results in a minor increase in build time, but we feel that the
259253
flexibility it allows is well worth the hit. Browserify and webpack both have
@@ -281,7 +275,6 @@ appropriately.
281275
- Webpack users will need to add [ify-loader](https://github.com/hughsk/ify-loader)
282276
to their config file
283277

284-
285278
You can check out our latest (modular) [plotly.js release on GitHub](https://github.com/plotly/plotly.js/releases/tag/v1.5.0). If this is your first time hearing about plotly.js, check out our [gallery and documentation](https://plot.ly/javascript). We just recently open-sourced the project and you can learn more about our decision in our [open-source announcement](https://plot.ly/javascript/open-source-announcement).
286279

287280
Thanks for reading!

_posts/plotly_js/fundamentals/static-image-export/2016-05-20-static-image.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ You can save plotly graphs to static images and view them in your browser. Consi
1919
var d3 = Plotly.d3;
2020
var img_jpg= d3.select('#jpg-export');
2121

22-
// Ploting the Graph
22+
// Plotting the Graph
2323

2424
var trace={x:[3,9,8,10,4,6,5],y:[5,7,6,7,8,9,8],type:"scatter"};
2525
var trace1={x:[3,4,1,6,8,9,5],y:[4,2,5,2,1,7,3],type:"scatter"};
@@ -33,32 +33,30 @@ You can save plotly graphs to static images and view them in your browser. Consi
3333
// static image in jpg format
3434

3535
.then(
36-
function(gd)
37-
{
38-
Plotly.toImage(gd,{height:300,width:300})
39-
.then(
40-
function(url)
41-
{
42-
img_jpg.attr("src", url);
43-
return Plotly.toImage(gd,{format:'jpeg',height:400,width:400});
44-
}
45-
)
36+
function(gd)
37+
{
38+
Plotly.toImage(gd,{height:300,width:300})
39+
.then(
40+
function(url)
41+
{
42+
img_jpg.attr("src", url);
43+
return Plotly.toImage(gd,{format:'jpeg',height:400,width:400});
44+
}
45+
)
4646
});
4747
To view this image in your page include following HTML tag:
4848

4949
<img id="jpg-export"></img>
5050

5151
Height and width of the image can be adjusted by specifying the same in `toImage` call:
5252

53-
5453
Plotly.toImage(
5554
gd,{
5655
format:'jpeg',
5756
height:desired_height,
5857
width:desired_width,
5958
});
6059

61-
6260
You can also save the image using different formats.
6361

6462
# Formats Supported
@@ -68,8 +66,8 @@ The common image formats: 'PNG', 'JPG/JPEG' are supported. In addition, formats
6866
**Note:** It is important to note that any figures containing WebGL traces (i.e. of type scattergl, heatmapgl, contourgl, scatter3d, surface, mesh3d, scatterpolargl, cone, streamtube, splom, or parcoords) that are exported in a vector format like SVG, EPS or PDF will include encapsulated rasters instead of vectors for some parts of the image.
6967

7068
## Saving as PNG ##
71-
img_png.attr("src", url);
72-
Plotly.toImage(gd,{format:'png',height:400,width:400});
69+
img_png.attr("src", url);
70+
Plotly.toImage(gd,{format:'png',height:400,width:400});
7371

7472
## Saving as SVG ##
7573
img_svg.attr("src", url);

_posts/plotly_js/maps/choropleth-maps/2015-08-11-US-pop-by-state-choropleth.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525

2626
var layout = {
27-
title: '2014 US Popultaion by State',
27+
title: '2014 US Population by State',
2828
geo:{
2929
scope: 'usa',
3030
countrycolor: 'rgb(255, 255, 255)',

style_README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Styles
22

3-
The styling for this repo is broken up into two different parts: [gulp](https://github.com/plotly/documentation/blob/source-design-merge/gulpfile.js) + browsersync + sass and vanilla css.
3+
The styling for this repo is broken up into two different parts: [gulp](https://github.com/plotly/documentation/blob/source-design-merge/gulpfile.js) + browsersync + sass and vanilla css.
44

55
It is recommended to use something to create a local server environment such as MAMP Pro which allows you to set virtual hosts (e.g.: http://api.plotly.dev)
66

@@ -16,14 +16,13 @@ Once the repo has been cloned successfully (see [Contributing.md](https://github
1616

1717
Generally it's best to work with two instances of terminal, one to use for anything related to `$ jekyll` and then another to keep the `$ gulp` task running.
1818

19-
2019
1. run `$ jekyll serve --config _config_dev.yml` to create a local server @ http://localhost:4000 that browsersync leverages (see gulpfile.js to adjust as needed)
2120

2221
OR
2322

24-
2. run `$ jekyll build --config _config_dev.yml` and leverage a local server @ http://api.plotly.dev through a service like MAMP Pro that browsersync leverages (see gulpfile.js to adjust as needed)
25-
3. run `$ gulp`
26-
4. make any updates to the scss files
23+
1. run `$ jekyll build --config _config_dev.yml` and leverage a local server @ http://api.plotly.dev through a service like MAMP Pro that browsersync leverages (see gulpfile.js to adjust as needed)
24+
2. run `$ gulp`
25+
3. make any updates to the scss files
2726

2827
### markup + scss workflow
2928

@@ -55,7 +54,8 @@ When you run a `$ jekyll` you need to update any scss file as jekyll will automa
5554
- main.css *(the css conversion of main.scss)*
5655

5756
## Deploying Changes After Editing the SCSS
58-
- Run `gulp build` in the root of the documentation repo after making any scss edits. This will update `main.css` as well as the [verion](https://github.com/plotly/documentation/blob/source-design-merge/_data/cache_bust_css.yml) which is used to prevent css caching.
57+
58+
- Run `gulp build` in the root of the documentation repo after making any scss edits. This will update `main.css` as well as the [version](https://github.com/plotly/documentation/blob/source-design-merge/_data/cache_bust_css.yml) which is used to prevent css caching.
5959
- `git add` the files you've changed as well as the generated `main.css` and `cache_bust_css.yml` files, `git commit -m 'message about update'`, and `git push origin source-design-merge` to add your updates to the repo.
6060
- run `rake deploy` to deploy changes.
6161

0 commit comments

Comments
 (0)