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

rebase pull or so? #1

Merged
merged 38 commits into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
98c6937
Add `eng` exponentformat for engineering notation
Aug 27, 2020
65ae0f0
Create new axis attribute `minexponent`
Sep 1, 2020
c27653c
Add tests for `minexponent` attribute
Sep 3, 2020
f74e17f
minexponent test: do not redeclare textOut
Sep 3, 2020
83273cf
minexponent: add minimum value
Sep 3, 2020
f171cb6
axes_test mockCalc: add default value to minexponent attribute
Sep 4, 2020
cb6ffef
traces/carpet/axis_attributes: set minexponent editType to `calc`
Sep 4, 2020
1322729
axes_test: fix SyntaxError
ignamv Sep 4, 2020
16d1a16
mockCalc: ensure ax is modified in-place
Sep 7, 2020
ba408aa
axes_test: fix SyntaxError
Sep 7, 2020
dc565d9
autoTickRound: use default minexponent if undefined
Sep 7, 2020
d90b39b
axes_test: remove redundant setting of minexponent
ignamv Sep 13, 2020
61c4a83
sunburst sort attribute
thierryVergult Sep 24, 2020
54a88b1
Fixed the per-element opacity on Surface plots
lucapinello Nov 2, 2019
01bbdc5
enable transparent draw in gl-surface3d when colorscale has an item w…
archmoj Sep 24, 2020
b9dad67
add user-select-none to text elements
archmoj Sep 24, 2020
b4781d7
add image test for handling transparent colorscales in surface, heatm…
archmoj Sep 25, 2020
13324e2
clean up function now that alpha is not used directly
archmoj Sep 25, 2020
346319c
Revert "add user-select-none to text elements"
archmoj Sep 25, 2020
040465e
drop user-select-none classes before adding to the top element
archmoj Sep 25, 2020
cab6264
disable user-select at plotly paper level
archmoj Sep 25, 2020
89e1342
drop user-select in sankey and parcoords
archmoj Sep 25, 2020
7784e18
Revert "drop user-select in sankey and parcoords"
archmoj Sep 25, 2020
aac45fa
re-drop user-select in sankey and parcoords ONLY
archmoj Sep 25, 2020
abbabe4
Merge pull request #5165 from plotly/fix5021-disable-text-selection
archmoj Sep 25, 2020
cfe9dd1
simplify unused code blocks to handle surface transparency
archmoj Sep 26, 2020
2da1972
mockColorBarAxis: pass minexponent attribute
ignamv Sep 26, 2020
f504f6c
Layout attribute docs: expand description for `minexponent`
ignamv Sep 26, 2020
99b2769
Fix syntax error
ignamv Sep 26, 2020
0a531f8
reuse pie.sort
thierryVergult Sep 26, 2020
cf66d2e
fix indentation & space
thierryVergult Sep 26, 2020
98097ea
Merge pull request #5121 from ignamv/engineering_exponentformat
archmoj Sep 26, 2020
f1236ef
bump gl-surface v1.6.0
archmoj Sep 26, 2020
35474a1
Merge pull request #5166 from plotly/surface-colorscale-with-alpha
archmoj Sep 26, 2020
a66b42d
treemap sort
thierryVergult Sep 26, 2020
d191ac4
Merge pull request #5164 from thierryVergult/sunburstSort
archmoj Sep 28, 2020
1ae3e2c
bump tinycolor2 v1.4.2
archmoj Sep 28, 2020
2cce0e9
Merge pull request #5169 from plotly/tinycolor2-v1.4.2
archmoj Sep 28, 2020
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
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"gl-select-box": "^1.0.4",
"gl-spikes2d": "^1.0.2",
"gl-streamtube3d": "^1.4.1",
"gl-surface3d": "^1.5.2",
"gl-surface3d": "^1.6.0",
"gl-text": "^1.1.8",
"glslify": "^7.1.1",
"has-hover": "^1.0.1",
Expand All @@ -117,7 +117,7 @@
"strongly-connected-components": "^1.0.1",
"superscript-text": "^1.0.0",
"svg-path-sdf": "^1.1.3",
"tinycolor2": "^1.4.1",
"tinycolor2": "^1.4.2",
"to-px": "1.0.1",
"topojson-client": "^3.1.0",
"webgl-context": "^2.2.0",
Expand Down
1 change: 1 addition & 0 deletions src/components/colorbar/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ module.exports = overrideAll({
showticksuffix: axesAttrs.showticksuffix,
separatethousands: axesAttrs.separatethousands,
exponentformat: axesAttrs.exponentformat,
minexponent: axesAttrs.minexponent,
showexponent: axesAttrs.showexponent,
title: {
text: {
Expand Down
1 change: 1 addition & 0 deletions src/components/colorbar/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ function mockColorBarAxis(gd, opts, zrange) {
tickangle: opts.tickangle,
tickformat: opts.tickformat,
exponentformat: opts.exponentformat,
minexponent: opts.minexponent,
separatethousands: opts.separatethousands,
showexponent: opts.showexponent,
showtickprefix: opts.showtickprefix,
Expand Down
2 changes: 0 additions & 2 deletions src/components/legend/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ module.exports = function draw(gd, opts) {
if(title.text) {
var titleEl = Lib.ensureSingle(scrollBox, 'text', 'legendtitletext');
titleEl.attr('text-anchor', 'start')
.classed('user-select-none', true)
.call(Drawing.font, title.font)
.text(title.text);

Expand Down Expand Up @@ -410,7 +409,6 @@ function drawTexts(g, gd, opts) {
var textEl = Lib.ensureSingle(g, 'text', 'legendtext');

textEl.attr('text-anchor', 'start')
.classed('user-select-none', true)
.call(Drawing.font, opts.font)
.text(isEditable ? ensureLength(name, maxNameLength) : name);

Expand Down
3 changes: 1 addition & 2 deletions src/components/rangeselector/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ function drawButtonText(button, selectorLayout, d, gd) {
}

var text = Lib.ensureSingle(button, 'text', 'selector-text', function(s) {
s.classed('user-select-none', true)
.attr('text-anchor', 'middle');
s.attr('text-anchor', 'middle');
});

text.call(Drawing.font, selectorLayout.font)
Expand Down
18 changes: 8 additions & 10 deletions src/components/sliders/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) {
}

var text = Lib.ensureSingle(sliderGroup, 'text', constants.labelClass, function(s) {
s.classed('user-select-none', true)
.attr({
'text-anchor': textAnchor,
'data-notex': 1
});
s.attr({
'text-anchor': textAnchor,
'data-notex': 1
});
});

var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : '';
Expand Down Expand Up @@ -357,11 +356,10 @@ function drawGrip(sliderGroup, gd, sliderOpts) {

function drawLabel(item, data, sliderOpts) {
var text = Lib.ensureSingle(item, 'text', constants.labelClass, function(s) {
s.classed('user-select-none', true)
.attr({
'text-anchor': 'middle',
'data-notex': 1
});
s.attr({
'text-anchor': 'middle',
'data-notex': 1
});
});

var tx = data.step.label;
Expand Down
12 changes: 5 additions & 7 deletions src/components/updatemenus/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) {

// draw drop arrow at the right edge
var arrow = Lib.ensureSingle(gHeader, 'text', constants.headerArrowClassName, function(s) {
s.classed('user-select-none', true)
.attr('text-anchor', 'end')
s.attr('text-anchor', 'end')
.call(Drawing.font, menuOpts.font)
.text(constants.arrowSymbol[menuOpts.direction]);
});
Expand Down Expand Up @@ -435,11 +434,10 @@ function drawItemRect(item, menuOpts) {

function drawItemText(item, menuOpts, itemOpts, gd) {
var text = Lib.ensureSingle(item, 'text', constants.itemTextClassName, function(s) {
s.classed('user-select-none', true)
.attr({
'text-anchor': 'start',
'data-notex': 1
});
s.attr({
'text-anchor': 'start',
'data-notex': 1
});
});

var tx = itemOpts.label;
Expand Down
11 changes: 4 additions & 7 deletions src/lib/gl_format_color.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,19 @@ function formatColor(containerIn, opacityIn, len) {
return colorOut;
}

function parseColorScale(cont, alpha) {
if(alpha === undefined) alpha = 1;

function parseColorScale(cont) {
var cOpts = Colorscale.extractOpts(cont);

var colorscale = cOpts.reversescale ?
Colorscale.flipScale(cOpts.colorscale) :
cOpts.colorscale;
var colorscale = cOpts.colorscale;
if(cOpts.reversescale) colorscale = Colorscale.flipScale(cOpts.colorscale);

return colorscale.map(function(elem) {
var index = elem[0];
var color = tinycolor(elem[1]);
var rgb = color.toRgb();
return {
index: index,
rgb: [rgb.r, rgb.g, rgb.b, alpha]
rgb: [rgb.r, rgb.g, rgb.b, rgb.a]
};
});
}
Expand Down
4 changes: 3 additions & 1 deletion src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3717,13 +3717,15 @@ function makePlotFramework(gd) {

// Plot container
fullLayout._container = gd3.selectAll('.plot-container').data([0]);
fullLayout._container.enter().insert('div', ':first-child')
fullLayout._container.enter()
.insert('div', ':first-child')
.classed('plot-container', true)
.classed('plotly', true);

// Make the svg container
fullLayout._paperdiv = fullLayout._container.selectAll('.svg-container').data([0]);
fullLayout._paperdiv.enter().append('div')
.classed('user-select-none', true)
.classed('svg-container', true)
.style('position', 'relative');

Expand Down
4 changes: 3 additions & 1 deletion src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,8 @@ function autoTickRound(ax) {

var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1]));
var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01);
if(Math.abs(rangeexp) > 3) {
var minexponent = ax.minexponent === undefined ? 3 : ax.minexponent;
if(Math.abs(rangeexp) > minexponent) {
if(isSIFormat(ax.exponentformat) && !beyondSI(rangeexp)) {
ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3);
} else ax._tickexponent = rangeexp;
Expand Down Expand Up @@ -1586,6 +1587,7 @@ function numFormat(v, ax, fmtoverride, hover) {
// make a dummy axis obj to get the auto rounding and exponent
var ah = {
exponentformat: exponentFormat,
minexponent: ax.minexponent,
dtick: ax.showexponent === 'none' ? ax.dtick :
(isNumeric(v) ? Math.abs(v) || 1 : 1),
// if not showing any exponents, don't change the exponent
Expand Down
11 changes: 11 additions & 0 deletions src/plots/cartesian/layout_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,17 @@ module.exports = {
'If *B*, 1B.'
].join(' ')
},
minexponent: {
valType: 'number',
dflt: 3,
min: 0,
role: 'style',
editType: 'ticks',
description: [
'Hide SI prefix for 10^n if |n| is below this number.',
'This only has an effect when `tickformat` is *SI* or *B*.'
].join(' ')
},
separatethousands: {
valType: 'boolean',
dflt: false,
Expand Down
1 change: 1 addition & 0 deletions src/plots/cartesian/tick_label_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options)
if(!tickFormat && axType !== 'date') {
coerce('showexponent', showAttrDflt);
coerce('exponentformat');
coerce('minexponent');
coerce('separatethousands');
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/plots/gl2d/scene2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,6 @@ proto.makeFramework = function() {

this.updateSize(canvas);

// disabling user select on the canvas
// sanitizes double-clicks interactions
// ref: https://github.com/plotly/plotly.js/issues/744
canvas.className += ' user-select-none';

// create SVG container for hover text
var svgContainer = this.svgContainer = document.createElementNS(
'http://www.w3.org/2000/svg',
Expand Down
1 change: 1 addition & 0 deletions src/plots/gl3d/layout/axis_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ module.exports = overrideAll({
showticksuffix: axesAttrs.showticksuffix,
showexponent: axesAttrs.showexponent,
exponentformat: axesAttrs.exponentformat,
minexponent: axesAttrs.minexponent,
separatethousands: axesAttrs.separatethousands,
tickformat: axesAttrs.tickformat,
tickformatstops: axesAttrs.tickformatstops,
Expand Down
1 change: 1 addition & 0 deletions src/plots/polar/layout_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var axisTickAttrs = overrideAll({
ticksuffix: axesAttrs.ticksuffix,
showexponent: axesAttrs.showexponent,
exponentformat: axesAttrs.exponentformat,
minexponent: axesAttrs.minexponent,
separatethousands: axesAttrs.separatethousands,
tickfont: axesAttrs.tickfont,
tickangle: axesAttrs.tickangle,
Expand Down
1 change: 1 addition & 0 deletions src/plots/ternary/layout_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var ternaryAxesAttrs = {
ticksuffix: axesAttrs.ticksuffix,
showexponent: axesAttrs.showexponent,
exponentformat: axesAttrs.exponentformat,
minexponent: axesAttrs.minexponent,
separatethousands: axesAttrs.separatethousands,
tickfont: axesAttrs.tickfont,
tickangle: axesAttrs.tickangle,
Expand Down
10 changes: 10 additions & 0 deletions src/traces/carpet/axis_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,16 @@ module.exports = {
'If *B*, 1B.'
].join(' ')
},
minexponent: {
valType: 'number',
dflt: 3,
min: 0,
role: 'style',
editType: 'calc',
description: [
'Hide SI prefix for 10^n if |n| is below this number'
].join(' ')
},
separatethousands: {
valType: 'boolean',
dflt: false,
Expand Down
2 changes: 2 additions & 0 deletions src/traces/carpet/axis_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, options)
coerce('separatethousands');
coerce('tickformat');
coerce('exponentformat');
coerce('minexponent');
coerce('showexponent');
coerce('categoryorder');

Expand Down Expand Up @@ -186,6 +187,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, options)
delete containerOut.tickangle;
delete containerOut.showexponent;
delete containerOut.exponentformat;
delete containerOut.minexponent;
delete containerOut.tickformat;
delete containerOut.showticksuffix;
delete containerOut.showtickprefix;
Expand Down
1 change: 0 additions & 1 deletion src/traces/carpet/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ function drawAxisTitle(gd, layer, trace, t, xy, dxy, axis, xa, ya, labelOrientat
'rotate(' + orientation.angle + ') ' +
'translate(0,' + offset + ')'
)
.classed('user-select-none', true)
.attr('text-anchor', 'middle')
.call(Drawing.font, axis.title.font);
});
Expand Down
1 change: 1 addition & 0 deletions src/traces/indicator/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ module.exports = {
showticksuffix: axesAttrs.showticksuffix,
separatethousands: axesAttrs.separatethousands,
exponentformat: axesAttrs.exponentformat,
minexponent: axesAttrs.minexponent,
showexponent: axesAttrs.showexponent,
editType: 'plot'
}, 'plot'),
Expand Down
7 changes: 2 additions & 5 deletions src/traces/parcoords/parcoords.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,7 @@ function styleExtentTexts(selection) {
selection
.classed(c.cn.axisExtentText, true)
.attr('text-anchor', 'middle')
.style('cursor', 'default')
.style('user-select', 'none');
.style('cursor', 'default');
}

function parcoordsInteractionState() {
Expand Down Expand Up @@ -655,8 +654,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) {

axis.selectAll('text')
.style('text-shadow', '1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff')
.style('cursor', 'default')
.style('user-select', 'none');
.style('cursor', 'default');

var axisHeading = axisOverlays.selectAll('.' + c.cn.axisHeading)
.data(repeat, keyFun);
Expand All @@ -673,7 +671,6 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) {
.classed(c.cn.axisTitle, true)
.attr('text-anchor', 'middle')
.style('cursor', 'ew-resize')
.style('user-select', 'none')
.style('pointer-events', 'auto');

axisTitle
Expand Down
1 change: 0 additions & 1 deletion src/traces/sankey/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,6 @@ module.exports = function(gd, svg, calcData, layout, callbacks) {
.append('text')
.classed(c.cn.nodeLabel, true)
.attr('transform', textFlip)
.style('user-select', 'none')
.style('cursor', 'default')
.style('fill', 'black');

Expand Down
1 change: 1 addition & 0 deletions src/traces/sunburst/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ module.exports = {
'this option won\'t have any effect and `insidetextfont` would be used.'
].join(' ')
}),
sort: pieAttrs.sort,

domain: domainAttrs({name: 'sunburst', trace: true, editType: 'calc'})
};
4 changes: 3 additions & 1 deletion src/traces/sunburst/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ exports.calc = function(gd, trace) {
if(failed) return;

// TODO add way to sort by height also?
hierarchy.sort(function(a, b) { return b.value - a.value; });
if(trace.sort) {
hierarchy.sort(function(a, b) { return b.value - a.value; });
}

var pullColor;
var scaleColor;
Expand Down
2 changes: 2 additions & 0 deletions src/traces/sunburst/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout

coerce('insidetextorientation');

coerce('sort');

handleDomainDefaults(traceOut, layout, coerce);

// do not support transforms for now
Expand Down
Loading