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

Function drawBulletGauge

src/traces/indicator/plot.js:224–339  ·  view source on GitHub ↗
(gd, plotGroup, cd, opts)

Source from the content-addressed store, hash-verified

222};
223
224function drawBulletGauge(gd, plotGroup, cd, opts) {
225 var trace = cd[0].trace;
226
227 var bullet = opts.gauge;
228 var axisLayer = opts.layer;
229 var gaugeBg = opts.gaugeBg;
230 var gaugeOutline = opts.gaugeOutline;
231 var size = opts.size;
232 var domain = trace.domain;
233
234 var transitionOpts = opts.transitionOpts;
235 var onComplete = opts.onComplete;
236
237 // preparing axis
238 var ax, vals, transFn, tickSign, shift;
239
240 // Enter bullet, axis
241 bullet.enter().append('g').classed('bullet', true);
242 bullet.attr('transform', strTranslate(size.l, size.t));
243
244 axisLayer.enter().append('g')
245 .classed('bulletaxis', true)
246 .classed('crisp', true);
247 axisLayer.selectAll('g.' + 'xbulletaxis' + 'tick,path,text').remove();
248
249 // Draw bullet
250 var bulletHeight = size.h; // use all vertical domain
251 var innerBulletHeight = trace.gauge.bar.thickness * bulletHeight;
252 var bulletLeft = domain.x[0];
253 var bulletRight = domain.x[0] + (domain.x[1] - domain.x[0]) * ((trace._hasNumber || trace._hasDelta) ? (1 - cn.bulletNumberDomainSize) : 1);
254
255 ax = mockAxis(gd, trace.gauge.axis);
256 ax._id = 'xbulletaxis';
257 ax.domain = [bulletLeft, bulletRight];
258 ax.setScale();
259
260 vals = Axes.calcTicks(ax);
261 transFn = Axes.makeTransTickFn(ax);
262 tickSign = Axes.getTickSigns(ax)[2];
263
264 shift = size.t + size.h;
265 if(ax.visible) {
266 Axes.drawTicks(gd, ax, {
267 vals: ax.ticks === 'inside' ? Axes.clipEnds(ax, vals) : vals,
268 layer: axisLayer,
269 path: Axes.makeTickPath(ax, shift, tickSign),
270 transFn: transFn
271 });
272
273 Axes.drawLabels(gd, ax, {
274 vals: vals,
275 layer: axisLayer,
276 transFn: transFn,
277 labelFns: Axes.makeLabelFns(ax, shift)
278 });
279 }
280
281 function drawRect(s) {

Callers 1

plot.jsFile · 0.85

Calls 2

mockAxisFunction · 0.85
hasTransitionFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…