Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
68fee45
regenerating test/plot-schema.json
gvwilson Aug 14, 2025
c685e71
Modified URI link in description
daexs Aug 25, 2025
2aebe7a
Merge branch 'master' of https://github.com/plotly/plotly.js into mkd…
daexs Aug 27, 2025
57e487a
feat: building JavaScript docs locally
gvwilson Aug 29, 2025
3e015f5
Merge branch 'master' into building-docs
gvwilson Sep 9, 2025
6375ea9
escaping string
gvwilson Sep 9, 2025
d3e57c5
Merge branch 'mkdocs-conversion' of https://github.com/plotly/plotly.…
daexs Sep 12, 2025
0a5a2c3
feat: building JavaScript pages with Python instead of Jekyll
gvwilson Sep 11, 2025
3a48587
updating Makefile
gvwilson Sep 15, 2025
91c8be4
Merge branch 'building-docs' of https://github.com/plotly/plotly.js i…
daexs Sep 15, 2025
24ba085
Configured mkdocs and have it auto-generate markdown files including …
daexs Sep 15, 2025
b8bb388
Modified the navigation bar to be consistent with plotly.py docs
daexs Sep 16, 2025
c899732
Cleaned up code and added comments for clarity
daexs Sep 16, 2025
42534be
Reorganized the navigation bar to match the current published JavaScr…
daexs Sep 17, 2025
096f17e
Modified 'docs/bin/example_pages.py' to read the plotly.js version fr…
daexs Sep 19, 2025
6316104
Removed column div tags when generating html for examples in 'docs/tmp'
daexs Sep 19, 2025
50e0d17
Added plotly studio image to nav bar on the left and applied plotly s…
daexs Oct 7, 2025
5c5ed54
refactor: move documentation generation into the root directory
gvwilson Oct 7, 2025
0a4f3b5
Merge pull request #7 from daexs/clean-up-mkdocs-build
gvwilson Oct 7, 2025
ff846b4
feat: move docs/_posts pages into content directory
gvwilson Oct 8, 2025
e3f5a0f
removing Angular.js instructions in BUILDING.md (outdated)
gvwilson Oct 8, 2025
ab21dd0
Tidying up README.md
gvwilson Oct 8, 2025
040d94e
adding 'docs' with generated documentation
gvwilson Oct 8, 2025
2ca8ef7
removing mentions of Plotly.R
gvwilson Oct 8, 2025
c2ea8f7
a bit of documentation and reformatting
gvwilson Oct 8, 2025
5d31640
feat: remove YYYY-DD-MM prefixes from handwritten page names
gvwilson Oct 8, 2025
16d4a7d
Added footer
daexs Oct 9, 2025
f91d4b6
Merge branch 'mkdocs-conversion' of https://github.com/daexs/plotly.j…
daexs Oct 9, 2025
becb4a3
Changed javascript version for codepen and fixed typo in footer link
daexs Oct 10, 2025
6b6173c
Added syntax highlighting to the JavaScript code blocks
daexs Oct 10, 2025
5e47221
Add header
daexs Oct 10, 2025
23c039b
Fixed footer styling and added dash banner and plotly studio admonition
daexs Oct 10, 2025
7ed449b
Added missing semicolons into inline styling for codepen graphs
daexs Oct 14, 2025
600dca4
Disabled syntax highlighting in code blocks, added pages into the 'Qu…
daexs Oct 14, 2025
d2d66d0
Added macros plugin for js version, added download icon to css and ot…
daexs Oct 14, 2025
298a70d
Styled buttons in 'getting-started.md'
daexs Oct 14, 2025
72039e2
Fixed repo styling in header
daexs Oct 15, 2025
6bb9e88
Fixed codepen graph sizing issue
daexs Oct 15, 2025
9c8da97
Style codeblocks, codepen graphs and signature blocks to take up the …
daexs Oct 15, 2025
477e2e2
Converted some parts of 'Function Reference' into markdown and resolv…
daexs Oct 15, 2025
37445f1
Reorganized navigation bar and adjusted titles of pages.
daexs Oct 16, 2025
9f2fd73
Added overview page to API Reference section in nav bar.
daexs Oct 16, 2025
d7a2f23
Added plotly fundamentals index page
daexs Oct 17, 2025
fedda96
Add index pages to each category in the nav bar
daexs Oct 20, 2025
ea56157
Fix internal links
daexs Oct 20, 2025
7508c5e
Add redirects, styled hamburger menu, and redisplay external link arr…
daexs Oct 22, 2025
7730e74
Pushed all markdown files under 'examples/' up a level for SEO
daexs Oct 22, 2025
d2088ba
Added styling for footer text when page is in dark mode.
daexs Oct 23, 2025
e596f43
Added syntax highlighting that changes in dark mode.
daexs Oct 24, 2025
bb04038
Added an 'edit this page' button
daexs Oct 27, 2025
8e4d970
Fixed styling of icon in edit button
daexs Oct 27, 2025
22ee456
Update .gitignore file and plotly ad in nav bar
daexs Oct 28, 2025
7f6ac5d
Merge remote-tracking branch 'upstream/live-docs' into mkdocs-conversion
daexs Oct 28, 2025
5c42341
Changed section in pyproject.toml for docs dependencies into 'docs'.
daexs Nov 6, 2025
e758a9e
Update mkdocs.yml to get rid of the literate-nav plugin
daexs Nov 6, 2025
5e7d332
Removed the 'docs' folder containing the mkdocs build
daexs Nov 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
node_modules
_site

__pycache__

build/*
!build/plotcss.js
Expand All @@ -17,3 +20,7 @@ tags
!.github/
!.gitignore
!.npmignore

tmp

docs/
67 changes: 0 additions & 67 deletions BUILDING.md

This file was deleted.

File renamed without changes.
151 changes: 151 additions & 0 deletions CONTRIBUTING-DOCS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# Contribute to Plotly's [JavaScript Documentation](https://plotly.com/javascript/)

Plotly welcomes contributions to its [open-source JavaScript graphing libraries documentation](https://plotly.com/javascript) from its community of users.

Our JavaScript tutorials are written in HTML files in the `_posts/plotly_js` directory of this repository.

Comment on lines +5 to +6
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this accurate? I don't see that directory

## Contribute Quickly to Plotly's JavaScript Graphing Library Documentation

To quickly make a contribution to Plotly's JavaScript graphing libraries documentation, simply submit a pull request with the change you would like to suggest. This can be done using the GitHub graphical user interface at https://github.com/plotly/graphing-library-docs.

The easiest way to do this is to follow the `Edit this page on GitHub` link at the top right of the page you are interested in contributing to:

![Screen Shot 2020-01-07 at 12 45 39 PM](https://user-images.githubusercontent.com/1557650/71916356-bfe53800-314b-11ea-92b6-eb763037f6d5.png)

**You don't have to worry about breaking the site when you submit a pull request!** This is because your change will not be merged to production immediately. A Plotly team member will first perform a code review on your pull request in order to ensure that it definitely increases the health of Plotly's graphing libraries codebase.
Comment on lines +9 to +15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This readme should be updated to have the new steps


## Develop Locally

For contributions such as new example posts, we recommend setting up a local development environment so that you can test your changes as you work on them.

**See the `How To Get The Application Working Locally` section of the [Contributing Guide](https://github.com/plotly/graphing-library-docs/blob/master/Contributing.md) to learn how to clone this repository to your local development environment and install its dependencies.**

Then follow these instructions to create or modify a new post. If the post is the first of its chart type, you need to create an index page for it first.

## Create An Index Page For A New Chart Type:

If you are documenting a new chart type, then you need to create an index page for it before creating the actual example page.

1. In `documentation/_posts/plotly_js`, create a folder titled with the chart type or topic you're adding to the documentation (i.e. `bar`).

2. `cd` into the folder you created and create an HTML index file for the chart type named: `yyyy-mm-dd-chart_type_plotly_js_index.html`. Copy the index file template below. Make sure to replace placeholder text!
```
---
name: Add-Chart-Type-or-Topic
permalink: javascript/add-chart-type-or-topic/
description: How to make a D3.js-based add-chart-type-or-topic in javascript. Add an additional sentence summarizing chart-type or topic.
layout: langindex
thumbnail: thumbnail/mixed.jpg
language: plotly_js
page_type: example_index
display_as: **SEE BELOW
order: 5
---
{% assign examples = site.posts | where:"language","plotly_js" | where:"suite","add-chart-type-or-topic"| sort: "order" %}
{% include posts/auto_examples.html examples=examples %}
```
- Make sure to update `_includes/posts/documentation_eg.html`, `_includes/layouts/side-bar.html`, and `_data/display_as_py_r_js.yml` and the CI python scripts with the new chart type!

- Index pages for chart categories must have `order: 5`.

## Create A New Example Post:

1. In the folder containing the examples for the chart type you are writing documentation for, create a file named: `yyyy-mm-dd-example-title.html`.

2. Copy the example post template below and write JavaScript code to demonstrate the feature you are documenting.
- If `plot_url` front-matter is not present, then the resulting chart will be displayed inline and a `Try It Codepen` button will be automatically generated.
- If `plot_url` front-matter is present, then the URL given will be embedded in an `iframe` below the example.
```
---
description: How to make a D3.js-based bar chart in javascript. Seven examples of
grouped, stacked, overlaid, and colored bar charts.
display_as: basic
language: plotly_js
layout: base
name: Bar Charts
order: 3
page_type: example_index
permalink: javascript/bar-charts/
redirect_from: javascript-graphing-library/bar-charts/
thumbnail: thumbnail/bar.jpg **MORE INFO ON ADDING THUMBNAILS BELOW
markdown_content: |
indented content in markdown format which will prefix an example ****SEE BELOW
---
var data = [
{
x: ['giraffes', 'orangutans', 'monkeys'],
y: [20, 14, 23],
type: 'bar'
}The
];

Plotly.newPlot('myDiv', data);
```

- `display_as` sets where your tutorial is displayed. Make sure to update `_includes/posts/documentation_eg.html` with the new chart type!:
- 'file_settings' = https://plotly.com/javascript/plotly-fundamentals
- 'basic' = https://plotly.com/javascript/basic-charts
- 'statistical' = https://plotly.com/javascript/statistical-charts
- 'scientific' = https://plotly.com/javascript/scientific-charts
- 'financial' = https://plotly.com/javascript/financial-charts
- 'maps' = https://plotly.com/javascript/maps
- '3d_charts' = https://plotly.com/javascript/3d-charts
- See additional options [HERE](https://github.com/plotly/graphing-library-docs/blob/master/_includes/posts/documentation_eg.html#L1)

- `order` defines the order in which the tutorials appear in each section on plot.ly/javascript.
- <b>Note</b> The `order` of posts within a `display_as` must be a set of consecutive integers (i.e. [1, 2, 3, 4, 5, 6, ...]).
- If a post has an `order` less than 5, it **MUST** also have the `page_type: example_index` front-matter so that it gets displayed on the index page.

- `markdown_content` is rendered directly above the examples. In general, it is best to *avoid* paragraph-formatted explanation and let the simplicity of the example speak for itself, but that's not always possible. Take note that headings in this block *are* reflected in the sidebar.

- Thumbnail images should named `your-tutorial-chart.jpg` and be *EXACTLY* 160px X 160px.
- posts in the following `display_as` categories **MUST** have a thumbnail
- 'file_settings' = https://plotly.com/javascript/plotly-fundamentals
- 'basic' = https://plotly.com/javascript/basic-charts
- 'statistical' = https://plotly.com/javascript/statistical-charts
- 'scientific' = https://plotly.com/javascript/scientific-charts
- 'financial' = https://plotly.com/javascript/financial-charts
- 'maps' = https://plotly.com/javascript/maps
- '3d_charts' = https://plotly.com/javascript/3d-charts
- Thumbnail images should be clear and interesting. You do not need to capture the ENTIRE chart, but rather focus on the most interesting part of the chart.
- Use images.plot.ly for adding new images. The password is in the Plotly 1Password Engineering Vault.
- Log-in here: https://661924842005.signin.aws.amazon.com/console
- From the <b>Amazon Web Services Console</b> select <b>S3 (Scalable Storage in the Cloud)</b> then select <b>plotly-tutorials</b> -> <b>plotly-documentation</b> -> <b>thumbnail</b>
- Now from <b>All Buckets /plotly-tutorials/plotly-documentation/thumbnail</b> select the <b>Actions</b> dropdown and <b>upload</b> your .jpg file

## Modify An Existing Post:

1. Find the post you want to modify in `_posts/plotly_js`. Then, open the HTML file that contains that post and modify either the front-matter or the JavaScript.

# Best Practices:
- `order` examples from basic to advanced
- avoid the use of global JavaScript variables for `data` and `layout`.
- make the chart display in a DOM element named `myDiv`
- use the `.newPlot()` function
- use "real" data to make the examples realistic and useful for users.
- avoid using random or dummy data as much as humanly possible! Should only be a last resort.
- upload data files to https://github.com/plotly/datasets as importing data rather than pasting a large chunk of data in the tutorial creates a cleaner example.
- use `var config = {mapboxAccessToken: "your access token"};` if your chart requires Mapbox authentication. `"your access token` will replaced by Plotly's private token at build time. In development mode, you will need to create a `_data/mapboxtoken.yml` file and paste Plotly's non-URL restricted Mapbox key into it. This is available in 1Password.

## Make a Pull Request
- Ready for your changes to be reviewed? Make a pull request!

- Create a feature branch and use `git status` to list changed files.
```
git checkout -b your_feature_branch
git status
```
- Add, commit, and push the files that you'd like to add to your PR:
```
git add file-a
git add file-b
git commit -m 'message about your changes'
git push origin your_feature_branch
```
- Visit the [documentation repo](https://github.com/plotly/graphing-library-docs) and open a pull request!. You can then tag **@jdamiba** for a review.

## Style Edits

Please refer to our [Styles README](https://github.com/plotly/graphing-library-docs/blob/master/style_README.md)

Thanks for contributing to our documentation!!
9 changes: 5 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ environment for doing development and running tests.
Please check out our [Code of Conduct](code_of_conduct.md). Don't tl:dr; it
but the general idea is to be nice.

## Plotly.js vs Plotly.py and Plotly.R
## Plotly.js vs Plotly.py

[Plotly.js](https://plotly.com/javascript) is a standalone Javascript data visualization library, and it also powers the Python and R modules named `plotly` in those respective ecosystems (referred to as [Plotly.py](https://plotly.com/python) and [Plotly.R](http://plotly.com/r), respectively, for clarity). There also exist Plotly.js-powered libraries for other languages such as Julia, Scala, Rust, .NET and even C++!
[Plotly.js](https://plotly.com/javascript) is a standalone Javascript data visualization library, and it also powers the Python module named `plotly` (referred to as [Plotly.py](https://plotly.com/python) for clarity).

The basic architecture of Plotly.js is to accept [JSON](https://json.org/) representation of figures that adhere to the [figure schema](https://plotly.com/javascript/reference/index/) and draw interactive graphical representations of these figures in a browser. Libraries in other languages like Python and R provide idiomatic interfaces for users of those languages to create and manipulate these JSON structures, and arrange for them to be rendered in a browser context by Plotly.js. This means that in many cases, when a Python or R user wishes to add a feature to the library they know as `plotly`, the relevant changes must be implemented in Plotly.js, in this repo.
The basic architecture of Plotly.js is to accept [JSON](https://json.org/) representation of figures that adhere to the [figure schema](https://plotly.com/javascript/reference/index/) and draw interactive graphical representations of these figures in a browser. The Python library provides an idiomatic interface for Python users to create and manipulate these JSON structures, and arrange for them to be rendered in a browser context by Plotly.js. This means that in many cases, when a Python user wishes to add a feature to the library they know as `plotly`, the relevant changes must be implemented in Plotly.js, in this repo.

## How do changes get made to Plotly.js?

Expand All @@ -37,7 +37,8 @@ The basic process for adding new features or fixing bugs is as follows. Please n
The current Plotly.js maintainers are all employees of Plotly (the company) and one of their primary responsibilities is ensuring the process above runs smoothly. It is worth noting that maintainers and non-maintainer Plotly employees all follow the process above: proposing changes, iterating on proposals and eventually developing and reviewing each other's pull requests. As mentioned above, maintainers look after bug fixes, performance, security, documentation and concerns that impact the long-term prospects for this library. In terms of development work, maintainers tend to prioritize issues that do or are likely to impact Plotly customers, as well as on [sponsored features or bug fixes](https://plot.ly/products/consulting-and-oem/). Sponsored work proceeds via the process listed above, albeit with the option of conducting portions of the "discussion" step in a confidential setting if desired. Please note that maintainers are happy and eager to help with community-led pull requests, independent of customer-driven development priorities :)

### The Plotly.js Community
The Plotly.js community, construed fairly broadly, includes the maintainers and all users of Plotly.js and associated projects ([Plotly.py](https://plotly.com/python), [Dash](https://dash.plotly.com/), [Plotly.R](https://plotly.com/r), [Chart Studio](https://plotly.com/chart-studio) and many others). The community includes people from any background, domain, affiliation and level of technical expertise, for example (but not limited to!) employees of small or large companies or startups; employees or students of universities or other educational institutions; government employees and contractors; employees and volunteers of non-profits; individual hobbyists etc.

The Plotly.js community, construed fairly broadly, includes the maintainers and all users of Plotly.js and associated projects ([Plotly.py](https://plotly.com/python), [Dash](https://dash.plotly.com/), and others supported by the open source community). The community includes people from any background, domain, affiliation and level of technical expertise, for example (but not limited to!) employees of small or large companies or startups; employees or students of universities or other educational institutions; government employees and contractors; employees and volunteers of non-profits; individual hobbyists etc.

**Anyone in the community is encouraged to contribute to every step of the process described above!** Creating issues to report bugs or suggest new behaviours is a valuable contribution to this project, as is proposing a concrete set of changes to address issues created by anyone at any time. In the same way, giving feedback on proposals created by anyone in the community is valuable, as is, of course, development and review work. [Proposing changes to the documentation of Plotly.js or associated projects](https://github.com/plotly/graphing-library-docs/blob/master/README.md) is an extremely valuable form of contribution, as is [asking or answering questions on our community forum](https://community.plotly.com/), as it creates a record of a question and discussion, which others can stumble across later and use to further their own work.

Expand Down
64 changes: 64 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Manage plotly.js documentation.

RUN = uv run
SCHEMA_SRC = test/plot-schema.json
HANDWRITTEN = content
TMP = tmp

EXAMPLES_DIR = ${HANDWRITTEN}/plotly_js
EXAMPLES_IN := $(shell find "${EXAMPLES_DIR}" -name '*.html')
EXAMPLES_TMP = ${TMP}/javascript
EXAMPLES_OUT = ${EXAMPLES_TMP}/axes/index.html # could be any of the generated files

REFERENCE_DIR = ${HANDWRITTEN}/reference_pages/javascript/
REFERENCE_IN := $(wildcard ${REFERENCE_DIR}/*.html)
REFERENCE_TMP = ${TMP}/reference
REFERENCE_OUT = ${REFERENCE_TMP}/bar/index.html # could be any of the generated files

DOCS_DIR=docs
DOCS_OUT=${DOCS_DIR}/sitemap.xml

## commands: show available commands
commands:
@grep -h -E '^##' ${MAKEFILE_LIST} | sed -e 's/## //g' | column -t -s ':'

## docs: rebuild full documentation in `./docs`
.PHONY: docs
docs: ${DOCS_OUT}

${DOCS_OUT}: ${EXAMPLES_OUT} ${REFERENCE_OUT}
Comment on lines +1 to +29
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add to the docs contributing guide on how to build the docs, and maybe a GitHub action that runs the required steps to test generating the output.

@${RUN} mkdocs build

## examples: build intermediate example documentation in ./tmp
examples: ${EXAMPLES_OUT}

${EXAMPLES_OUT}: bin/example_pages.py ${EXAMPLES_IN}
@mkdir -p ${TMP}
@${RUN} bin/example_pages.py --indir ${EXAMPLES_DIR} --outdir ${EXAMPLES_TMP} --jsversion 3.2.1

## reference: build intermediate reference documentation in ./tmp
reference: ${REFERENCE_OUT}

${REFERENCE_OUT}: bin/reference_pages.py ${SCHEMA_SRC} ${REFERENCE_IN}
@mkdir -p ${TMP}
@${RUN} bin/reference_pages.py --schema ${SCHEMA_SRC} --outdir ${REFERENCE_TMP} ${REFERENCE_IN}

## serve: display documentation
serve:
${RUN} mkdocs serve

## --: --

## clean: clean up repository
clean:
@find . -name '*~' -delete
@find . -name '.DS_Store' -delete
@rm -rf docs ${TMP}

## format: reformat Python code
format:
@ruff format bin

## lint: check code and project
lint:
@ruff check bin
Loading