@@ -4,6 +4,7 @@ import {UnconnectedFlaglist} from './Flaglist';
44import { UnconnectedNumeric } from './Numeric' ;
55import { UnconnectedAxisRangeValue } from './AxisRangeValue' ;
66import { UnconnectedRadio } from './Radio' ;
7+ import Info from './Info' ;
78import {
89 connectToContainer ,
910 getAllAxes ,
@@ -144,67 +145,55 @@ export const ContourNumeric = connectToContainer(UnconnectedNumeric, {
144145 } ,
145146} ) ;
146147
147- export const TraceOrientation = connectToContainer ( UnconnectedRadio , {
148+ export const BinningNumeric = connectToContainer ( UnconnectedNumeric , {
148149 modifyPlotProps : ( props , context , plotProps ) => {
150+ const { fullContainer} = plotProps ;
149151 if (
150- context . container . type === 'box' &&
151- plotProps . fullValue === 'h' &&
152- context . container . y &&
153- context . container . y . length !== 0
154- ) {
155- context . updateContainer ( {
156- y : null ,
157- ysrc : null ,
158- x : context . container . y ,
159- xsrc : context . container . ysrc ,
160- } ) ;
161- }
162-
163- if (
164- context . container . type === 'box' &&
165- plotProps . fullValue === 'v' &&
166- context . container . x &&
167- context . container . x . length !== 0
152+ plotProps . isVisible &&
153+ fullContainer &&
154+ fullContainer [ `autobin${ props . axis } ` ]
168155 ) {
169- context . updateContainer ( {
170- x : null ,
171- xsrc : null ,
172- y : context . container . x ,
173- ysrc : context . container . xsrc ,
174- } ) ;
156+ plotProps . isVisible = false ;
175157 }
158+ } ,
159+ } ) ;
176160
177- if (
178- context . container . type === 'histogram' &&
179- plotProps . fullValue === 'v' &&
180- context . container . y &&
181- context . container . y . length !== 0
182- ) {
183- context . updateContainer ( {
184- y : null ,
185- ysrc : null ,
186- ybins : null ,
187- x : context . container . y ,
188- xsrc : context . container . ysrc ,
189- xbins : context . container . ybins ,
190- } ) ;
191- }
161+ export const BinningDropdown = connectToContainer ( UnconnectedDropdown , {
162+ modifyPlotProps : ( props , context , plotProps ) => {
163+ const { localize : _ } = context ;
164+ plotProps . options =
165+ plotProps . fullContainer . orientation === 'v'
166+ ? [
167+ { label : _ ( 'Count X' ) , value : 'count' } ,
168+ { label : _ ( 'Sum Y' ) , value : 'sum' } ,
169+ { label : _ ( 'Average Y' ) , value : 'avg' } ,
170+ { label : _ ( 'Minimum Y' ) , value : 'min' } ,
171+ { label : _ ( 'Maximum Y' ) , value : 'max' } ,
172+ ]
173+ : [
174+ { label : _ ( 'Count Y' ) , value : 'count' } ,
175+ { label : _ ( 'Sum X' ) , value : 'sum' } ,
176+ { label : _ ( 'Average X' ) , value : 'avg' } ,
177+ { label : _ ( 'Minimum X' ) , value : 'min' } ,
178+ { label : _ ( 'Maximum X' ) , value : 'max' } ,
179+ ] ;
180+ } ,
181+ } ) ;
192182
193- if (
194- context . container . type === 'histogram' &&
195- plotProps . fullValue === 'h' &&
196- context . container . x &&
197- context . container . x . length !== 0
198- ) {
199- context . updateContainer ( {
200- x : null ,
201- xsrc : null ,
202- xbins : null ,
203- y : context . container . x ,
204- ysrc : context . container . xsrc ,
205- ybins : context . container . xbins ,
206- } ) ;
207- }
183+ export const HistogramInfoVertical = connectToContainer ( Info , {
184+ modifyPlotProps : ( props , context , plotProps ) => {
185+ plotProps . isVisible =
186+ context . fullContainer . type === 'histogram' &&
187+ context . fullContainer . orientation === 'v' ;
188+ return plotProps ;
189+ } ,
190+ } ) ;
191+ export const HistogramInfoHorizontal = connectToContainer ( Info , {
192+ modifyPlotProps : ( props , context , plotProps ) => {
193+ plotProps . isVisible =
194+ context . fullContainer . type === 'histogram' &&
195+ context . fullContainer . orientation === 'h' ;
196+ return plotProps ;
208197 } ,
209198} ) ;
210199
0 commit comments