Skip to content

Commit 2dc7740

Browse files
committed
Merge remote-tracking branch 'origin/master' into gl2d-cleanup
2 parents 8f4a236 + 4865393 commit 2dc7740

23 files changed

+6
-4312
lines changed

Diff for: src/plot_api/plot_api.js

-101
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@ var Queue = require('../lib/queue');
2121
var Registry = require('../registry');
2222
var PlotSchema = require('./plot_schema');
2323
var Plots = require('../plots/plots');
24-
var Polar = require('../plots/polar/legacy');
2524

2625
var Axes = require('../plots/cartesian/axes');
2726
var Drawing = require('../components/drawing');
2827
var Color = require('../components/color');
2928
var initInteractions = require('../plots/cartesian/graph_interact').initInteractions;
3029
var xmlnsNamespaces = require('../constants/xmlns_namespaces');
31-
var svgTextUtils = require('../lib/svg_text_utils');
3230
var clearSelect = require('../plots/cartesian/select').clearSelect;
3331

3432
var dfltConfig = require('./plot_config').dfltConfig;
@@ -141,12 +139,6 @@ function plot(gd, data, layout, config) {
141139
var fullLayout = gd._fullLayout;
142140
var hasCartesian = fullLayout._has('cartesian');
143141

144-
// Legacy polar plots
145-
if(!fullLayout._has('polar') && data && data[0] && data[0].r) {
146-
Lib.log('Legacy polar charts are deprecated!');
147-
return plotLegacyPolar(gd, data, layout);
148-
}
149-
150142
// so we don't try to re-call Plotly.plot from inside
151143
// legend and colorbar, if margins changed
152144
fullLayout._replotting = true;
@@ -547,99 +539,6 @@ function setPlotContext(gd, config) {
547539
}
548540
}
549541

550-
function plotLegacyPolar(gd, data, layout) {
551-
// build or reuse the container skeleton
552-
var plotContainer = d3.select(gd).selectAll('.plot-container')
553-
.data([0]);
554-
plotContainer.enter()
555-
.insert('div', ':first-child')
556-
.classed('plot-container plotly', true);
557-
var paperDiv = plotContainer.selectAll('.svg-container')
558-
.data([0]);
559-
paperDiv.enter().append('div')
560-
.classed('svg-container', true)
561-
.style('position', 'relative');
562-
563-
// empty it everytime for now
564-
paperDiv.html('');
565-
566-
// fulfill gd requirements
567-
if(data) gd.data = data;
568-
if(layout) gd.layout = layout;
569-
Polar.manager.fillLayout(gd);
570-
571-
// resize canvas
572-
paperDiv.style({
573-
width: gd._fullLayout.width + 'px',
574-
height: gd._fullLayout.height + 'px'
575-
});
576-
577-
// instantiate framework
578-
gd.framework = Polar.manager.framework(gd);
579-
580-
// plot
581-
gd.framework({data: gd.data, layout: gd.layout}, paperDiv.node());
582-
583-
// set undo point
584-
gd.framework.setUndoPoint();
585-
586-
// get the resulting svg for extending it
587-
var polarPlotSVG = gd.framework.svg();
588-
589-
// editable title
590-
var opacity = 1;
591-
var txt = gd._fullLayout.title ? gd._fullLayout.title.text : '';
592-
if(txt === '' || !txt) opacity = 0;
593-
594-
var titleLayout = function() {
595-
this.call(svgTextUtils.convertToTspans, gd);
596-
// TODO: html/mathjax
597-
// TODO: center title
598-
};
599-
600-
var title = polarPlotSVG.select('.title-group text')
601-
.call(titleLayout);
602-
603-
if(gd._context.edits.titleText) {
604-
var placeholderText = Lib._(gd, 'Click to enter Plot title');
605-
if(!txt || txt === placeholderText) {
606-
opacity = 0.2;
607-
// placeholder is not going through convertToTspans
608-
// so needs explicit data-unformatted
609-
title.attr({'data-unformatted': placeholderText})
610-
.text(placeholderText)
611-
.style({opacity: opacity})
612-
.on('mouseover.opacity', function() {
613-
d3.select(this).transition().duration(100)
614-
.style('opacity', 1);
615-
})
616-
.on('mouseout.opacity', function() {
617-
d3.select(this).transition().duration(1000)
618-
.style('opacity', 0);
619-
});
620-
}
621-
622-
var setContenteditable = function() {
623-
this.call(svgTextUtils.makeEditable, {gd: gd})
624-
.on('edit', function(text) {
625-
gd.framework({layout: {title: {text: text}}});
626-
this.text(text)
627-
.call(titleLayout);
628-
this.call(setContenteditable);
629-
})
630-
.on('cancel', function() {
631-
var txt = this.attr('data-unformatted');
632-
this.text(txt).call(titleLayout);
633-
});
634-
};
635-
title.call(setContenteditable);
636-
}
637-
638-
gd._context.setBackground(gd, gd._fullLayout.paper_bgcolor);
639-
Plots.addLinks(gd);
640-
641-
return Promise.resolve();
642-
}
643542

644543
// convenience function to force a full redraw, mostly for use by plotly.js
645544
function redraw(gd) {

Diff for: src/plot_api/plot_schema.js

+4-34
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,8 @@ var frameAttributes = require('../plots/frame_attributes');
1717
var animationAttributes = require('../plots/animation_attributes');
1818
var configAttributes = require('./plot_config').configAttributes;
1919

20-
// polar attributes are not part of the Registry yet
21-
var polarAreaAttrs = require('../plots/polar/legacy/area_attributes');
22-
var polarAxisAttrs = require('../plots/polar/legacy/axis_attributes');
23-
2420
var editTypes = require('./edit_types');
2521

26-
var extendFlat = Lib.extendFlat;
2722
var extendDeepAll = Lib.extendDeepAll;
2823
var isPlainObject = Lib.isPlainObject;
2924
var isArrayOrTypedArray = Lib.isArrayOrTypedArray;
@@ -55,7 +50,7 @@ exports.UNDERSCORE_ATTRS = UNDERSCORE_ATTRS;
5550
exports.get = function() {
5651
var traces = {};
5752

58-
Registry.allTypes.concat('area').forEach(function(type) {
53+
Registry.allTypes.forEach(function(type) {
5954
traces[type] = getTraceAttributes(type);
6055
});
6156

@@ -282,8 +277,6 @@ exports.getTraceValObject = function(trace, parts) {
282277
moduleAttrs = (Registry.transformsRegistry[transforms[tNum].type] || {}).attributes;
283278
valObject = moduleAttrs && moduleAttrs[parts[2]];
284279
i = 3; // start recursing only inside the transform
285-
} else if(trace.type === 'area') {
286-
valObject = polarAreaAttrs[head];
287280
} else {
288281
// first look in the module for this trace
289282
// components have already merged their trace attributes in here
@@ -383,12 +376,7 @@ function layoutHeadAttr(fullLayout, head) {
383376

384377
if(head in baseLayoutAttributes) return baseLayoutAttributes[head];
385378

386-
// Polar doesn't populate _modules or _basePlotModules
387-
// just fall back on these when the others fail
388-
if(head === 'radialaxis' || head === 'angularaxis') {
389-
return polarAxisAttrs[head];
390-
}
391-
return polarAxisAttrs.layout[head] || false;
379+
return false;
392380
}
393381

394382
function recurseIntoValObject(valObject, parts, i) {
@@ -446,13 +434,8 @@ function isIndex(val) {
446434
function getTraceAttributes(type) {
447435
var _module, basePlotModule;
448436

449-
if(type === 'area') {
450-
_module = { attributes: polarAreaAttrs };
451-
basePlotModule = {};
452-
} else {
453-
_module = Registry.modules[type]._module,
454-
basePlotModule = _module.basePlotModule;
455-
}
437+
_module = Registry.modules[type]._module,
438+
basePlotModule = _module.basePlotModule;
456439

457440
var attributes = {};
458441

@@ -550,9 +533,6 @@ function getLayoutAttributes() {
550533
}
551534
}
552535

553-
// polar layout attributes
554-
layoutAttributes = assignPolarLayoutAttrs(layoutAttributes);
555-
556536
// add registered components layout attributes
557537
for(key in Registry.componentsRegistry) {
558538
_module = Registry.componentsRegistry[key];
@@ -700,16 +680,6 @@ function stringify(attrs) {
700680
walk(attrs);
701681
}
702682

703-
function assignPolarLayoutAttrs(layoutAttributes) {
704-
extendFlat(layoutAttributes, {
705-
radialaxis: polarAxisAttrs.radialaxis,
706-
angularaxis: polarAxisAttrs.angularaxis
707-
});
708-
709-
extendFlat(layoutAttributes, polarAxisAttrs.layout);
710-
711-
return layoutAttributes;
712-
}
713683

714684
function handleBasePlotModule(layoutAttributes, _module, astr) {
715685
var np = nestedProperty(layoutAttributes, astr);

Diff for: src/plots/plots.js

-7
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,6 @@ plots.hasSimpleAPICommandBindings = commandModule.hasSimpleAPICommandBindings;
5757
plots.redrawText = function(gd) {
5858
gd = Lib.getGraphDiv(gd);
5959

60-
var fullLayout = gd._fullLayout || {};
61-
var hasPolar = fullLayout._has && fullLayout._has('polar');
62-
var hasLegacyPolar = !hasPolar && gd.data && gd.data[0] && gd.data[0].r;
63-
64-
// do not work if polar is present
65-
if(hasLegacyPolar) return;
66-
6760
return new Promise(function(resolve) {
6861
setTimeout(function() {
6962
Registry.getComponentMethod('annotations', 'draw')(gd);

Diff for: src/plots/polar/legacy/area_attributes.js

-62
This file was deleted.

0 commit comments

Comments
 (0)