plotjs 0.0.3__tar.gz → 0.0.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. {plotjs-0.0.3 → plotjs-0.0.5}/.coverage +0 -0
  2. {plotjs-0.0.3 → plotjs-0.0.5}/.github/workflows/lint.yaml +3 -2
  3. plotjs-0.0.5/.github/workflows/tests-js.yaml +18 -0
  4. plotjs-0.0.3/.github/workflows/tests.yaml → plotjs-0.0.5/.github/workflows/tests-python.yaml +3 -1
  5. {plotjs-0.0.3 → plotjs-0.0.5}/.github/workflows/type.yaml +3 -2
  6. {plotjs-0.0.3 → plotjs-0.0.5}/.gitignore +2 -0
  7. {plotjs-0.0.3 → plotjs-0.0.5}/.pre-commit-config.yaml +0 -1
  8. {plotjs-0.0.3 → plotjs-0.0.5}/Makefile +9 -2
  9. {plotjs-0.0.3/plotjs.egg-info → plotjs-0.0.5}/PKG-INFO +2 -2
  10. {plotjs-0.0.3 → plotjs-0.0.5}/README.md +1 -1
  11. {plotjs-0.0.3 → plotjs-0.0.5}/coverage-badge.svg +1 -1
  12. {plotjs-0.0.3 → plotjs-0.0.5}/docs/developers/contributing.md +18 -6
  13. plotjs-0.0.5/docs/developers/overview.md +27 -0
  14. plotjs-0.0.3/docs/developers/how-it-works.md → plotjs-0.0.5/docs/developers/parsing-matplotlib-svg.md +5 -1
  15. plotjs-0.0.5/docs/developers/svg-parser-reference.md +117 -0
  16. {plotjs-0.0.3 → plotjs-0.0.5}/docs/gallery/index.md +35 -7
  17. plotjs-0.0.5/docs/guides/advanced/advanced.py +276 -0
  18. plotjs-0.0.5/docs/guides/advanced/index.md +289 -0
  19. {plotjs-0.0.3 → plotjs-0.0.5}/docs/guides/css/CSS.py +5 -5
  20. {plotjs-0.0.3 → plotjs-0.0.5}/docs/guides/css/index.md +6 -6
  21. plotjs-0.0.5/docs/guides/embed-graphs/index.md +104 -0
  22. {plotjs-0.0.3 → plotjs-0.0.5}/docs/guides/javascript/index.md +5 -5
  23. {plotjs-0.0.3 → plotjs-0.0.5}/docs/guides/javascript/javascript.py +3 -3
  24. plotjs-0.0.5/docs/guides/troubleshooting/index.md +194 -0
  25. plotjs-0.0.5/docs/iframes/CSS-2.html +1656 -0
  26. plotjs-0.0.5/docs/iframes/CSS.html +1652 -0
  27. plotjs-0.0.5/docs/iframes/area-natural-disasters.html +3960 -0
  28. plotjs-0.0.5/docs/iframes/bug.html +1071 -0
  29. {plotjs-0.0.3 → plotjs-0.0.5}/docs/iframes/javascript.html +612 -470
  30. {plotjs-0.0.3 → plotjs-0.0.5}/docs/iframes/javascript2.html +470 -328
  31. {plotjs-0.0.3 → plotjs-0.0.5}/docs/iframes/quickstart.html +612 -470
  32. plotjs-0.0.5/docs/iframes/quickstart10.html +1071 -0
  33. plotjs-0.0.5/docs/iframes/quickstart11.html +2489 -0
  34. plotjs-0.0.3/docs/iframes/quickstart3.html → plotjs-0.0.5/docs/iframes/quickstart2.html +613 -471
  35. plotjs-0.0.3/docs/iframes/quickstart2.html → plotjs-0.0.5/docs/iframes/quickstart3.html +612 -470
  36. plotjs-0.0.5/docs/iframes/quickstart4.html +1335 -0
  37. plotjs-0.0.5/docs/iframes/quickstart5.html +1551 -0
  38. {plotjs-0.0.3 → plotjs-0.0.5}/docs/iframes/quickstart6.html +318 -176
  39. {plotjs-0.0.3 → plotjs-0.0.5}/docs/iframes/quickstart7.html +470 -328
  40. {plotjs-0.0.3 → plotjs-0.0.5}/docs/iframes/quickstart8.html +311 -169
  41. {plotjs-0.0.3 → plotjs-0.0.5}/docs/iframes/quickstart9.html +927 -785
  42. plotjs-0.0.5/docs/iframes/random-walk-1.html +39191 -0
  43. plotjs-0.0.5/docs/img/overview.png +0 -0
  44. {plotjs-0.0.3 → plotjs-0.0.5}/docs/index.md +193 -23
  45. {plotjs-0.0.3 → plotjs-0.0.5}/docs/index.qmd +176 -23
  46. plotjs-0.0.5/docs/reference/plotjs.md +1 -0
  47. plotjs-0.0.5/docs/stylesheets/style.css +24 -0
  48. {plotjs-0.0.3 → plotjs-0.0.5}/mkdocs.yaml +11 -3
  49. plotjs-0.0.5/package-lock.json +3659 -0
  50. plotjs-0.0.5/package.json +14 -0
  51. plotjs-0.0.5/plotjs/__init__.py +6 -0
  52. {plotjs-0.0.3 → plotjs-0.0.5}/plotjs/css.py +1 -1
  53. {plotjs-0.0.3 → plotjs-0.0.5}/plotjs/javascript.py +1 -1
  54. {plotjs-0.0.3 → plotjs-0.0.5}/plotjs/main.py +131 -60
  55. plotjs-0.0.5/plotjs/static/plotparser.js +229 -0
  56. plotjs-0.0.5/plotjs/static/template.html +103 -0
  57. {plotjs-0.0.3 → plotjs-0.0.5}/plotjs/utils.py +13 -0
  58. {plotjs-0.0.3 → plotjs-0.0.5/plotjs.egg-info}/PKG-INFO +2 -2
  59. {plotjs-0.0.3 → plotjs-0.0.5}/plotjs.egg-info/SOURCES.txt +29 -12
  60. {plotjs-0.0.3 → plotjs-0.0.5}/pyproject.toml +4 -3
  61. plotjs-0.0.5/tests/test-javascript/ParserSelectors.test.js +51 -0
  62. plotjs-0.0.5/tests/test-javascript/ParserSetHover.test.js +42 -0
  63. plotjs-0.0.5/tests/test-python/static/script2.js +1 -0
  64. plotjs-0.0.5/tests/test-python/static/style-invalid.css +1 -0
  65. {plotjs-0.0.3/tests → plotjs-0.0.5/tests/test-python}/test_css_and_js_utils.py +30 -3
  66. plotjs-0.0.5/tests/test-python/test_magic_plot.py +145 -0
  67. {plotjs-0.0.3/tests → plotjs-0.0.5/tests/test-python}/test_main.py +4 -4
  68. plotjs-0.0.5/tests/test-python/test_other_utils.py +46 -0
  69. plotjs-0.0.5/vitest.config.js +9 -0
  70. plotjs-0.0.3/docs/guides/advanced/advanced.py +0 -2
  71. plotjs-0.0.3/docs/guides/advanced/index.md +0 -1
  72. plotjs-0.0.3/docs/guides/troubleshooting/index.md +0 -28
  73. plotjs-0.0.3/docs/iframes/CSS-2.html +0 -1514
  74. plotjs-0.0.3/docs/iframes/CSS.html +0 -1510
  75. plotjs-0.0.3/docs/iframes/quickstart4.html +0 -1193
  76. plotjs-0.0.3/docs/iframes/quickstart5.html +0 -1419
  77. plotjs-0.0.3/docs/reference/magic-plot.md +0 -1
  78. plotjs-0.0.3/docs/stylesheets/style.css +0 -52
  79. plotjs-0.0.3/plotjs/__init__.py +0 -6
  80. plotjs-0.0.3/plotjs/static/d3.min.js +0 -2
  81. plotjs-0.0.3/plotjs/static/main.js +0 -143
  82. plotjs-0.0.3/plotjs/static/template.html +0 -176
  83. plotjs-0.0.3/tests/test_magic_plot.py +0 -13
  84. {plotjs-0.0.3 → plotjs-0.0.5}/.gitattributes +0 -0
  85. {plotjs-0.0.3 → plotjs-0.0.5}/.github/workflows/doc.yaml +0 -0
  86. {plotjs-0.0.3 → plotjs-0.0.5}/.github/workflows/pypi.yaml +0 -0
  87. {plotjs-0.0.3 → plotjs-0.0.5}/LICENSE +0 -0
  88. {plotjs-0.0.3 → plotjs-0.0.5}/docs/gallery/index.qmd +0 -0
  89. {plotjs-0.0.3 → plotjs-0.0.5}/docs/img/how-it-works-1.png +0 -0
  90. {plotjs-0.0.3 → plotjs-0.0.5}/docs/img/how-it-works-2.png +0 -0
  91. {plotjs-0.0.3 → plotjs-0.0.5}/docs/index_files/figure-commonmark/cell-3-output-1.png +0 -0
  92. {plotjs-0.0.3 → plotjs-0.0.5}/docs/reference/css.md +0 -0
  93. {plotjs-0.0.3 → plotjs-0.0.5}/docs/reference/datasets.md +0 -0
  94. {plotjs-0.0.3 → plotjs-0.0.5}/docs/reference/javascript.md +0 -0
  95. {plotjs-0.0.3 → plotjs-0.0.5}/docs/static/style.css +0 -0
  96. {plotjs-0.0.3 → plotjs-0.0.5}/overrides/partials/footer.html +0 -0
  97. {plotjs-0.0.3 → plotjs-0.0.5}/plotjs/data/__init__.py +0 -0
  98. {plotjs-0.0.3 → plotjs-0.0.5}/plotjs/data/datasets.py +0 -0
  99. {plotjs-0.0.3 → plotjs-0.0.5}/plotjs/data/iris.csv +0 -0
  100. {plotjs-0.0.3 → plotjs-0.0.5}/plotjs/data/mtcars.csv +0 -0
  101. {plotjs-0.0.3 → plotjs-0.0.5}/plotjs/data/titanic.csv +0 -0
  102. {plotjs-0.0.3 → plotjs-0.0.5}/plotjs/static/default.css +0 -0
  103. {plotjs-0.0.3 → plotjs-0.0.5}/plotjs.egg-info/dependency_links.txt +0 -0
  104. {plotjs-0.0.3 → plotjs-0.0.5}/plotjs.egg-info/requires.txt +0 -0
  105. {plotjs-0.0.3 → plotjs-0.0.5}/plotjs.egg-info/top_level.txt +0 -0
  106. {plotjs-0.0.3 → plotjs-0.0.5}/setup.cfg +0 -0
  107. {plotjs-0.0.3/tests → plotjs-0.0.5/tests/test-python}/__init__.py +0 -0
  108. {plotjs-0.0.3/tests → plotjs-0.0.5/tests/test-python}/static/script.js +0 -0
  109. {plotjs-0.0.3/tests → plotjs-0.0.5/tests/test-python}/static/style.css +0 -0
  110. {plotjs-0.0.3/tests → plotjs-0.0.5/tests/test-python}/test_data.py +0 -0
Binary file
@@ -2,8 +2,9 @@ name: Check Code Formatting
2
2
 
3
3
  on:
4
4
  pull_request:
5
- branches:
6
- - main
5
+ branches: [main]
6
+ push:
7
+ branches: [main]
7
8
 
8
9
  jobs:
9
10
  check-formatting:
@@ -0,0 +1,18 @@
1
+ name: Tests JavaScript
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+ push:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: actions/setup-node@v4
15
+ with:
16
+ node-version: 20
17
+ - run: npm install
18
+ - run: npm test
@@ -1,8 +1,10 @@
1
- name: Unit tests
1
+ name: Tests Python
2
2
 
3
3
  on:
4
4
  pull_request:
5
5
  branches: [main]
6
+ push:
7
+ branches: [main]
6
8
 
7
9
  jobs:
8
10
  build:
@@ -2,8 +2,9 @@ name: Check Static Typing
2
2
 
3
3
  on:
4
4
  pull_request:
5
- branches:
6
- - main
5
+ branches: [main]
6
+ push:
7
+ branches: [main]
7
8
 
8
9
  jobs:
9
10
  check-formatting:
@@ -32,3 +32,5 @@ sandbox/
32
32
  scripts/release.sh
33
33
 
34
34
  /.quarto/
35
+
36
+ node_modules
@@ -13,7 +13,6 @@ repos:
13
13
  - id: check-yaml
14
14
  - id: trailing-whitespace
15
15
  - id: end-of-file-fixer
16
- - id: check-added-large-files
17
16
  - repo: https://github.com/python-jsonschema/check-jsonschema
18
17
  rev: 0.28.2
19
18
  hooks:
@@ -1,4 +1,4 @@
1
- .PHONY: all examples coverage
1
+ .PHONY: all examples gallery
2
2
 
3
3
  examples:
4
4
  quarto render docs/index.qmd
@@ -16,5 +16,12 @@ coverage:
16
16
  uv run genbadge coverage -i coverage.xml
17
17
  rm coverage.xml
18
18
 
19
+ preview:
20
+ uv run mkdocs serve
21
+
22
+ jsdoc:
23
+ npm run docs:js
24
+
19
25
  test:
20
- uv run pytest
26
+ uv run pytest # run python tests
27
+ npm test # run javascript tests
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotjs
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: Turn static matplotlib charts into interactive web visualizations
5
5
  Author-email: Joseph Barbier <joseph.barbierdarnal@mail.com>
6
6
  License-Expression: MIT
@@ -41,7 +41,7 @@ Dynamic: license-file
41
41
 
42
42
  ## Installation
43
43
 
44
- From PyPI:
44
+ From PyPI (recommended):
45
45
 
46
46
  ```
47
47
  pip install plotjs
@@ -19,7 +19,7 @@
19
19
 
20
20
  ## Installation
21
21
 
22
- From PyPI:
22
+ From PyPI (recommended):
23
23
 
24
24
  ```
25
25
  pip install plotjs
@@ -1 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="114" height="20" role="img" aria-label="coverage: 92.19%"><title>coverage: 92.19%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="114" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="53" height="20" fill="#4c1"/><rect width="114" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="315" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">coverage</text><text x="315" y="140" transform="scale(.1)" fill="#fff" textLength="510">coverage</text><text aria-hidden="true" x="865" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">92.19%</text><text x="865" y="140" transform="scale(.1)" fill="#fff" textLength="430">92.19%</text></g></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="114" height="20" role="img" aria-label="coverage: 93.92%"><title>coverage: 93.92%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="114" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="53" height="20" fill="#4c1"/><rect width="114" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="315" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">coverage</text><text x="315" y="140" transform="scale(.1)" fill="#fff" textLength="510">coverage</text><text aria-hidden="true" x="865" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">93.92%</text><text x="865" y="140" transform="scale(.1)" fill="#fff" textLength="430">93.92%</text></g></svg>
@@ -2,16 +2,22 @@
2
2
 
3
3
  The best way to help the development is to:
4
4
 
5
- - list the bugs you found by opening [GitHub issues](https://github.com/y-sunflower/plotjs/issues){target="_blank"}
6
- - list the features you'd like to see by opening [GitHub issues](https://github.com/y-sunflower/plotjs/issues){target="_blank"}
5
+ - list the bugs you found by opening [GitHub issues](https://github.com/y-sunflower/plotjs/issues){target="\_blank"}
6
+ - list the features you'd like to see by opening [GitHub issues](https://github.com/y-sunflower/plotjs/issues){target="\_blank"}
7
7
 
8
8
  ## Setting up your environment
9
9
 
10
+ You need to have the following installed on your machine:
11
+
12
+ - [uv](https://docs.astral.sh/uv/getting-started/installation/)
13
+ - [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
14
+ - [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
15
+
10
16
  ### Install for development
11
17
 
12
18
  - Fork the repository to your own GitHub account.
13
19
 
14
- - Clone your forked repository to your local machine (ensure you have [Git installed](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)):
20
+ - Clone your forked repository to your local machine:
15
21
 
16
22
  ```bash
17
23
  git clone https://github.com/github_user_name/plotjs.git
@@ -25,7 +31,7 @@ git remote add upstream https://github.com/y-sunflower/plotjs.git
25
31
  git checkout -b my-feature
26
32
  ```
27
33
 
28
- - Set up your Python environment (ensure you have [uv installed](https://docs.astral.sh/uv/getting-started/installation/)):
34
+ - Set up your Python environment:
29
35
 
30
36
  ```bash
31
37
  uv sync --all-groups --dev
@@ -33,6 +39,12 @@ uv run pre-commit install
33
39
  uv pip install -e .
34
40
  ```
35
41
 
42
+ - Install npm dependencies:
43
+
44
+ ```bash
45
+ npm install
46
+ ```
47
+
36
48
  ## Code
37
49
 
38
50
  You can now make changes to the package and start coding!
@@ -42,13 +54,13 @@ You can now make changes to the package and start coding!
42
54
  - Test that everything works correctly by running:
43
55
 
44
56
  ```bash
45
- uv run pytest
57
+ make test
46
58
  ```
47
59
 
48
60
  ### Preview documentation locally
49
61
 
50
62
  ```bash
51
- uv run mkdocs serve
63
+ make preview
52
64
  ```
53
65
 
54
66
  ## Push changes
@@ -0,0 +1,27 @@
1
+ The core idea behind `plotjs` is that since you can natively save a matplotlib plot as [SVG](https://developer.mozilla.org/en-US/docs/Web/SVG), it's possible to manipulate that SVG from the browser.
2
+
3
+ ![](../img/overview.png)
4
+
5
+ In practice, the saved HTML file from `plotjs` is just:
6
+
7
+ - the SVG output from matplotlib
8
+ - some CSS styling (default and from user)
9
+ - a parser for the SVG (in javascript) and javascript from user
10
+
11
+ ## Core issues
12
+
13
+ There are 2 things important things to solve at this point:
14
+
15
+ - communicate info from Python to JavaScript
16
+ - parse the SVG with JavaScript
17
+
18
+ The first point is important because the SVG file is not enough for us to parse it correctly. We need some info from the original matplotlib `Figure`. This is mainly solved using [`jinja2`](https://jinja.palletsprojects.com/en/stable/), often used in web development. This allows us to pass variables from Python to an HTML template (e.g., simple HTML file with placeholders that we'll fill). The core things we want to pass are:
19
+
20
+ - the SVG of the plot
21
+ - the JavaScript parser (kept in its own js file)
22
+ - additional CSS/JS from the user
23
+ - a dictionnary with custom info (named `plot_data_json` in the codebase)
24
+
25
+ `plot_data_json` is passed directly to JavaScript and is then parsed with `JSON.parse()`. This works because Python dictionnaries can be (assuming a few rules that we respect here) valid JSON and be considered as such.
26
+
27
+ Then we "just" have to parse the SVG and apply the effects the user want: hover, onclick effects, etc. You can learn more about how the SVG is parsed [here](./parsing-matplotlib-svg.md).
@@ -21,7 +21,7 @@ But it means we don't have full control over how the plot is structured (from th
21
21
  For the moment, we just take the user's matplotlib figure and save it as SVG. This is just:
22
22
 
23
23
  ```python
24
- fig.savefig("plot.svg")
24
+ plt.savefig("plot.svg")
25
25
  ```
26
26
 
27
27
  Now, let's say the figure contains a scatter plot and we want to add a tooltip: when someone hovers their mouse over a point, it displays a label.
@@ -156,3 +156,7 @@ The idea is basically:
156
156
  This gives us a `lines` variable that only contains the lines of interest!
157
157
 
158
158
  The logic is the same for other plot elements: bars, points, polygons, etc.
159
+
160
+ <br>
161
+
162
+ You can find the **reference page** of the parser [here](./svg-parser-reference.md)
@@ -0,0 +1,117 @@
1
+ ## Functions
2
+
3
+ <dl>
4
+ <dt><a href="#findBars">findBars(svg, axes_class)</a> ⇒ <code>d3.Selection</code></dt>
5
+ <dd><p>Find bar elements (<code>patch</code> groups with clipping) inside a given axes.</p>
6
+ </dd>
7
+ <dt><a href="#findPoints">findPoints(svg, axes_class, tooltip_groups)</a> ⇒ <code>d3.Selection</code></dt>
8
+ <dd><p>Find scatter plot points inside a given axes.
9
+ Handles both <code>&lt;use&gt;</code> and <code>&lt;path&gt;</code> fallback cases,
10
+ and assigns <code>data-group</code> attributes based on tooltip groups.</p>
11
+ </dd>
12
+ <dt><a href="#findLines">findLines(svg, axes_class)</a> ⇒ <code>d3.Selection</code></dt>
13
+ <dd><p>Find line elements (<code>line2d</code> paths) inside a given axes,
14
+ excluding axis grid lines.</p>
15
+ </dd>
16
+ <dt><a href="#findAreas">findAreas(svg, axes_class)</a> ⇒ <code>d3.Selection</code></dt>
17
+ <dd><p>Find filled area elements (<code>FillBetweenPolyCollection</code> paths) inside a given axes.</p>
18
+ </dd>
19
+ <dt><a href="#nearestElementFromMouse">nearestElementFromMouse(mouseX, mouseY, elements)</a> ⇒ <code>Element</code> | <code>null</code></dt>
20
+ <dd><p>Compute the nearest element to the mouse cursor from a set of elements.
21
+ Uses bounding box centers for distance.
22
+ This function is used when the <code>hover_nearest</code> argument is true.</p>
23
+ </dd>
24
+ <dt><a href="#setHoverEffect">setHoverEffect(plot_element, axes_class, tooltip_labels, tooltip_groups, show_tooltip, hover_nearest)</a></dt>
25
+ <dd><p>Attach hover interaction and tooltip display to plot elements.
26
+ Can highlight nearest element (if enabled) or hovered element directly.</p>
27
+ </dd>
28
+ </dl>
29
+
30
+ <a name="findBars"></a>
31
+
32
+ ## findBars(svg, axes_class) ⇒ <code>d3.Selection</code>
33
+ Find bar elements (`patch` groups with clipping) inside a given axes.
34
+
35
+ **Kind**: global function
36
+ **Returns**: <code>d3.Selection</code> - D3 selection of bar elements.
37
+
38
+ | Param | Type | Description |
39
+ | --- | --- | --- |
40
+ | svg | <code>d3.Selection</code> | D3 selection of the SVG element. |
41
+ | axes_class | <code>string</code> | ID of the axes group (e.g. "axes_1"). |
42
+
43
+ <a name="findPoints"></a>
44
+
45
+ ## findPoints(svg, axes_class, tooltip_groups) ⇒ <code>d3.Selection</code>
46
+ Find scatter plot points inside a given axes.
47
+ Handles both `<use>` and `<path>` fallback cases,
48
+ and assigns `data-group` attributes based on tooltip groups.
49
+
50
+ **Kind**: global function
51
+ **Returns**: <code>d3.Selection</code> - D3 selection of point elements.
52
+
53
+ | Param | Type | Description |
54
+ | --- | --- | --- |
55
+ | svg | <code>d3.Selection</code> | D3 selection of the SVG element. |
56
+ | axes_class | <code>string</code> | ID of the axes group (e.g. "axes_1"). |
57
+ | tooltip_groups | <code>Array.&lt;string&gt;</code> | Group identifiers for tooltips, parallel to points. |
58
+
59
+ <a name="findLines"></a>
60
+
61
+ ## findLines(svg, axes_class) ⇒ <code>d3.Selection</code>
62
+ Find line elements (`line2d` paths) inside a given axes,
63
+ excluding axis grid lines.
64
+
65
+ **Kind**: global function
66
+ **Returns**: <code>d3.Selection</code> - D3 selection of line elements.
67
+
68
+ | Param | Type | Description |
69
+ | --- | --- | --- |
70
+ | svg | <code>d3.Selection</code> | D3 selection of the SVG element. |
71
+ | axes_class | <code>string</code> | ID of the axes group. |
72
+
73
+ <a name="findAreas"></a>
74
+
75
+ ## findAreas(svg, axes_class) ⇒ <code>d3.Selection</code>
76
+ Find filled area elements (`FillBetweenPolyCollection` paths) inside a given axes.
77
+
78
+ **Kind**: global function
79
+ **Returns**: <code>d3.Selection</code> - D3 selection of area elements.
80
+
81
+ | Param | Type | Description |
82
+ | --- | --- | --- |
83
+ | svg | <code>d3.Selection</code> | D3 selection of the SVG element. |
84
+ | axes_class | <code>string</code> | ID of the axes group. |
85
+
86
+ <a name="nearestElementFromMouse"></a>
87
+
88
+ ## nearestElementFromMouse(mouseX, mouseY, elements) ⇒ <code>Element</code> \| <code>null</code>
89
+ Compute the nearest element to the mouse cursor from a set of elements.
90
+ Uses bounding box centers for distance.
91
+ This function is used when the `hover_nearest` argument is true.
92
+
93
+ **Kind**: global function
94
+ **Returns**: <code>Element</code> \| <code>null</code> - The nearest DOM element or `null`.
95
+
96
+ | Param | Type | Description |
97
+ | --- | --- | --- |
98
+ | mouseX | <code>number</code> | X coordinate of the mouse relative to SVG. |
99
+ | mouseY | <code>number</code> | Y coordinate of the mouse relative to SVG. |
100
+ | elements | <code>d3.Selection</code> | Selection of candidate elements. |
101
+
102
+ <a name="setHoverEffect"></a>
103
+
104
+ ## setHoverEffect(plot_element, axes_class, tooltip_labels, tooltip_groups, show_tooltip, hover_nearest)
105
+ Attach hover interaction and tooltip display to plot elements.
106
+ Can highlight nearest element (if enabled) or hovered element directly.
107
+
108
+ **Kind**: global function
109
+
110
+ | Param | Type | Description |
111
+ | --- | --- | --- |
112
+ | plot_element | <code>d3.Selection</code> | Selection of plot elements (points, lines, etc.). |
113
+ | axes_class | <code>string</code> | ID of the axes group. |
114
+ | tooltip_labels | <code>Array.&lt;string&gt;</code> | Tooltip labels for each element. |
115
+ | tooltip_groups | <code>Array.&lt;string&gt;</code> | Group identifiers for each element. |
116
+ | show_tooltip | <code>&quot;block&quot;</code> \| <code>&quot;none&quot;</code> | Whether to display tooltips. |
117
+ | hover_nearest | <code>boolean</code> | If true, highlight nearest element instead of hovered one. |
@@ -18,11 +18,11 @@ This page contains all the `plotjs` examples from this website.
18
18
 
19
19
  <div style="display: flex;">
20
20
 
21
- <iframe width="100%" height="300" src="../iframes/quickstart4.html" style="flex: 1; border: none;">
21
+ <iframe width="100%" height="300" src="../iframes/area-natural-disasters.html" style="flex: 1; border: none;">
22
22
 
23
23
  </iframe>
24
24
 
25
- <iframe width="100%" height="300" src="../iframes/quickstart5.html" style="flex: 1; border: none;">
25
+ <iframe width="100%" height="300" src="../iframes/quickstart4.html" style="flex: 1; border: none;">
26
26
 
27
27
  </iframe>
28
28
 
@@ -30,11 +30,11 @@ This page contains all the `plotjs` examples from this website.
30
30
 
31
31
  <div style="display: flex;">
32
32
 
33
- <iframe width="100%" height="300" src="../iframes/quickstart9.html" style="flex: 1; border: none;">
33
+ <iframe width="100%" height="300" src="../iframes/quickstart5.html" style="flex: 1; border: none;">
34
34
 
35
35
  </iframe>
36
36
 
37
- <iframe width="100%" height="300" src="../iframes/CSS.html" style="flex: 1; border: none;">
37
+ <iframe width="100%" height="300" src="../iframes/quickstart9.html" style="flex: 1; border: none;">
38
38
 
39
39
  </iframe>
40
40
 
@@ -42,19 +42,43 @@ This page contains all the `plotjs` examples from this website.
42
42
 
43
43
  <div style="display: flex;">
44
44
 
45
+ <iframe width="100%" height="300" src="../iframes/CSS.html" style="flex: 1; border: none;">
46
+
47
+ </iframe>
48
+
45
49
  <iframe width="100%" height="300" src="../iframes/quickstart2.html" style="flex: 1; border: none;">
46
50
 
47
51
  </iframe>
48
52
 
53
+ </div>
54
+
55
+ <div style="display: flex;">
56
+
49
57
  <iframe width="100%" height="300" src="../iframes/javascript.html" style="flex: 1; border: none;">
50
58
 
51
59
  </iframe>
52
60
 
61
+ <iframe width="100%" height="300" src="../iframes/quickstart3.html" style="flex: 1; border: none;">
62
+
63
+ </iframe>
64
+
53
65
  </div>
54
66
 
55
67
  <div style="display: flex;">
56
68
 
57
- <iframe width="100%" height="300" src="../iframes/quickstart3.html" style="flex: 1; border: none;">
69
+ <iframe width="100%" height="300" src="../iframes/quickstart10.html" style="flex: 1; border: none;">
70
+
71
+ </iframe>
72
+
73
+ <iframe width="100%" height="300" src="../iframes/quickstart11.html" style="flex: 1; border: none;">
74
+
75
+ </iframe>
76
+
77
+ </div>
78
+
79
+ <div style="display: flex;">
80
+
81
+ <iframe width="100%" height="300" src="../iframes/random-walk-1.html" style="flex: 1; border: none;">
58
82
 
59
83
  </iframe>
60
84
 
@@ -66,11 +90,11 @@ This page contains all the `plotjs` examples from this website.
66
90
 
67
91
  <div style="display: flex;">
68
92
 
69
- <iframe width="100%" height="300" src="../iframes/CSS-2.html" style="flex: 1; border: none;">
93
+ <iframe width="100%" height="300" src="../iframes/bug.html" style="flex: 1; border: none;">
70
94
 
71
95
  </iframe>
72
96
 
73
- <iframe width="100%" height="300" src="../iframes/quickstart6.html" style="flex: 1; border: none;">
97
+ <iframe width="100%" height="300" src="../iframes/CSS-2.html" style="flex: 1; border: none;">
74
98
 
75
99
  </iframe>
76
100
 
@@ -78,6 +102,10 @@ This page contains all the `plotjs` examples from this website.
78
102
 
79
103
  <div style="display: flex;">
80
104
 
105
+ <iframe width="100%" height="300" src="../iframes/quickstart6.html" style="flex: 1; border: none;">
106
+
107
+ </iframe>
108
+
81
109
  <iframe width="100%" height="300" src="../iframes/quickstart7.html" style="flex: 1; border: none;">
82
110
 
83
111
  </iframe>