Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PlotlyJS #2

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e33f9c1
Add PlotlyJS in TestPlotlyJS module
beorostica Dec 29, 2023
b55d919
Add `using PlotlyJS` in tests
beorostica Dec 29, 2023
1fddf91
Avoid precompilation of TestPlotlyJS module
beorostica Dec 29, 2023
40efb99
Add dev PlotlyJS from tag 0.18.11
beorostica Dec 29, 2023
45134c7
Add simple log messages in _start_kaleido_process()
beorostica Dec 29, 2023
a400400
Add more log messages to _start_kaleido_process()
beorostica Dec 29, 2023
fde9df9
Disable the Kaliedo process check
beorostica Dec 29, 2023
3f00afa
Define the `P` global variable as non-constant
beorostica Dec 29, 2023
c456809
Set Kaleido compat to 0.1
beorostica Jan 2, 2024
59a09be
Use last version of kaleido
beorostica Jan 2, 2024
cb33aaf
Add keyword `keep=true` to `readline` function
beorostica Jan 2, 2024
cf57df8
Use `readavailable` instead of `readline`
beorostica Jan 3, 2024
106b37e
Use `readuntil` instead of `readline`
beorostica Jan 3, 2024
93447f9
Use `readuntil` instead of `readline` again
beorostica Jan 3, 2024
d557a53
Print `stderror` in `_start_kaleido_process`
beorostica Jan 3, 2024
9bab74a
Use `readavailable` for `stdout`
beorostica Jan 3, 2024
b785cd6
Use `readavailable` for `stdout` again
beorostica Jan 3, 2024
370528a
Use `readavailable` for `stdout` again
beorostica Jan 3, 2024
4f1e95f
Add a sleep() after running kaleido process
beorostica Jan 3, 2024
4d76699
Add a sleep(30)
beorostica Jan 3, 2024
76400f2
Run kaliedo without using `pipeline`
beorostica Jan 3, 2024
4d1bf1a
Use `PipeEndpoint` instead of `Pipe`
beorostica Jan 3, 2024
8a25897
Use `readuntil` instead of `readline`
beorostica Jan 3, 2024
f678020
Use Kaleido_jll version 0.1
beorostica Jan 3, 2024
d93753a
Do not use PlotlyJS subdir package
beorostica Jan 3, 2024
0250d96
Add precompilation to module TestPlotlyJS
beorostica Jan 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions PlotlyJS/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/julia
// See https://github.com/julia-vscode/julia-devcontainer/blob/master/Dockerfile for image contents
{
"name": "Julia (Community)",
"image": "ghcr.io/julia-vscode/julia-devcontainer",
"extensions": ["julialang.language-julia"],
"postCreateCommand": "/julia-devcontainer-scripts/postcreate.jl",
"remoteUser": "vscode"
}
1 change: 1 addition & 0 deletions PlotlyJS/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.bundle.js binary
18 changes: 18 additions & 0 deletions PlotlyJS/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
*.jl.cov
*.jl.*.cov
*.jl.mem
.vscode/
tags/
tags
site/
.ipynb_checkpoints/
assets/plotly-latest.min.js
deps/plotly-latest.min.js
deps/plotschema.json
deps/schema.html
deps/*.csv
assets/node_modules/
assets/package-lock.json
deps/build.log
Manifest.toml
.DS_Store
24 changes: 24 additions & 0 deletions PlotlyJS/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Documentation: http://docs.travis-ci.com/user/languages/julia/
language: julia
sudo: required
os:
- linux
julia:
- 1.3
- 1.4
- 1.5
- nightly
matrix:
allow_failures:
- julia: nightly
addons:
apt:
packages:
- xvfb
- xauth
- libgtk-3-0
notifications:
email: false
# uncomment the following lines to override the default test script
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
6 changes: 6 additions & 0 deletions PlotlyJS/Artifacts.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[plotly-artifacts]
git-tree-sha1 = "77a3f27e7a726685591b11ef3174d43a9a974c9a"

[[plotly-artifacts.download]]
sha256 = "3b753911705e17ec01d565fa69b5cf08e01b772efed8f4f6e506a0ebea2c6354"
url = "https://github.com/JuliaPlots/PlotlyJS.jl/releases/download/plotly-artifacts-2.3.0/plotly-artifacts-2.3.0.tar.gz"
664 changes: 664 additions & 0 deletions PlotlyJS/CHANGELOG.md

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions PlotlyJS/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The Plotly.jl package is licensed under the MIT "Expat" License:

> Copyright (c) 2015: Spencer Lyon.
>
> Permission is hereby granted, free of charge, to any person obtaining
> a copy of this software and associated documentation files (the
> "Software"), to deal in the Software without restriction, including
> without limitation the rights to use, copy, modify, merge, publish,
> distribute, sublicense, and/or sell copies of the Software, and to
> permit persons to whom the Software is furnished to do so, subject to
> the following conditions:
>
> The above copyright notice and this permission notice shall be
> included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 changes: 35 additions & 0 deletions PlotlyJS/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name = "PlotlyJS"
uuid = "f0f68f2c-4968-5e81-91da-67840de0976a"
authors = ["Spencer Lyon <[email protected]>"]
version = "0.18.11"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Blink = "ad839575-38b3-5650-b840-f874b8c74a25"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
JSExpr = "97c1335a-c9c5-57fe-bc5d-ec35cebe8660"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Kaleido_jll = "f7e6163d-2fa5-5f23-b69c-1db539e41963"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
WebIO = "0f1e0344-ec1d-5b48-a673-e5cf874b6c29"

[compat]
Blink = "0.12"
JSExpr = "0.5, 1"
JSON = "0.20, 0.21"
PlotlyBase = "0.8.15"
Reexport = "0.2, 1"
Requires = "1.0"
WebIO = "0.8"
julia = "1.3, 1.4, 1.5, 1.6"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
31 changes: 31 additions & 0 deletions PlotlyJS/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# PlotlyJS

[_plotlyjs]: https://plot.ly/javascript

[docs-img]: https://img.shields.io/badge/docs-stable-blue.svg
[docs-url]: http://juliaplots.org/PlotlyJS.jl/stable

[![][docs-img]][docs-url]
[![Build Status](https://github.com/JuliaPlots/PlotlyJS.jl/actions/workflows/ci-master-workflow.yml/badge.svg)](https://github.com/JuliaPlots/PlotlyJS.jl/actions/workflows/ci-master-workflow.yml)
[![project chat](https://img.shields.io/badge/zulip-join_chat-brightgreen.svg)](https://julialang.zulipchat.com/#narrow/stream/227176-plotting)

Julia interface to [plotly.js][_plotlyjs] visualization library.

This package constructs plotly graphics using all local resources. To interact or save graphics to the Plotly cloud, use the [`Plotly`](https://github.com/plotly/Plotly.jl) package.

## Installation

If you have issues building this package because of installation of the MbedTLS package please see [this issue](https://github.com/sglyon/PlotlyJS.jl/issues/83).

### Jupyterlab

If you will be using this package from within Jupyterlab, please also install the plotly jupyterlab extension by running:


```sh
jupyter labextension install jupyterlab-plotly
```

See the [jupyterlab extension documentation](https://jupyterlab.readthedocs.io/en/stable/user/extensions.html) for more details.


41 changes: 41 additions & 0 deletions PlotlyJS/appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
matrix:
allow_failures:
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"

branches:
only:
- master
- /release-.*/

notifications:
- provider: Email
on_build_success: false
on_build_failure: false
on_build_status_changed: false

install:
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
# Download most recent Julia Windows binary
- ps: (new-object net.webclient).DownloadFile(
$env:JULIA_URL,
"C:\projects\julia-binary.exe")
# Run installer silently, output to C:\projects\julia
- C:\projects\julia-binary.exe /S /D=C:\projects\julia

build_script:
# Need to convert from shallow to complete for Pkg.clone to work
- IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -e "versioninfo();
Pkg.clone(pwd(), \"Plotly\"); Pkg.build(\"Plotly\")"

test_script:
- C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"Plotly\")"
70 changes: 70 additions & 0 deletions PlotlyJS/assets/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import {contains, filter, has, isNil, type} from 'ramda';

export const PlotlyCommands = {
filterEventData: function(gd, eventData, event) {
let filteredEventData;
if (contains(event, ['click', 'hover', 'selected'])) {
const points = [];

if (isNil(eventData)) {
return null;
}

/*
* remove `data`, `layout`, `xaxis`, etc
* objects from the event data since they're so big
* and cause JSON stringify ciricular structure errors.
*
* also, pull down the `customdata` point from the data array
* into the event object
*/
const data = gd.data;

for(let i=0; i < eventData.points.length; i++) {
const fullPoint = eventData.points[i];
const pointData = filter(function(o) {
return !contains(type(o), ['Object', 'Array'])
}, fullPoint);
if (has('curveNumber', fullPoint) &&
has('pointNumber', fullPoint) &&
has('customdata', data[pointData.curveNumber])
) {
pointData['customdata'] = data[
pointData.curveNumber
].customdata[fullPoint.pointNumber];
}

// specific to histogram. see https://github.com/plotly/plotly.js/pull/2113/
if (has('pointNumbers', fullPoint)) {
pointData.pointNumbers = fullPoint.pointNumbers;
}

points[i] = pointData;

}
filteredEventData = {points}
} else if (event === 'relayout') {
/*
* relayout shouldn't include any big objects
* it will usually just contain the ranges of the axes like
* "xaxis.range[0]": 0.7715822247381828,
* "xaxis.range[1]": 3.0095292008680063`
*/
filteredEventData = eventData;
}
if (has('range', eventData)) {
filteredEventData.range = eventData.range;
}
if (has('lassoPoints', eventData)) {
filteredEventData.lassoPoints = eventData.lassoPoints;
}
return {
out: filteredEventData,
isnil: isNil(filteredEventData)
};
}
};

export function init(WebIO) {
WebIO.PlotlyCommands = PlotlyCommands;
}
23 changes: 23 additions & 0 deletions PlotlyJS/assets/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "assets",
"version": "1.0.0",
"description": "WebIO.jl support for plotly",
"main": "index.js",
"dependencies": {
"ramda": "^0.24.1"
},
"devDependencies": {
"clean-webpack-plugin": "^0.1.19",
"webpack": "^4.17.1",
"webpack-cli": "^3.1.0",
"webpack-merge": "^4.1.4"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack-dev-server --open --config webpack.dev.js",
"build": "webpack --config webpack.prod.js"
},
"keywords": [],
"author": "Spencer Lyon",
"license": "MIT"
}
1 change: 1 addition & 0 deletions PlotlyJS/assets/plotly_webio.bundle.js

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions PlotlyJS/assets/webpack.common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');

module.exports = {
entry: {
app: './index.js'
},
plugins: [
new CleanWebpackPlugin(['dist'])
],
output: {
filename: 'plotly_webio.bundle.js',
path: path.resolve(__dirname),
libraryTarget: 'umd',
}
};
10 changes: 10 additions & 0 deletions PlotlyJS/assets/webpack.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const merge = require('webpack-merge');
const common = require('./webpack.common.js');

module.exports = merge(common, {
mode: 'development',
devtool: 'inline-source-map',
devServer: {
contentBase: './dist'
}
});
6 changes: 6 additions & 0 deletions PlotlyJS/assets/webpack.prod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const merge = require('webpack-merge');
const common = require('./webpack.common.js');

module.exports = merge(common, {
mode: 'production',
});
Loading