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

Function styleSpatial

src/components/legend/style.js:558–675  ·  view source on GitHub ↗
(d)

Source from the content-addressed store, hash-verified

556 }
557
558 function styleSpatial(d) {
559 // i.e. maninly traces having z and colorscale
560 var trace = d[0].trace;
561
562 var useGradient;
563 var ptsData = [];
564 if (trace.visible) {
565 switch (trace.type) {
566 case 'histogram2d':
567 case 'heatmap':
568 ptsData = [
569 ['M-15,-2V4H15V-2Z'] // similar to contour
570 ];
571 useGradient = true;
572 break;
573 case 'choropleth':
574 case 'choroplethmapbox':
575 case 'choroplethmap':
576 ptsData = [['M-6,-6V6H6V-6Z']];
577 useGradient = true;
578 break;
579 case 'densitymapbox':
580 case 'densitymap':
581 ptsData = [['M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0']];
582 useGradient = 'radial';
583 break;
584 case 'cone':
585 ptsData = [
586 ['M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z'],
587 ['M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z'],
588 ['M-6,-2 A2,2 0 0,0 -6,2 L6,0Z']
589 ];
590 useGradient = false;
591 break;
592 case 'streamtube':
593 ptsData = [
594 ['M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z'],
595 ['M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z'],
596 ['M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z']
597 ];
598 useGradient = false;
599 break;
600 case 'surface':
601 ptsData = [
602 ['M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z'],
603 ['M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z']
604 ];
605 useGradient = true;
606 break;
607 case 'mesh3d':
608 ptsData = [['M-6,6H0L-6,-6Z'], ['M6,6H0L6,-6Z'], ['M-6,-6H6L0,6Z']];
609 useGradient = false;
610 break;
611 case 'volume':
612 ptsData = [['M-6,6H0L-6,-6Z'], ['M6,6H0L6,-6Z'], ['M-6,-6H6L0,6Z']];
613 useGradient = true;
614 break;
615 case 'isosurface':

Callers

nothing calls this directly

Calls 1

extractOptsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…