@@ -8,18 +8,17 @@ import { DataFrameView, Field, getFieldDisplayName, Vector } from '@grafana/data
88 * - 3 columns: source, destination, value
99 * - 4 columns: source, destination, color, value
1010 *
11- * The color column is automatically detected by:
12- * - Column name being "color" or "colour"
13- * - Column values looking like color strings (hex codes, rgb, hsl, or color names)
11+ * When 4 columns are provided, the 3rd column is treated as the color column.
12+ * The color column is excluded from display names (headers).
1413 *
15- * It automatically builds multi-step Sankey diagrams by detecting flow paths
14+ * It automatically builds multi-step Sankey diagrams by detecting flow paths.
1615 *
1716 * @param data the data returned by the query
1817 * @param options the field options from the editor panel
1918 * @param monochrome the boolean in the editor panel that sets whether the sankey is single or multi colored
2019 * @param color the color chosen in the editor panel for the sankey links if monochrome bool is true
2120 * @return {pluginData } the node and link data for the d3-sankey
22- * @return {displayNames } the display names for the headers
21+ * @return {displayNames } the display names for the headers (excludes color column)
2322 * @return {rowDisplayNames }
2423 * @return {valueField[0] }
2524 */
@@ -148,6 +147,8 @@ export function parseData(data: { series: any[] }, options: { valueField: any },
148147 }
149148 } ) ;
150149
150+ console . log ( 'DataParser: numFields=' , numFields , 'hasColorColumn=' , hasColorColumn , 'colorFieldIndex=' , colorFieldIndex , 'displayNames=' , displayNames ) ;
151+
151152 // Find value field (should be the numeric field, typically the 3rd column)
152153 let valueField = data . series . map ( ( series : { fields : any [ ] } ) =>
153154 series . fields . find ( ( field : { name : any } ) => field . name === options . valueField )
0 commit comments