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

Function plot

src/traces/scattergeo/plot.js:16–66  ·  view source on GitHub ↗
(gd, geo, calcData)

Source from the content-addressed store, hash-verified

14var style = require('./style');
15
16function plot(gd, geo, calcData) {
17 var scatterLayer = geo.layers.frontplot.select('.scatterlayer');
18 var gTraces = Lib.makeTraceGroups(scatterLayer, calcData, 'trace scattergeo');
19
20 function removeBADNUM(d, node) {
21 if(d.lonlat[0] === BADNUM) {
22 d3.select(node).remove();
23 }
24 }
25
26 // TODO find a way to order the inner nodes on update
27 gTraces.selectAll('*').remove();
28
29 gTraces.each(function(calcTrace) {
30 var s = d3.select(this);
31 var trace = calcTrace[0].trace;
32
33 if(subTypes.hasLines(trace) || trace.fill !== 'none') {
34 var lineCoords = geoJsonUtils.calcTraceToLineCoords(calcTrace);
35
36 var lineData = (trace.fill !== 'none') ?
37 geoJsonUtils.makePolygon(lineCoords) :
38 geoJsonUtils.makeLine(lineCoords);
39
40 s.selectAll('path.js-line')
41 .data([{geojson: lineData, trace: trace}])
42 .enter().append('path')
43 .classed('js-line', true)
44 .style('stroke-miterlimit', 2);
45 }
46
47 if(subTypes.hasMarkers(trace)) {
48 s.selectAll('path.point')
49 .data(Lib.identity)
50 .enter().append('path')
51 .classed('point', true)
52 .each(function(calcPt) { removeBADNUM(calcPt, this); });
53 }
54
55 if(subTypes.hasText(trace)) {
56 s.selectAll('g')
57 .data(Lib.identity)
58 .enter().append('g')
59 .append('text')
60 .each(function(calcPt) { removeBADNUM(calcPt, this); });
61 }
62
63 // call style here within topojson request callback
64 style(gd, calcTrace);
65 });
66}
67
68function calcGeoJSON(calcTrace, fullLayout) {
69 var trace = calcTrace[0].trace;

Callers 1

base_plot.jsFile · 0.50

Calls 2

removeBADNUMFunction · 0.85
styleFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…