Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.1.2 #26

Merged
merged 3 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "netsage-sankey-panel",
"version": "1.1.1",
"version": "1.1.2",
"description": "Sankey Panel Plugin for Grafana",
"license": "Apache-2.0",
"repository": "https://github.com/netsage-project/netsage-sankey-panel",
Expand Down
10 changes: 6 additions & 4 deletions src/components/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ export const Tooltip: React.FC<TooltipProps> = ({ rowNames, field, panelId }) =>
return text;
})
.style('padding', '10px 15px')
.style('background', 'black')
.style('background', '#19191A')
.style('color', 'white')
.style('border', '#A8A8A8 solid 5px')
.style('border', '#A8A8A8 solid 2px')
.style('border-radius', '5px')
.style('left', mousePosition.mouseX + 'px')
.style('top', mousePosition.mouseY + 'px')
.style('opacity', 0)
.style('z-index','1')
.style('position', 'absolute');
div.transition().duration(200).style('opacity', 0.8);
})
Expand Down Expand Up @@ -91,13 +92,14 @@ export const Tooltip: React.FC<TooltipProps> = ({ rowNames, field, panelId }) =>
return text;
})
.style('padding', '10px 15px')
.style('background', 'black')
.style('background', '#19191A')
.style('color', 'white')
.style('border', '#A8A8A8 solid 5px')
.style('border', '#A8A8A8 solid 2px')
.style('border-radius', '5px')
.style('left', mousePosition.mouseX + 'px')
.style('top', mousePosition.mouseY + 'px')
.style('opacity', 0)
.style('z-index', '1')
.style('position', 'absolute');
div.transition().duration(200).style('opacity', 0.8);
})
Expand Down
24 changes: 18 additions & 6 deletions src/dataParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { DataFrameView, Field, getFieldDisplayName, Vector } from '@grafana/data
* @return {valueField[0]}
*/
export function parseData(data: { series: any[] }, options: { valueField: any }, monochrome: boolean, color: any) {
const valueFieldName = options.valueField;


/**
* Colors
Expand Down Expand Up @@ -126,13 +126,25 @@ export function parseData(data: { series: any[] }, options: { valueField: any },
});

// Find selected value field or default to the first number field and use for values.
const valueField = valueFieldName
? data.series.map((series: { fields: any[] }) =>
series.fields.find((field: { name: any }) => field.name === valueFieldName)
)
: data.series.map((series: { fields: any[] }) =>
// const valueFieldName = options.valueField;
// const valueField = options.valueField
// ? data.series.map((series: { fields: any[] }) =>
// series.fields.find((field: { name: any }) => field.name === options.valueField)
// )
// : data.series.map((series: { fields: any[] }) =>
// series.fields.find((field: { type: string }) => field.type === 'number')
// );
// Fix to avoid erroring out when value field is hidden by transform
let valueField = data.series.map((series: { fields: any[] }) =>
series.fields.find((field: { name: any }) => field.name === options.valueField)
)
if(!valueField[0]) {
valueField = data.series.map((series: { fields: any[] }) =>
series.fields.find((field: { type: string }) => field.type === 'number')
);
}



let values = [];
valueField[0].values.map((value: any) => {
Expand Down
Loading