MCPcopy Create free account
hub / github.com/plotly/plotly.js / calcMarkerSize

Function calcMarkerSize

src/traces/scatter/calc.js:223–257  ·  view source on GitHub ↗
(trace, serieslen)

Source from the content-addressed store, hash-verified

221}
222
223function calcMarkerSize(trace, serieslen) {
224 if(!subTypes.hasMarkers(trace)) return;
225
226 // Treat size like x or y arrays --- Run d2c
227 // this needs to go before ppad computation
228 var marker = trace.marker;
229 var sizeref = 1.6 * (trace.marker.sizeref || 1);
230 var markerTrans;
231
232 if(trace.marker.sizemode === 'area') {
233 markerTrans = function(v) {
234 return Math.max(Math.sqrt((v || 0) / sizeref), 3);
235 };
236 } else {
237 markerTrans = function(v) {
238 return Math.max((v || 0) / sizeref, 3);
239 };
240 }
241
242 if(Lib.isArrayOrTypedArray(marker.size)) {
243 // I tried auto-type but category and dates dont make much sense.
244 var ax = {type: 'linear'};
245 Axes.setConvert(ax);
246
247 var s = ax.makeCalcdata(trace.marker, 'size');
248
249 var sizeOut = new Array(serieslen);
250 for(var i = 0; i < serieslen; i++) {
251 sizeOut[i] = markerTrans(s[i]);
252 }
253 return sizeOut;
254 } else {
255 return markerTrans(marker.size);
256 }
257}
258
259/**
260 * mark the first scatter trace for each subplot

Callers 9

calc.jsFile · 0.85
calc.jsFile · 0.85
calc.jsFile · 0.85
calcFunction · 0.85
calcGeoJSONFunction · 0.85
calc.jsFile · 0.85
calc.jsFile · 0.85
calc.jsFile · 0.85
calc.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…