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

Function draw

src/components/colorbar/draw.js:31–65  ·  view source on GitHub ↗
(gd)

Source from the content-addressed store, hash-verified

29var cn = require('./constants').cn;
30
31function draw(gd) {
32 var fullLayout = gd._fullLayout;
33
34 var colorBars = fullLayout._infolayer
35 .selectAll('g.' + cn.colorbar)
36 .data(makeColorBarData(gd), function(opts) { return opts._id; });
37
38 colorBars.enter().append('g')
39 .attr('class', function(opts) { return opts._id; })
40 .classed(cn.colorbar, true);
41
42 colorBars.each(function(opts) {
43 var g = d3.select(this);
44
45 Lib.ensureSingle(g, 'rect', cn.cbbg);
46 Lib.ensureSingle(g, 'g', cn.cbfills);
47 Lib.ensureSingle(g, 'g', cn.cblines);
48 Lib.ensureSingle(g, 'g', cn.cbaxis, function(s) { s.classed(cn.crisp, true); });
49 Lib.ensureSingle(g, 'g', cn.cbtitleunshift, function(s) { s.append('g').classed(cn.cbtitle, true); });
50 Lib.ensureSingle(g, 'rect', cn.cboutline);
51
52 var done = drawColorBar(g, opts, gd);
53 if(done && done.then) (gd._promises || []).push(done);
54
55 if(gd._context.edits.colorbarPosition) {
56 makeEditable(g, opts, gd);
57 }
58 });
59
60 colorBars.exit()
61 .each(function(opts) { Plots.autoMargin(gd, opts._id); })
62 .remove();
63
64 colorBars.order();
65}
66
67function makeColorBarData(gd) {
68 var fullLayout = gd._fullLayout;

Callers

nothing calls this directly

Calls 3

makeColorBarDataFunction · 0.85
drawColorBarFunction · 0.85
makeEditableFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…