(gd)
| 29 | var cn = require('./constants').cn; |
| 30 | |
| 31 | function 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 | |
| 67 | function makeColorBarData(gd) { |
| 68 | var fullLayout = gd._fullLayout; |
nothing calls this directly
no test coverage detected
searching dependent graphs…