Skip to content

Scatterpolargl #2230

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

Closed
wants to merge 72 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
58d53e8
move (old) polar code to legacy/ folder
etpinard Nov 20, 2017
853581e
introduce scatterpolar attributes
etpinard Dec 11, 2017
3c8ae5b
introduce polar subplot attributes
etpinard Dec 11, 2017
ca8081b
introduce angles helper module
etpinard Dec 11, 2017
46fe066
first cut polar subplot defaults and draw routines
etpinard Dec 11, 2017
0826ee7
first cut scatterpolar calc/defaults/plot/style/hover
etpinard Dec 11, 2017
9770f2c
misc things to get scatterpolar traces to show up
etpinard Dec 11, 2017
0b85af2
init categories stashes for polar axes
etpinard Dec 11, 2017
cbf19c1
allow ticksuffix dflt to be passed via option
etpinard Dec 11, 2017
86204a6
get polar axis updates to work
etpinard Dec 11, 2017
0027f53
add legacy deprecation warnings
etpinard Dec 11, 2017
4cdc301
remove obsolete check for polar in registry
etpinard Dec 11, 2017
a5a719c
get snapshot redraw function right for (new) polar
etpinard Dec 11, 2017
da720aa
improve scatterpolar hover
etpinard Dec 11, 2017
04a886b
use subplot ref in scatterternary hover pointData
etpinard Dec 11, 2017
22cf4ba
expose a few things out of cartesian dragbox for :recycle:
etpinard Dec 11, 2017
122dd0b
uber wip polar main drag interaction
etpinard Dec 11, 2017
689414c
add radial axis drag interactions
etpinard Dec 11, 2017
543b615
first cut polar mocks!
etpinard Dec 11, 2017
b64928d
regl-ify scattergl by dfcreative
etpinard Dec 12, 2017
963d3fd
Merge branch 'polar' into scatterpolargl
etpinard Dec 12, 2017
1701284
first steps for scatterpolargl
etpinard Dec 12, 2017
46c58a9
Refactor scattergl to allow for scatterpolargl extension
dy Dec 13, 2017
aa2ed4f
Make basic scatterpolargl trace
dy Dec 14, 2017
ef5fa9e
Fix polargl hover
dy Dec 14, 2017
54b3f1c
Merge branch 'master' into polar
etpinard Dec 15, 2017
17503cb
make scatter{ternary,polar,carpet} Scatter.style reuse straight-up
etpinard Dec 14, 2017
7b0f718
add test for commit 86204a6 (ternary ax tickfont relayouts)
etpinard Dec 14, 2017
fbea869
:palm_tree: domain attributes
etpinard Dec 14, 2017
1e769f0
make non-zero radialaxis.range[0] work
etpinard Dec 14, 2017
f53495e
make radial/angular axis visible: false cases work
etpinard Dec 14, 2017
c5a3a72
1st pass isPtWithinSector algo
etpinard Dec 15, 2017
c452918
Merge remote-tracking branch 'origin/polar' into scatterpolargl
dy Dec 15, 2017
e8276ac
Filter points by range
dy Dec 15, 2017
a8532fa
Bump regl-scatter2d
dy Dec 15, 2017
61e155c
warn -> log for polar deprecation
etpinard Dec 15, 2017
5e874fb
Make toSVG
dy Dec 15, 2017
dd4c3d2
Bump regl-scatter2d
dy Dec 15, 2017
6991e75
Fix gotchas
dy Dec 15, 2017
0de4230
bundle for demo
etpinard Dec 15, 2017
59f3fe7
Replace filtering with discarding
dy Dec 15, 2017
e35e3de
Fix losing data on update
dy Dec 15, 2017
d9723d0
Fix radians thetaunits
dy Dec 15, 2017
5cd24e6
bundle 2 for demo
etpinard Dec 15, 2017
1b077f3
warn -> log for polar deprecation
etpinard Dec 15, 2017
258600d
:hocho: special polygon logic from scatterpolar/plot
etpinard Dec 18, 2017
0a41da5
implement {angular,radial}axis.layer
etpinard Dec 18, 2017
f3a2379
:palm_tree: make filter-visible work for calcdata containers
etpinard Dec 19, 2017
3f5e77b
first cut radial axis drag intractions
etpinard Dec 19, 2017
65b717d
get `polar.sector` working on category angular axes
etpinard Dec 19, 2017
13568a3
fixup isPtWithinSector
etpinard Dec 20, 2017
797fec1
add support for 'log' radial axes
etpinard Dec 20, 2017
0a9278c
fixup axis autotype logic for visible: false traces
etpinard Dec 22, 2017
07a3af7
make sure that angular setting relayout call propagate to tick labels
etpinard Dec 22, 2017
a263c1c
solid zoombox try + some pan work and radial drag fixups
etpinard Dec 22, 2017
356c1c5
[wip] some scatterpolar hover label tests
etpinard Dec 22, 2017
7c0dccc
Merge branch 'polar', remote-tracking branch 'origin' into scatterpol…
etpinard Dec 22, 2017
a695ac6
bundle for demo 2
etpinard Dec 22, 2017
883a30a
add scatterpolargl mock
etpinard Dec 22, 2017
c8c190e
fixup log radial range
etpinard Dec 23, 2017
45eced7
pretty solid zoom/pan interactions
etpinard Dec 23, 2017
f772132
Fix gl2d_click_test
dy Jan 3, 2018
783c617
Fix gl_plot_interact tests
dy Jan 3, 2018
268d3b1
Attempt to fix gl_plot_interact test
dy Jan 3, 2018
ad5ca91
Add gl2d_fonts baseline
dy Jan 3, 2018
2988d18
Adjust test params
dy Jan 3, 2018
02e2554
Merge branch 'master' into scatterpolargl
dy Jan 3, 2018
95b2db1
Make polar selection reflect panning
dy Jan 4, 2018
bfeb39d
Fix polargl selection + pan
dy Jan 4, 2018
8133552
Lintify
dy Jan 4, 2018
61076ce
Handle multiple subplots selection properly
dy Jan 5, 2018
320c4c9
Fix single-color open markers
dy Jan 11, 2018
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
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ dist
build

test/jasmine/assets/jquery-1.8.3.min.js
src/plots/polar/micropolar.js
src/plots/polar/legacy/micropolar.js
75 changes: 1 addition & 74 deletions dist/plotly.min.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ Plotly.register([
require('./contourcarpet'),

require('./ohlc'),
require('./candlestick')
require('./candlestick'),

require('./scatterpolar'),
require('./scatterpolargl')
]);

// transforms
Expand Down
11 changes: 11 additions & 0 deletions lib/scatterpolar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Copyright 2012-2017, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

module.exports = require('../src/traces/scatterpolar');
11 changes: 11 additions & 0 deletions lib/scatterpolargl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Copyright 2012-2017, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

module.exports = require('../src/traces/scatterpolargl');
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@
"3d-view": "^2.0.0",
"@plotly/d3-sankey": "^0.5.0",
"alpha-shape": "^1.0.0",
"color-rgba": "^1.1.1",
"bubleify": "^1.0.0",
"canvas-fit": "^1.5.0",
"color-normalize": "^1.0.2",
"color-rgba": "^2.0.0",
"convex-hull": "^1.0.3",
"country-regex": "^1.1.0",
"d3": "^3.5.12",
Expand Down Expand Up @@ -85,6 +88,7 @@
"gl-spikes2d": "^1.0.1",
"gl-surface3d": "^1.3.1",
"has-hover": "^1.0.1",
"kdgrass": "^1.0.1",
"mapbox-gl": "^0.22.0",
"matrix-camera-controller": "^2.1.3",
"minify-stream": "^1.1.0",
Expand All @@ -97,11 +101,15 @@
"ndarray-ops": "^1.2.2",
"polybooljs": "^1.2.0",
"regl": "^1.3.0",
"regl-error2d": "^2.0.3",
"regl-line2d": "^2.1.0",
"regl-scatter2d": "^2.1.9",
"right-now": "^1.0.0",
"robust-orientation": "^1.1.3",
"sane-topojson": "^2.0.0",
"strongly-connected-components": "^1.0.1",
"superscript-text": "^1.0.0",
"svg-path-sdf": "^1.1.1",
"tinycolor2": "^1.3.0",
"topojson-client": "^2.1.0",
"webgl-context": "^2.2.0",
Expand Down
4 changes: 4 additions & 0 deletions src/components/calendars/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ module.exports = {
// from yaxis if they only apply to x (rangeselector/rangeslider)
yaxis: {calendar: axisAttrs},
zaxis: {calendar: axisAttrs}
},
polar: {
radialaxis: {calendar: axisAttrs},
angularaxis: {calendar: axisAttrs}
}
},
transforms: {
Expand Down
4 changes: 4 additions & 0 deletions src/components/drawing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ drawing.symbolNames = [];
drawing.symbolFuncs = [];
drawing.symbolNeedLines = {};
drawing.symbolNoDot = {};
drawing.symbolNoFill = {};
drawing.symbolList = [];

Object.keys(SYMBOLDEFS).forEach(function(k) {
Expand All @@ -231,6 +232,9 @@ Object.keys(SYMBOLDEFS).forEach(function(k) {
drawing.symbolList = drawing.symbolList.concat(
[symDef.n + 200, k + '-dot', symDef.n + 300, k + '-open-dot']);
}
if(symDef.noFill) {
drawing.symbolNoFill[symDef.n] = true;
}
});
var MAXSYMBOL = drawing.symbolNames.length,
// add a dot in the middle of the symbol
Expand Down
36 changes: 24 additions & 12 deletions src/components/drawing/symbol_defs.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ module.exports = {
return 'M0,' + rc + 'V-' + rc + 'M' + rc + ',0H-' + rc;
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
'x-thin': {
n: 34,
Expand All @@ -365,7 +366,8 @@ module.exports = {
'M' + rx + ',-' + rx + 'L-' + rx + ',' + rx;
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
asterisk: {
n: 35,
Expand All @@ -377,7 +379,8 @@ module.exports = {
'M' + rs + ',-' + rs + 'L-' + rs + ',' + rs;
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
hash: {
n: 36,
Expand All @@ -389,7 +392,8 @@ module.exports = {
'M' + r2 + ',' + r1 + 'H-' + r2 +
'm0,-' + r2 + 'H' + r2;
},
needLine: true
needLine: true,
noFill: true
},
'y-up': {
n: 37,
Expand All @@ -400,7 +404,8 @@ module.exports = {
return 'M-' + x + ',' + y1 + 'L0,0M' + x + ',' + y1 + 'L0,0M0,-' + y0 + 'L0,0';
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
'y-down': {
n: 38,
Expand All @@ -411,7 +416,8 @@ module.exports = {
return 'M-' + x + ',-' + y1 + 'L0,0M' + x + ',-' + y1 + 'L0,0M0,' + y0 + 'L0,0';
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
'y-left': {
n: 39,
Expand All @@ -422,7 +428,8 @@ module.exports = {
return 'M' + x1 + ',' + y + 'L0,0M' + x1 + ',-' + y + 'L0,0M-' + x0 + ',0L0,0';
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
'y-right': {
n: 40,
Expand All @@ -433,7 +440,8 @@ module.exports = {
return 'M-' + x1 + ',' + y + 'L0,0M-' + x1 + ',-' + y + 'L0,0M' + x0 + ',0L0,0';
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
'line-ew': {
n: 41,
Expand All @@ -442,7 +450,8 @@ module.exports = {
return 'M' + rc + ',0H-' + rc;
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
'line-ns': {
n: 42,
Expand All @@ -451,7 +460,8 @@ module.exports = {
return 'M0,' + rc + 'V-' + rc;
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
'line-ne': {
n: 43,
Expand All @@ -460,7 +470,8 @@ module.exports = {
return 'M' + rx + ',-' + rx + 'L-' + rx + ',' + rx;
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
'line-nw': {
n: 44,
Expand All @@ -469,6 +480,7 @@ module.exports = {
return 'M' + rx + ',' + rx + 'L-' + rx + ',-' + rx;
},
needLine: true,
noDot: true
noDot: true,
noFill: true
}
};
5 changes: 3 additions & 2 deletions src/components/fx/hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ function createHoverText(hoverData, opts, gd) {
var i, traceHoverinfo;
for(i = 0; i < hoverData.length; i++) {
traceHoverinfo = hoverData[i].hoverinfo || hoverData[i].trace.hoverinfo;
var parts = traceHoverinfo.split('+');
var parts = Array.isArray(traceHoverinfo) ? traceHoverinfo : traceHoverinfo.split('+');
if(parts.indexOf('all') === -1 &&
parts.indexOf(hovermode) === -1) {
showCommonLabel = false;
Expand Down Expand Up @@ -1077,8 +1077,9 @@ function cleanPoint(d, hovermode) {
}

var infomode = d.hoverinfo || d.trace.hoverinfo;

if(infomode !== 'all') {
infomode = infomode.split('+');
infomode = Array.isArray(infomode) ? infomode : infomode.split('+');
if(infomode.indexOf('x') === -1) d.xLabel = undefined;
if(infomode.indexOf('y') === -1) d.yLabel = undefined;
if(infomode.indexOf('z') === -1) d.zLabel = undefined;
Expand Down
3 changes: 2 additions & 1 deletion src/components/modebar/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ function getButtonGroups(gd, buttonsToRemove, buttonsToAdd) {
var hasGL2D = fullLayout._has('gl2d');
var hasTernary = fullLayout._has('ternary');
var hasMapbox = fullLayout._has('mapbox');
var hasPolar = fullLayout._has('polar');

var groups = [];

Expand Down Expand Up @@ -115,7 +116,7 @@ function getButtonGroups(gd, buttonsToRemove, buttonsToAdd) {
var allAxesFixed = areAllAxesFixed(fullLayout),
dragModeGroup = [];

if(((hasCartesian || hasGL2D) && !allAxesFixed) || hasTernary) {
if(((hasCartesian || hasGL2D) && !allAxesFixed) || hasTernary || hasPolar) {
dragModeGroup = ['zoom2d', 'pan2d'];
}
if(hasMapbox || hasGeo) {
Expand Down
2 changes: 1 addition & 1 deletion src/fonts/ploticon/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"width": 1500
},
"search": [
"tooltip_basic"
"tooltip_basic"
]
},
{
Expand Down
24 changes: 24 additions & 0 deletions src/lib/angles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Copyright 2012-2017, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

var PI = Math.PI;

exports.deg2rad = function(deg) {
return deg / 180 * PI;
};

exports.rad2deg = function(rad) {
return rad / PI * 180;
};

exports.wrap360 = function(deg) {
var out = deg % 360;
return out < 0 ? out + 360 : out;
};
2 changes: 2 additions & 0 deletions src/lib/coerce.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ exports.valObjectMeta = {
description: [
'A number (in degree) between -180 and 180.'
].join(' '),
// TODO maybe add option for 0 to 360??
// e.g. for polar.sector
requiredOpts: [],
otherOpts: ['dflt'],
coerceFunction: function(v, propOut, dflt) {
Expand Down
22 changes: 19 additions & 3 deletions src/lib/filter_visible.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* LICENSE file in the root directory of this source tree.
*/


'use strict';

/** Filter out object items with visible !== true
Expand All @@ -17,13 +16,30 @@
*
*/
module.exports = function filterVisible(container) {
var filterFn = isCalcData(container) ? calcDataFilter : baseFilter;
var out = [];

for(var i = 0; i < container.length; i++) {
var item = container[i];

if(item.visible === true) out.push(item);
if(filterFn(item)) out.push(item);
}

return out;
};

function baseFilter(item) {
return item.visible === true;
}

function calcDataFilter(item) {
return item[0].trace.visible === true;
}

function isCalcData(cont) {
return (
Array.isArray(cont) &&
Array.isArray(cont[0]) &&
cont[0][0] &&
cont[0][0].trace
);
}
3 changes: 2 additions & 1 deletion src/lib/gl_format_color.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'use strict';

var isNumeric = require('fast-isnumeric');
var rgba = require('color-rgba');
var rgba = require('color-normalize');

var Colorscale = require('../components/colorscale');
var colorDflt = require('../components/color/attributes').defaultLine;
Expand Down Expand Up @@ -59,6 +59,7 @@ function formatColor(containerIn, opacityIn, len) {

if(isArrayColorIn) {
getColor = function(c, i) {
// FIXME: there is double work, considering that sclFunc does the opposite
return c[i] === undefined ? colorDfltRgba : rgba(sclFunc(c[i]));
};
}
Expand Down
5 changes: 5 additions & 0 deletions src/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ lib.rotationXYMatrix = matrixModule.rotationXYMatrix;
lib.apply2DTransform = matrixModule.apply2DTransform;
lib.apply2DTransform2 = matrixModule.apply2DTransform2;

var anglesModule = require('./angles');
lib.deg2rad = anglesModule.deg2rad;
lib.rad2deg = anglesModule.rad2deg;
lib.wrap360 = anglesModule.wrap360;

var geom2dModule = require('./geometry2d');
lib.segmentsIntersect = geom2dModule.segmentsIntersect;
lib.segmentDistance = geom2dModule.segmentDistance;
Expand Down
Loading