@@ -35,6 +35,7 @@ export function getSuggestions({
3535 table,
3636 state,
3737 keptLayerIds,
38+ subVisualizationId,
3839} : SuggestionRequest < State > ) : Array < VisualizationSuggestion < State > > {
3940 if (
4041 // We only render line charts for multi-row queries. We require at least
@@ -66,7 +67,12 @@ export function getSuggestions({
6667 return [ ] ;
6768 }
6869
69- const suggestions = getSuggestionForColumns ( table , keptLayerIds , state ) ;
70+ const suggestions = getSuggestionForColumns (
71+ table ,
72+ keptLayerIds ,
73+ state ,
74+ subVisualizationId as SeriesType | undefined
75+ ) ;
7076
7177 if ( suggestions && suggestions instanceof Array ) {
7278 return suggestions ;
@@ -78,7 +84,8 @@ export function getSuggestions({
7884function getSuggestionForColumns (
7985 table : TableSuggestion ,
8086 keptLayerIds : string [ ] ,
81- currentState ?: State
87+ currentState ?: State ,
88+ seriesType ?: SeriesType
8289) : VisualizationSuggestion < State > | Array < VisualizationSuggestion < State > > | undefined {
8390 const [ buckets , values ] = partition ( table . columns , ( col ) => col . operation . isBucketed ) ;
8491
@@ -93,6 +100,7 @@ function getSuggestionForColumns(
93100 currentState,
94101 tableLabel : table . label ,
95102 keptLayerIds,
103+ requestedSeriesType : seriesType ,
96104 } ) ;
97105 } else if ( buckets . length === 0 ) {
98106 const [ x , ...yValues ] = prioritizeColumns ( values ) ;
@@ -105,6 +113,7 @@ function getSuggestionForColumns(
105113 currentState,
106114 tableLabel : table . label ,
107115 keptLayerIds,
116+ requestedSeriesType : seriesType ,
108117 } ) ;
109118 }
110119}
@@ -190,6 +199,7 @@ function getSuggestionsForLayer({
190199 currentState,
191200 tableLabel,
192201 keptLayerIds,
202+ requestedSeriesType,
193203} : {
194204 layerId : string ;
195205 changeType : TableChangeType ;
@@ -199,9 +209,11 @@ function getSuggestionsForLayer({
199209 currentState ?: State ;
200210 tableLabel ?: string ;
201211 keptLayerIds : string [ ] ;
212+ requestedSeriesType ?: SeriesType ;
202213} ) : VisualizationSuggestion < State > | Array < VisualizationSuggestion < State > > {
203214 const title = getSuggestionTitle ( yValues , xValue , tableLabel ) ;
204- const seriesType : SeriesType = getSeriesType ( currentState , layerId , xValue ) ;
215+ const seriesType : SeriesType =
216+ requestedSeriesType || getSeriesType ( currentState , layerId , xValue ) ;
205217
206218 const options = {
207219 currentState,
0 commit comments