diff --git a/src/components/annotations/annotation_defaults.js b/src/components/annotations/annotation_defaults.js index 7b5f2da9689..e414483f669 100644 --- a/src/components/annotations/annotation_defaults.js +++ b/src/components/annotations/annotation_defaults.js @@ -42,20 +42,20 @@ module.exports = function handleAnnotationDefaults(annIn, fullLayout) { // positioning var axLetters = ['x', 'y'], arrowPosDflt = [-10, -30], - tdMock = {_fullLayout: fullLayout}; + gdMock = {_fullLayout: fullLayout}; for(var i = 0; i < 2; i++) { var axLetter = axLetters[i]; // xref, yref - var axRef = Axes.coerceRef(annIn, annOut, tdMock, axLetter, '', 'paper'); + var axRef = Axes.coerceRef(annIn, annOut, gdMock, axLetter, '', 'paper'); // x, y - Axes.coercePosition(annOut, tdMock, coerce, axRef, axLetter, 0.5); + Axes.coercePosition(annOut, gdMock, coerce, axRef, axLetter, 0.5); if(showArrow) { var arrowPosAttr = 'a' + axLetter, // axref, ayref - aaxRef = Axes.coerceRef(annIn, annOut, tdMock, arrowPosAttr, 'pixel'); + aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); // for now the arrow can only be on the same axis or specified as pixels // TODO: sometime it might be interesting to allow it to be on *any* axis @@ -66,7 +66,7 @@ module.exports = function handleAnnotationDefaults(annIn, fullLayout) { // ax, ay var aDflt = (aaxRef === 'pixel') ? arrowPosDflt[i] : 0.4; - Axes.coercePosition(annOut, tdMock, coerce, aaxRef, arrowPosAttr, aDflt); + Axes.coercePosition(annOut, gdMock, coerce, aaxRef, arrowPosAttr, aDflt); } // xanchor, yanchor diff --git a/src/components/drawing/index.js b/src/components/drawing/index.js index b4f1c5581e5..b0491af52b8 100644 --- a/src/components/drawing/index.js +++ b/src/components/drawing/index.js @@ -75,14 +75,14 @@ drawing.getPx = function(s, styleAttr) { return Number(s.style(styleAttr).replace(/px$/, '')); }; -drawing.crispRound = function(td, lineWidth, dflt) { +drawing.crispRound = function(gd, lineWidth, dflt) { // for lines that disable antialiasing we want to // make sure the width is an integer, and at least 1 if it's nonzero if(!lineWidth || !isNumeric(lineWidth)) return dflt || 0; // but not for static plots - these don't get antialiased anyway. - if(td._context.staticPlot) return lineWidth; + if(gd._context.staticPlot) return lineWidth; if(lineWidth < 1) return 1; return Math.round(lineWidth); diff --git a/src/components/images/defaults.js b/src/components/images/defaults.js index 1be89b4f05a..bbe21337a0a 100644 --- a/src/components/images/defaults.js +++ b/src/components/images/defaults.js @@ -53,11 +53,11 @@ function imageDefaults(imageIn, imageOut, fullLayout) { coerce('opacity'); for(var i = 0; i < 2; i++) { - var tdMock = { _fullLayout: fullLayout }, + var gdMock = { _fullLayout: fullLayout }, axLetter = ['x', 'y'][i]; // 'paper' is the fallback axref - Axes.coerceRef(imageIn, imageOut, tdMock, axLetter, 'paper'); + Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper'); } return imageOut; diff --git a/src/components/shapes/shape_defaults.js b/src/components/shapes/shape_defaults.js index 47bfbea7fff..189507f86b9 100644 --- a/src/components/shapes/shape_defaults.js +++ b/src/components/shapes/shape_defaults.js @@ -36,10 +36,10 @@ module.exports = function handleShapeDefaults(shapeIn, fullLayout) { var axLetters = ['x', 'y']; for(var i = 0; i < 2; i++) { var axLetter = axLetters[i], - tdMock = {_fullLayout: fullLayout}; + gdMock = {_fullLayout: fullLayout}; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, tdMock, axLetter, '', 'paper'); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); if(shapeType !== 'path') { var dflt0 = 0.25, @@ -49,7 +49,7 @@ module.exports = function handleShapeDefaults(shapeIn, fullLayout) { r2pos; if(axRef !== 'paper') { - ax = Axes.getFromId(tdMock, axRef); + ax = Axes.getFromId(gdMock, axRef); r2pos = helpers.rangeToShapePosition(ax); pos2r = helpers.shapePositionToRange(ax); @@ -72,8 +72,8 @@ module.exports = function handleShapeDefaults(shapeIn, fullLayout) { shapeIn[attr1] = pos2r(shapeIn[attr1], true); // x0, x1 (and y0, y1) - Axes.coercePosition(shapeOut, tdMock, coerce, axRef, attr0, dflt0); - Axes.coercePosition(shapeOut, tdMock, coerce, axRef, attr1, dflt1); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr0, dflt0); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr1, dflt1); // hack part 2 shapeOut[attr0] = r2pos(shapeOut[attr0]); diff --git a/src/lib/index.js b/src/lib/index.js index adca268a068..fd37fea2199 100644 --- a/src/lib/index.js +++ b/src/lib/index.js @@ -257,7 +257,7 @@ lib.smooth = function(arrayIn, FWHM) { * as long as its returns are not promises (ie have no .then) * includes one argument arg to send to all functions... * this is mainly just to prevent us having to make wrapper functions - * when the only purpose of the wrapper is to reference gd / td + * when the only purpose of the wrapper is to reference gd * and a final step to be executed at the end * TODO: if there's an error and everything is sync, * this doesn't happen yet because we want to make sure diff --git a/src/lib/svg_text_utils.js b/src/lib/svg_text_utils.js index 28b152085a8..2d229357f25 100644 --- a/src/lib/svg_text_utils.js +++ b/src/lib/svg_text_utils.js @@ -111,8 +111,8 @@ exports.convertToTspans = function(_context, _callback) { } if(tex) { - var td = Lib.getPlotDiv(that.node()); - ((td && td._promises) || []).push(new Promise(function(resolve) { + var gd = Lib.getPlotDiv(that.node()); + ((gd && gd._promises) || []).push(new Promise(function(resolve) { that.style({visibility: 'hidden'}); var config = {fontSize: parseInt(that.style('font-size'), 10)}; diff --git a/src/plot_api/to_image.js b/src/plot_api/to_image.js index 2f910af0b00..f86bb929395 100644 --- a/src/plot_api/to_image.js +++ b/src/plot_api/to_image.js @@ -52,7 +52,7 @@ function toImage(gd, opts) { // first clone the GD so we can operate in a clean environment var clone = clonePlot(gd, {format: 'png', height: opts.height, width: opts.width}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; diff --git a/src/plots/cartesian/axes.js b/src/plots/cartesian/axes.js index 97c166dc6be..9cd9c034e8b 100644 --- a/src/plots/cartesian/axes.js +++ b/src/plots/cartesian/axes.js @@ -89,7 +89,7 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption * - for date axes: JS Dates or milliseconds, and convert to date strings * - for other types: coerce them to numbers */ -axes.coercePosition = function(containerOut, td, coerce, axRef, attr, dflt) { +axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { var pos, newPos; @@ -97,7 +97,7 @@ axes.coercePosition = function(containerOut, td, coerce, axRef, attr, dflt) { pos = coerce(attr, dflt); } else { - var ax = axes.getFromId(td, axRef); + var ax = axes.getFromId(gd, axRef); dflt = ax.fraction2r(dflt); pos = coerce(attr, dflt); diff --git a/src/plots/cartesian/axis_autotype.js b/src/plots/cartesian/axis_autotype.js index 656ff1e0003..00139887d28 100644 --- a/src/plots/cartesian/axis_autotype.js +++ b/src/plots/cartesian/axis_autotype.js @@ -54,7 +54,7 @@ function moreDates(a) { return (dcnt > ncnt * 2); } -// are the (x,y)-values in td.data mostly text? +// are the (x,y)-values in gd.data mostly text? // require twice as many categories as numbers function category(a) { // test at most 1000 points diff --git a/src/plots/cartesian/layout_attributes.js b/src/plots/cartesian/layout_attributes.js index ed0201c6d92..9dda505b52e 100644 --- a/src/plots/cartesian/layout_attributes.js +++ b/src/plots/cartesian/layout_attributes.js @@ -40,8 +40,8 @@ module.exports = { type: { valType: 'enumerated', // '-' means we haven't yet run autotype or couldn't find any data - // it gets turned into linear in td._fullLayout but not copied back - // to td.data like the others are. + // it gets turned into linear in gd._fullLayout but not copied back + // to gd.data like the others are. values: ['-', 'linear', 'log', 'date', 'category'], dflt: '-', role: 'info', diff --git a/src/plots/cartesian/set_convert.js b/src/plots/cartesian/set_convert.js index 4ff5ef380ad..e61b2623e0b 100644 --- a/src/plots/cartesian/set_convert.js +++ b/src/plots/cartesian/set_convert.js @@ -315,7 +315,7 @@ module.exports = function setConvert(ax) { // makeCalcdata: takes an x or y array and converts it // to a position on the axis object "ax" // inputs: - // trace - a data object from td.data + // trace - a data object from gd.data // axLetter - a string, either 'x' or 'y', for which item // to convert (TODO: is this now always the same as // the first letter of ax._id?) diff --git a/src/snapshot/cloneplot.js b/src/snapshot/cloneplot.js index d8f076b0d7f..25a389306df 100644 --- a/src/snapshot/cloneplot.js +++ b/src/snapshot/cloneplot.js @@ -124,11 +124,12 @@ module.exports = function clonePlot(graphObj, options) { } } - var td = document.createElement('div'); - if(options.tileClass) td.className = options.tileClass; + var gd = document.createElement('div'); + if(options.tileClass) gd.className = options.tileClass; var plotTile = { - td: td, + gd: gd, + td: gd, // for external (image server) compatibility layout: newLayout, data: newData, config: { @@ -148,8 +149,8 @@ module.exports = function clonePlot(graphObj, options) { plotTile.config.setBackground = options.setBackground || 'opaque'; } - // attaching the default Layout the td, so you can grab it later - plotTile.td.defaultLayout = cloneLayoutOverride(options.tileClass); + // attaching the default Layout the gd, so you can grab it later + plotTile.gd.defaultLayout = cloneLayoutOverride(options.tileClass); return plotTile; }; diff --git a/src/snapshot/toimage.js b/src/snapshot/toimage.js index 9fc8eb75b5a..76386f4ac83 100644 --- a/src/snapshot/toimage.js +++ b/src/snapshot/toimage.js @@ -30,7 +30,7 @@ function toImage(gd, opts) { var ev = new EventEmitter(); var clone = clonePlot(gd, {format: 'png'}); - var clonedGd = clone.td; + var clonedGd = clone.gd; // put the cloned div somewhere off screen before attaching to DOM clonedGd.style.position = 'absolute'; diff --git a/test/jasmine/tests/snapshot_test.js b/test/jasmine/tests/snapshot_test.js index d2050628f43..579a3ae58eb 100644 --- a/test/jasmine/tests/snapshot_test.js +++ b/test/jasmine/tests/snapshot_test.js @@ -86,7 +86,8 @@ describe('Plotly.Snapshot', function() { var themeTile = Plotly.Snapshot.clone(dummyGraphObj, themeOptions); expect(themeTile.layout.height).toEqual(THEMETILE_DEFAULT_LAYOUT.height); expect(themeTile.layout.width).toEqual(THEMETILE_DEFAULT_LAYOUT.width); - expect(themeTile.td.defaultLayout).toEqual(THEMETILE_DEFAULT_LAYOUT); + expect(themeTile.gd.defaultLayout).toEqual(THEMETILE_DEFAULT_LAYOUT); + expect(themeTile.gd).toBe(themeTile.td); // image server compatibility expect(themeTile.config).toEqual(config); });