File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -106,14 +106,19 @@ class UnconnectedMarkerColor extends Component {
106106 let adjustedColors = colors ;
107107
108108 if ( colorscaleType !== 'categorical' ) {
109- adjustedColors = adjustColorscale ( colors , numberOfTraces ) ;
109+ adjustedColors = adjustColorscale ( colors , numberOfTraces , colorscaleType ) ;
110110 }
111111
112112 if (
113113 adjustedColors . every ( c => c === adjustedColors [ 0 ] ) ||
114114 colorscaleType === 'categorical'
115115 ) {
116- adjustedColors = adjustColorscale ( colors , numberOfTraces , { repeat : true } ) ;
116+ adjustedColors = adjustColorscale (
117+ colors ,
118+ numberOfTraces ,
119+ colorscaleType ,
120+ { repeat : true }
121+ ) ;
117122 }
118123
119124 const updates = adjustedColors . map ( color => ( {
Original file line number Diff line number Diff line change @@ -182,7 +182,11 @@ function adjustColorscale(
182182 colorscaleType ,
183183 config
184184) {
185- if ( config . repeat ) {
185+ if ( config && config . repeat ) {
186+ if ( numberOfNeededColors < colorscale . length ) {
187+ return colorscale . slice ( 0 , numberOfNeededColors ) ;
188+ }
189+
186190 const repetitions = Math . ceil ( numberOfNeededColors / colorscale . length ) ;
187191 const newArray = new Array ( repetitions ) . fill ( colorscale ) ;
188192 return newArray
You can’t perform that action at this time.
0 commit comments