Skip to content

Commit d5f007f

Browse files
committed
debugging
1 parent 75e79e5 commit d5f007f

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ You can optionally add a 4th column to specify custom colors for each link:
4343
3. **Color** - The color for this specific link (string)
4444
4. **Value** - The numeric value/weight of the flow (number)
4545

46-
The color column is automatically detected by:
47-
- **Column name**: If the column is named "color" or "colour"
48-
- **Column values**: If the values look like colors (hex codes, rgb, hsl, or CSS color names)
46+
When you provide 4 columns, the 3rd column is automatically treated as the color column and will not appear as a header in the panel.
4947

5048
Example query result with colors:
5149
```

src/dataParser.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)