-
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #208 from sglyon/sl/0.7
WIP: Sl/0.7
- Loading branch information
Showing
26 changed files
with
522 additions
and
1,115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
julia 0.7 | ||
JSON 0.7 | ||
Blink 0.3.3 | ||
DocStringExtensions | ||
Blink 0.8 | ||
Requires | ||
PlotlyBase 0.1.2 | ||
PlotlyBase | ||
Reexport 0.2.0 | ||
Compat 0.69 | ||
WebIO | ||
JSExpr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import {contains, filter, has, isNil, type} from 'ramda'; | ||
|
||
|
||
WebIO.CommandSets.Plotly = { | ||
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) | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
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) | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.