@@ -135,40 +135,17 @@ export function parseData(data: { series: any[] }, options: { valueField: any },
135135 return [ { links : [ ] , nodes : [ ] } , [ ] , [ ] , null , fixColor ] ;
136136 }
137137
138- // Helper to detect if a field is a color column
139- const isColorColumn = ( field : Field < any , Vector < any > > ) : boolean => {
140- const fieldName = getFieldDisplayName ( field ) . toLowerCase ( ) ;
138+ // If we have 4 columns, the 3rd column (index 2) is the color column
139+ const hasColorColumn = numFields === 4 ;
140+ const colorFieldIndex = hasColorColumn ? 2 : - 1 ;
141141
142- // Check if field name suggests it's a color
143- if ( fieldName === 'color' || fieldName === 'colour' ) {
144- return true ;
145- }
146-
147- // Check if field type is string and values look like colors
148- if ( field . type === 'string' && field . values . length > 0 ) {
149- const sampleValue = field . values . get ( 0 ) ;
150- if ( sampleValue ) {
151- const colorPattern = / ^ ( # [ 0 - 9 a - f A - F ] { 3 , 8 } | r g b | h s l | [ a - z \- ] + ) $ / i;
152- return colorPattern . test ( String ( sampleValue ) . trim ( ) ) ;
153- }
154- }
155-
156- return false ;
157- } ;
158-
159- // Detect if we have a color column
160- let colorFieldIndex = - 1 ;
161- if ( numFields === 4 ) {
162- // Check the third column (index 2) for color
163- if ( isColorColumn ( allData [ 2 ] ) ) {
164- colorFieldIndex = 2 ;
165- }
166- }
167-
168- // get display names
142+ // get display names (exclude color column if present)
169143 let displayNames : string [ ] = [ ] ;
170- allData . forEach ( ( field : Field < any , Vector < any > > ) => {
171- displayNames . push ( getFieldDisplayName ( field ) ) ;
144+ allData . forEach ( ( field : Field < any , Vector < any > > , index : number ) => {
145+ // Skip the color column in display names
146+ if ( index !== colorFieldIndex ) {
147+ displayNames . push ( getFieldDisplayName ( field ) ) ;
148+ }
172149 } ) ;
173150
174151 // Find value field (should be the numeric field, typically the 3rd column)
0 commit comments