@@ -389,13 +389,28 @@ const EncodingOptionsPanel = ({
389389 } , [ components , fields , encoding . field ] ) ;
390390
391391 const hasStandardError = useMemo ( ( ) => {
392- return components . find ( ( d ) =>
392+ return ! ! components . find ( ( d ) =>
393393 d . related ?. some (
394394 ( r ) => r . type === "StandardError" && r . id === component ?. id
395395 )
396396 ) ;
397397 } , [ components , component ] ) ;
398398
399+ const hasConfidenceInterval = useMemo ( ( ) => {
400+ const upperBoundComponent = components . find ( ( d ) =>
401+ d . related ?. some (
402+ ( r ) => r . type === "ConfidenceUpperBound" && r . id === component ?. id
403+ )
404+ ) ;
405+ const lowerBoundComponent = components . find ( ( d ) =>
406+ d . related ?. some (
407+ ( r ) => r . type === "ConfidenceLowerBound" && r . id === component ?. id
408+ )
409+ ) ;
410+
411+ return ! ! upperBoundComponent && ! ! lowerBoundComponent ;
412+ } , [ components , component ] ) ;
413+
399414 const hasColorPalette = ! ! encoding . options ?. colorPalette ;
400415
401416 const hasSubOptions =
@@ -436,7 +451,7 @@ const EncodingOptionsPanel = ({
436451 < ChartOptionSwitchField
437452 path = "showStandardError"
438453 field = { encoding . field }
439- defaultValue = { true }
454+ defaultValue
440455 label = { t ( { id : "controls.section.show-standard-error" } ) }
441456 sx = { { marginRight : 0 } }
442457 />
@@ -456,6 +471,41 @@ const EncodingOptionsPanel = ({
456471 />
457472 </ Box >
458473 ) }
474+ { encoding . options ?. showConfidenceInterval &&
475+ hasConfidenceInterval && (
476+ < Box
477+ sx = { {
478+ display : "flex" ,
479+ gap : 1 ,
480+ alignItems : "center" ,
481+ mt : 3 ,
482+ } }
483+ >
484+ < ChartOptionSwitchField
485+ path = "showConfidenceInterval"
486+ field = { encoding . field }
487+ defaultValue
488+ label = { t ( {
489+ id : "controls.section.show-confidence-interval" ,
490+ } ) }
491+ sx = { { marginRight : 0 } }
492+ />
493+ < InfoIconTooltip
494+ enterDelay = { 600 }
495+ PopperProps = { { sx : { maxWidth : 160 } } }
496+ title = {
497+ < TooltipTitle
498+ text = {
499+ < Trans id = "controls.section.show-confidence-interval.explanation" >
500+ Show uncertainties extending from data points to
501+ represent confidence intervals
502+ </ Trans >
503+ }
504+ />
505+ }
506+ />
507+ </ Box >
508+ ) }
459509 { encoding . options ?. useAbbreviations && (
460510 < ControlSectionContent
461511 component = "fieldset"
0 commit comments