MCPcopy Index your code
hub / github.com/plotly/plotly.js / makePlotFramework

Function makePlotFramework

src/plot_api/plot_api.js:3652–3808  ·  view source on GitHub ↗
(gd)

Source from the content-addressed store, hash-verified

3650// makePlotFramework: Create the plot container and axes
3651// -------------------------------------------------------
3652function makePlotFramework(gd) {
3653 var gd3 = d3.select(gd);
3654 var fullLayout = gd._fullLayout;
3655
3656 fullLayout._calcInverseTransform = calcInverseTransform;
3657 fullLayout._calcInverseTransform(gd);
3658
3659 // Plot container
3660 fullLayout._container = gd3.selectAll('.plot-container').data([0]);
3661 fullLayout._container
3662 .enter()
3663 .insert('div', ':first-child')
3664 .classed('plot-container', true)
3665 .classed('plotly', true)
3666 // The plot container should always take the full with the height of its
3667 // parent (the graph div). This ensures that for responsive plots
3668 // without a height or width set, the paper div will take up the full
3669 // height & width of the graph div.
3670 // So, for responsive plots without a height or width set, if the plot
3671 // container's height is left to 'auto', its height will be dictated by
3672 // its childrens' height. (The plot container's only child is the paper
3673 // div.)
3674 // In this scenario, the paper div's height will be set to 100%,
3675 // which will be 100% of the plot container's auto height. That is
3676 // meaninglesss, so the browser will use the paper div's children to set
3677 // the height of the plot container instead. However, the paper div's
3678 // children do not have any height, because they are all positioned
3679 // absolutely, and therefore take up no space.
3680 .style({
3681 width: '100%',
3682 height: '100%'
3683 });
3684
3685 // Make the svg container
3686 fullLayout._paperdiv = fullLayout._container.selectAll('.svg-container').data([0]);
3687 fullLayout._paperdiv
3688 .enter()
3689 .append('div')
3690 .classed('user-select-none', true)
3691 .classed('svg-container', true)
3692 .style('position', 'relative');
3693
3694 // Make the graph containers
3695 // start fresh each time we get here, so we know the order comes out
3696 // right, rather than enter/exit which can muck up the order
3697 // TODO: sort out all the ordering so we don't have to
3698 // explicitly delete anything
3699 // FIXME: parcoords reuses this object, not the best pattern
3700 fullLayout._glcontainer = fullLayout._paperdiv.selectAll('.gl-container').data([{}]);
3701
3702 fullLayout._glcontainer.enter().append('div').classed('gl-container', true);
3703
3704 fullLayout._paperdiv.selectAll('.main-svg').remove();
3705 fullLayout._paperdiv.select('.modebar-container').remove();
3706
3707 fullLayout._paper = fullLayout._paperdiv.insert('svg', ':first-child').classed('main-svg', true);
3708
3709 fullLayout._toppaper = fullLayout._paperdiv.append('svg').classed('main-svg', true);

Callers 1

_doPlotFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…