(calcTrace, fullLayout)
| 66 | } |
| 67 | |
| 68 | function calcGeoJSON(calcTrace, fullLayout) { |
| 69 | var trace = calcTrace[0].trace; |
| 70 | var geoLayout = fullLayout[trace.geo]; |
| 71 | var geo = geoLayout._subplot; |
| 72 | var len = trace._length; |
| 73 | var i, calcPt; |
| 74 | |
| 75 | if(Lib.isArrayOrTypedArray(trace.locations)) { |
| 76 | var locationmode = trace.locationmode; |
| 77 | var features = locationmode === 'geojson-id' ? |
| 78 | geoUtils.extractTraceFeature(calcTrace) : |
| 79 | getTopojsonFeatures(trace, geo.topojson); |
| 80 | |
| 81 | for(i = 0; i < len; i++) { |
| 82 | calcPt = calcTrace[i]; |
| 83 | |
| 84 | var feature = locationmode === 'geojson-id' ? |
| 85 | calcPt.fOut : |
| 86 | geoUtils.locationToFeature(locationmode, calcPt.loc, features); |
| 87 | |
| 88 | calcPt.lonlat = feature ? feature.properties.ct : [BADNUM, BADNUM]; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | var opts = {padded: true}; |
| 93 | var lonArray; |
| 94 | var latArray; |
| 95 | |
| 96 | if(geoLayout.fitbounds === 'geojson' && trace.locationmode === 'geojson-id') { |
| 97 | var bboxGeojson = geoUtils.computeBbox(geoUtils.getTraceGeojson(trace)); |
| 98 | lonArray = [bboxGeojson[0], bboxGeojson[2]]; |
| 99 | latArray = [bboxGeojson[1], bboxGeojson[3]]; |
| 100 | } else { |
| 101 | lonArray = new Array(len); |
| 102 | latArray = new Array(len); |
| 103 | for(i = 0; i < len; i++) { |
| 104 | calcPt = calcTrace[i]; |
| 105 | lonArray[i] = calcPt.lonlat[0]; |
| 106 | latArray[i] = calcPt.lonlat[1]; |
| 107 | } |
| 108 | |
| 109 | opts.ppad = calcMarkerSize(trace, len); |
| 110 | } |
| 111 | |
| 112 | trace._extremes.lon = findExtremes(geoLayout.lonaxis._ax, lonArray, opts); |
| 113 | trace._extremes.lat = findExtremes(geoLayout.lataxis._ax, latArray, opts); |
| 114 | } |
| 115 | |
| 116 | module.exports = { |
| 117 | calcGeoJSON: calcGeoJSON, |
nothing calls this directly
no test coverage detected
searching dependent graphs…