File tree Expand file tree Collapse file tree 1 file changed +22
-9
lines changed Expand file tree Collapse file tree 1 file changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -104,16 +104,29 @@ class UnconnectedMarkerColor extends Component {
104104 const numberOfTraces = this . context . traceIndexes . length ;
105105 const colors = colorscale . map ( c => c [ 1 ] ) ;
106106
107- let adjustedColors = getColorscale (
108- colors ,
109- numberOfTraces ,
110- null ,
111- null ,
112- colorscaleType
113- ) ;
107+ let adjustedColors = colors ;
108+
109+ if ( colorscaleType !== 'categorical' ) {
110+ adjustedColors = getColorscale (
111+ colors ,
112+ numberOfTraces ,
113+ null ,
114+ null ,
115+ colorscaleType
116+ ) ;
117+ }
114118
115- if ( adjustedColors . every ( c => c === adjustedColors [ 0 ] ) ) {
116- adjustedColors = colors ;
119+ if (
120+ adjustedColors . every ( c => c === adjustedColors [ 0 ] ) ||
121+ colorscaleType === 'categorical'
122+ ) {
123+ const repetitions = Math . ceil ( numberOfTraces / colors . length ) ;
124+ const newArray = new Array ( repetitions ) . fill ( colors ) ;
125+ adjustedColors = newArray
126+ . reduce ( ( a , b ) => {
127+ return a . concat ( b ) ;
128+ } , [ ] )
129+ . slice ( 0 , numberOfTraces ) ;
117130 }
118131
119132 const updates = adjustedColors . map ( color => ( {
You can’t perform that action at this time.
0 commit comments