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

Function determineSearchTraces

src/components/selections/select.js:783–822  ·  view source on GitHub ↗
(gd, xAxes, yAxes, subplot)

Source from the content-addressed store, hash-verified

781}
782
783function determineSearchTraces(gd, xAxes, yAxes, subplot) {
784 if(!gd.calcdata) return [];
785
786 var searchTraces = [];
787 var xAxisIds = xAxes.map(getAxId);
788 var yAxisIds = yAxes.map(getAxId);
789 var cd, trace, i;
790
791 for(i = 0; i < gd.calcdata.length; i++) {
792 cd = gd.calcdata[i];
793 trace = cd[0].trace;
794
795 if(trace.visible !== true || !trace._module || !trace._module.selectPoints) continue;
796
797 if(
798 hasSubplot({subplot: subplot}) &&
799 (trace.subplot === subplot || trace.geo === subplot)
800 ) {
801 searchTraces.push(createSearchInfo(trace._module, cd, xAxes[0], yAxes[0]));
802 } else if(trace.type === 'splom') {
803 // FIXME: make sure we don't have more than single axis for splom
804 if(trace._xaxes[xAxisIds[0]] && trace._yaxes[yAxisIds[0]]) {
805 var info = createSearchInfo(trace._module, cd, xAxes[0], yAxes[0]);
806 info.scene = gd._fullLayout._splomScenes[trace.uid];
807 searchTraces.push(info);
808 }
809 } else if(trace.type === 'sankey') {
810 var sankeyInfo = createSearchInfo(trace._module, cd, xAxes[0], yAxes[0]);
811 searchTraces.push(sankeyInfo);
812 } else {
813 if(xAxisIds.indexOf(trace.xaxis) === -1 && (!trace._xA || !trace._xA.overlaying)) continue;
814 if(yAxisIds.indexOf(trace.yaxis) === -1 && (!trace._yA || !trace._yA.overlaying)) continue;
815
816 searchTraces.push(createSearchInfo(trace._module, cd,
817 getFromId(gd, trace.xaxis), getFromId(gd, trace.yaxis)));
818 }
819 }
820
821 return searchTraces;
822}
823
824function createSearchInfo(module, calcData, xaxis, yaxis) {
825 return {

Callers 4

prepSelectFunction · 0.85
selectOnClickFunction · 0.85
reselectFunction · 0.85
deselectSubplotFunction · 0.85

Calls 2

hasSubplotFunction · 0.85
createSearchInfoFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…