@@ -539,16 +539,12 @@ export const HoverInfo = connectToContainer(UnconnectedFlaglist, {
539539 ] . includes ( container . type )
540540 ) {
541541 options . push ( { label : _ ( 'Z' ) , value : 'z' } ) ;
542- }
543-
544- if ( container . type === 'choropleth' ) {
542+ } else if ( container . type === 'choropleth' ) {
545543 options = [
546544 { label : _ ( 'Location' ) , value : 'location' } ,
547545 { label : _ ( 'Values' ) , value : 'z' } ,
548546 ] ;
549- }
550-
551- if ( container . type === 'scattergeo' ) {
547+ } else if ( container . type === 'scattergeo' ) {
552548 if ( container . locations ) {
553549 options = [ { label : _ ( 'Location' ) , value : 'location' } ] ;
554550 } else if ( container . lat || container . lon ) {
@@ -557,40 +553,30 @@ export const HoverInfo = connectToContainer(UnconnectedFlaglist, {
557553 { label : _ ( 'Latitude' ) , value : 'lat' } ,
558554 ] ;
559555 }
560- }
561-
562- if ( container . type === 'scattermapbox' ) {
556+ } else if ( container . type === 'scattermapbox' ) {
563557 options = [
564558 { label : _ ( 'Longitude' ) , value : 'loc' } ,
565559 { label : _ ( 'Latitude' ) , value : 'lat' } ,
566560 ] ;
567- }
568-
569- if ( container . type === 'scatterternary' ) {
561+ } else if ( container . type === 'scatterternary' ) {
570562 options = [
571563 { label : _ ( 'A' ) , value : 'a' } ,
572564 { label : _ ( 'B' ) , value : 'b' } ,
573565 { label : _ ( 'C' ) , value : 'c' } ,
574566 ] ;
575- }
576-
577- if ( container . type === 'table' ) {
578- plotProps . isVisible = false ;
579- }
580-
581- if ( [ 'scatterpolar' , 'scatterpolargl' ] . includes ( container . type ) ) {
567+ } else if ( [ 'scatterpolar' , 'scatterpolargl' ] . includes ( container . type ) ) {
582568 options = [
583569 { label : _ ( 'R' ) , value : 'r' } ,
584570 { label : _ ( 'Theta' ) , value : 'theta' } ,
585571 ] ;
586- }
587-
588- if ( container . type === 'pie' ) {
572+ } else if ( container . type === 'pie' ) {
589573 options = [
590574 { label : _ ( 'Label' ) , value : 'label' } ,
591575 { label : _ ( 'Value' ) , value : 'value' } ,
592576 { label : _ ( 'Percent' ) , value : 'percent' } ,
593577 ] ;
578+ } else if ( container . type === 'table' ) {
579+ plotProps . isVisible = false ;
594580 }
595581
596582 if ( container . text ) {
@@ -625,9 +611,7 @@ export const FillDropdown = connectToContainer(UnconnectedDropdown, {
625611 { label : _ ( 'To Self' ) , value : 'toself' } ,
626612 { label : _ ( 'To Next' ) , value : 'tonext' } ,
627613 ] ;
628- }
629-
630- if (
614+ } else if (
631615 context . container . type === 'scattergeo' ||
632616 context . container . type === 'scattermapbox'
633617 ) {
@@ -641,3 +625,55 @@ export const FillDropdown = connectToContainer(UnconnectedDropdown, {
641625 plotProps . clearable = false ;
642626 } ,
643627} ) ;
628+
629+ export const HoveronDropdown = connectToContainer ( UnconnectedDropdown , {
630+ modifyPlotProps : ( props , context , plotProps ) => {
631+ const { localize : _ } = context ;
632+
633+ let options ;
634+ if ( context . container . type === 'box' ) {
635+ options = [
636+ { label : _ ( 'Boxes' ) , value : 'boxes' } ,
637+ { label : _ ( 'Points' ) , value : 'points' } ,
638+ { label : _ ( 'Boxes and Points' ) , value : 'boxes+points' } ,
639+ ] ;
640+ } else if ( context . container . type === 'violin' ) {
641+ options = [
642+ { label : _ ( 'Violins' ) , value : 'violins' } ,
643+ { label : _ ( 'Points' ) , value : 'points' } ,
644+ { label : _ ( 'KDE' ) , value : 'kde' } ,
645+ { label : _ ( 'Violins and Points' ) , value : 'violins+points' } ,
646+ { label : _ ( 'Violins, Points and KDE' ) , value : 'violins+points+kde' } ,
647+ ] ;
648+ } else {
649+ options = [
650+ { label : _ ( 'Points' ) , value : 'points' } ,
651+ { label : _ ( 'Fills' ) , value : 'fills' } ,
652+ { label : _ ( 'Points and Fills' ) , value : 'points+fills' } ,
653+ ] ;
654+ }
655+
656+ plotProps . options = options ;
657+ plotProps . clearable = false ;
658+ } ,
659+ } ) ;
660+
661+ export const HovermodeDropdown = connectToContainer ( UnconnectedDropdown , {
662+ modifyPlotProps : ( props , context , plotProps ) => {
663+ const { localize : _ } = context ;
664+
665+ plotProps . options =
666+ context . container . xaxis && Object . keys ( context . container . xaxis ) . length > 0
667+ ? [
668+ { label : _ ( 'Closest' ) , value : 'closest' } ,
669+ { label : _ ( 'X Axis' ) , value : 'x' } ,
670+ { label : _ ( 'Y Axis' ) , value : 'y' } ,
671+ { label : _ ( 'Disable' ) , value : false } ,
672+ ]
673+ : [
674+ { label : _ ( 'Closest' ) , value : 'closest' } ,
675+ { label : _ ( 'Disable' ) , value : false } ,
676+ ] ;
677+ plotProps . clearable = false ;
678+ } ,
679+ } ) ;
0 commit comments