Skip to content

Commit 403b48c

Browse files
committed
2 parents 189a86d + e037886 commit 403b48c

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "netsage-sankey-panel",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"description": "Sankey Panel Plugin for Grafana",
55
"license": "Apache-2.0",
66
"repository": "https://github.com/netsage-project/netsage-sankey-panel",

src/components/Tooltip.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,14 @@ export const Tooltip: React.FC<TooltipProps> = ({ rowNames, field, panelId }) =>
4242
return text;
4343
})
4444
.style('padding', '10px 15px')
45-
.style('background', 'black')
45+
.style('background', '#19191A')
4646
.style('color', 'white')
47-
.style('border', '#A8A8A8 solid 5px')
47+
.style('border', '#A8A8A8 solid 2px')
4848
.style('border-radius', '5px')
4949
.style('left', mousePosition.mouseX + 'px')
5050
.style('top', mousePosition.mouseY + 'px')
5151
.style('opacity', 0)
52+
.style('z-index','1')
5253
.style('position', 'absolute');
5354
div.transition().duration(200).style('opacity', 0.8);
5455
})
@@ -91,13 +92,14 @@ export const Tooltip: React.FC<TooltipProps> = ({ rowNames, field, panelId }) =>
9192
return text;
9293
})
9394
.style('padding', '10px 15px')
94-
.style('background', 'black')
95+
.style('background', '#19191A')
9596
.style('color', 'white')
96-
.style('border', '#A8A8A8 solid 5px')
97+
.style('border', '#A8A8A8 solid 2px')
9798
.style('border-radius', '5px')
9899
.style('left', mousePosition.mouseX + 'px')
99100
.style('top', mousePosition.mouseY + 'px')
100101
.style('opacity', 0)
102+
.style('z-index', '1')
101103
.style('position', 'absolute');
102104
div.transition().duration(200).style('opacity', 0.8);
103105
})

src/dataParser.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { DataFrameView, Field, getFieldDisplayName, Vector } from '@grafana/data
1313
* @return {valueField[0]}
1414
*/
1515
export function parseData(data: { series: any[] }, options: { valueField: any }, monochrome: boolean, color: any) {
16-
const valueFieldName = options.valueField;
16+
1717

1818
/**
1919
* Colors
@@ -126,13 +126,25 @@ export function parseData(data: { series: any[] }, options: { valueField: any },
126126
});
127127

128128
// Find selected value field or default to the first number field and use for values.
129-
const valueField = valueFieldName
130-
? data.series.map((series: { fields: any[] }) =>
131-
series.fields.find((field: { name: any }) => field.name === valueFieldName)
132-
)
133-
: data.series.map((series: { fields: any[] }) =>
129+
// const valueFieldName = options.valueField;
130+
// const valueField = options.valueField
131+
// ? data.series.map((series: { fields: any[] }) =>
132+
// series.fields.find((field: { name: any }) => field.name === options.valueField)
133+
// )
134+
// : data.series.map((series: { fields: any[] }) =>
135+
// series.fields.find((field: { type: string }) => field.type === 'number')
136+
// );
137+
// Fix to avoid erroring out when value field is hidden by transform
138+
let valueField = data.series.map((series: { fields: any[] }) =>
139+
series.fields.find((field: { name: any }) => field.name === options.valueField)
140+
)
141+
if(!valueField[0]) {
142+
valueField = data.series.map((series: { fields: any[] }) =>
134143
series.fields.find((field: { type: string }) => field.type === 'number')
135144
);
145+
}
146+
147+
136148

137149
let values = [];
138150
valueField[0].values.map((value: any) => {

0 commit comments

Comments
 (0)