(_props: Props)
| 85 | } |
| 86 | |
| 87 | function _Chart(_props: Props) { |
| 88 | class __Chart extends base.react.Component<Props, State> { |
| 89 | private choiceRef?: React.RefObject<FluentUITypes.IChoiceGroup>; |
| 90 | constructor(props: Props) { |
| 91 | super(props); |
| 92 | this.state = { |
| 93 | showTooltipDialog: false, |
| 94 | }; |
| 95 | this.choiceRef = base.react.createRef<FluentUITypes.IChoiceGroup>(); |
| 96 | props.explorer.dialogFocusHandler.focus = () => this.choiceRef.current?.focus(); |
| 97 | } |
| 98 | |
| 99 | render() { |
| 100 | const { props } = this; |
| 101 | const { explorer, specCapabilities } = props; |
| 102 | const signals = explorer.viewer && |
| 103 | explorer.viewer.vegaSpec && |
| 104 | specCapabilities && |
| 105 | specCapabilities.signals && |
| 106 | explorer.viewer.vegaSpec.signals.filter(s => specCapabilities.signals.indexOf(s.name) >= 0); |
| 107 | return ( |
| 108 | <div> |
| 109 | <Group label={strings.labelChart}> |
| 110 | <div className="calculator"> |
| 111 | <base.fluentUI.ChoiceGroup |
| 112 | componentRef={this.choiceRef} |
| 113 | className="sanddance-chart-type" |
| 114 | options={chartLabelMap.map(o => { |
| 115 | return { |
| 116 | ...o, |
| 117 | checked: props.chart === o.key, |
| 118 | disabled: props.disabled |
| 119 | || (o.key === 'treemap' && props.quantitativeColumns.length === 0), |
| 120 | }; |
| 121 | })} |
| 122 | onChange={(e, o) => props.onChangeChartType(o.key as SandDance.specs.Chart)} |
| 123 | /> |
| 124 | </div> |
| 125 | </Group> |
| 126 | <Group label={strings.labelColumnMapping}> |
| 127 | <div> |
| 128 | {specCapabilities && specCapabilities.roles.map((specRole, i) => { |
| 129 | const specColumnInRole = props.insightColumns[specRole.role]; |
| 130 | const selectedColumnName = specColumnInRole; |
| 131 | let disabledColumnName: string; |
| 132 | let prefix: JSX.Element; |
| 133 | let suffix: JSX.Element; |
| 134 | let hideDropdown = false; |
| 135 | let { totalStyle } = props; |
| 136 | if (!totalStyle) { |
| 137 | totalStyle = 'count-square'; |
| 138 | } |
| 139 | let { facetStyle } = props; |
| 140 | if (!facetStyle) { |
| 141 | facetStyle = 'wrap'; |
| 142 | } |
| 143 | switch (specRole.role) { |
| 144 | case 'facet': { |
nothing calls this directly
no outgoing calls
no test coverage detected