Skip to content

Commit 3e38774

Browse files
Merge pull request #3 from netsage-project/1.0.4
1.0.4
2 parents d789b10 + cd0521d commit 3e38774

14 files changed

Lines changed: 75 additions & 43 deletions

File tree

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ The panel will draw links from the first column of data points, to the last in o
1515

1616
## Customizing
1717
- **Links:** There are currently two options for link color: multi or single. It is multi-colored by default. To choose a single color for the links, toggle the "Single Link color only" option and choose your color from Grafana's color picker.
18-
- **Text:** You can change the color of the label text by changing the "Text color" option
1918
- **Nodes:** You can change the color of the rectangular nodes by changing the "Node color" option
2019
- **Node Width** The width of the nodes can be adjusted with the "Node Width" slider or entering a number in the input box. This number must be an integer.
2120
- **Node Padding** The vertical padding between nodes can be adjusted with the "Node Padding" slider or entering a number in the input box. This number must be an integer. If your links are too skinny, try adjusting this number

netsage-sankey-panel/MANIFEST.txt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,29 @@ Hash: SHA512
88
"signedByOrg": "netsage",
99
"signedByOrgName": "netsage",
1010
"plugin": "netsage-sankey-panel",
11-
"version": "1.0.3",
12-
"time": 1632508460398,
11+
"version": "1.0.4",
12+
"time": 1633020708865,
1313
"keyId": "7e4d0c6a708866e7",
1414
"files": {
1515
"LICENSE": "b40930bbcf80744c86c46a12bc9da056641d722716c378f5659b9e555ef833e1",
1616
"CHANGELOG.md": "aaa78be4710ef41d56ddab1edbd180ef9f9adfea2f293109aae925dc33a1b9b3",
17-
"module.js.map": "cf4245bbc6c423eecc8e462701ddfe51f195a78793c8db4eed4f12105d93e071",
18-
"plugin.json": "c20397edf44b45624d0c9c6a64707133d463962e5977f0b236556b430a78e360",
19-
"README.md": "c5b30b84e983ea9e852bf89379c95532760406bbfadd0174e1fcaac4fc87081d",
17+
"module.js.LICENSE.txt": "0d8f66cd4afb566cb5b7e1540c68f43b939d3eba12ace290f18abc4f4cb53ed0",
18+
"module.js.map": "92db609eccf14830dffb590e4806582b5627c3366698e44ef373ec72ccdecc19",
19+
"plugin.json": "4843f8978b95ca4e7155eb35da16a15111a22388bfbba4d7915582e7899f684e",
20+
"README.md": "496f8ee30c7497dca3ea9b0388b346e9e62569501d05ba83c7d73392c6da0327",
2021
"img/sankey2.png": "99651eceae6c3e99f6b0317f4eec4f7827d3d4c242b4f3a29d166a17f0e71cf8",
2122
"img/sankey3.png": "9ec6c9fd8df713ce384b96e13f300f123672b293034a448c99ac1f739c54e117",
2223
"img/logo.svg": "e1b79c50e08be2be3382fa42850209dc3a7496d56e60a45c4d8a1375a685e633",
23-
"module.js": "3951f47b8407b056356a3bd1597a6b0e8d8c5327d8fa1b7353c61083e3ce7ac1"
24+
"module.js": "1e7abcda57ec1d11b33c63618742a8e1f4af0720d89d1faffd2ed459e37ff815"
2425
}
2526
}
2627
-----BEGIN PGP SIGNATURE-----
2728
Version: OpenPGP.js v4.10.1
2829
Comment: https://openpgpjs.org
2930

30-
wqEEARMKAAYFAmFOGiwACgkQfk0ManCIZueAhgIIjtlOtZ/4qTe7cgKPAqeq
31-
Hasi/vflFVf6hHvd4qz8P5N+50SfwGlvEOokMcQ1geoD/6/E1cHq2tmM5Ice
32-
MN/7GAkCCQEiNhw+BBNccYQQpVUBbMXpz1Ox3fg9w7Ln0FBN+NpUi0tXM4jd
33-
q4yqkEaWBF2sqQsjwzI8qmdN/rCdtOOl2ZhcRw==
34-
=RYdi
31+
wqIEARMKAAYFAmFV6yUACgkQfk0ManCIZucd7AIJAb2IQfFfSVKcMfGS1OfW
32+
wGZEad7qpJTrdYK0kYkuKN9KVFaw6GKmb0Kq9JGQMQvJpgOkikNm7EcbbQzc
33+
XNG9OYHmAgkBYseZaPkAOUZS4bdCSiIS6i/h7X3RBLpVkRGdn3WKQQ9ojzon
34+
eeQ7JpUWWolI+G1FMNFgt5cOTM5H7Oo8ydI0B/Y=
35+
=5Co+
3536
-----END PGP SIGNATURE-----

netsage-sankey-panel/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ The panel will draw links from the first column of data points, to the last in o
1515

1616
## Customizing
1717
- **Links:** There are currently two options for link color: multi or single. It is multi-colored by default. To choose a single color for the links, toggle the "Single Link color only" option and choose your color from Grafana's color picker.
18-
- **Text:** You can change the color of the label text by changing the "Text color" option
1918
- **Nodes:** You can change the color of the rectangular nodes by changing the "Node color" option
2019
- **Node Width** The width of the nodes can be adjusted with the "Node Width" slider or entering a number in the input box. This number must be an integer.
2120
- **Node Padding** The vertical padding between nodes can be adjusted with the "Node Padding" slider or entering a number in the input box. This number must be an integer. If your links are too skinny, try adjusting this number

netsage-sankey-panel/module.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*! *****************************************************************************
2+
Copyright (c) Microsoft Corporation.
3+
4+
Permission to use, copy, modify, and/or distribute this software for any
5+
purpose with or without fee is hereby granted.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13+
PERFORMANCE OF THIS SOFTWARE.
14+
***************************************************************************** */

netsage-sankey-panel/module.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

netsage-sankey-panel/plugin.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
}
2626
],
2727
"screenshots": [{"name":"sankey2", "path":"img/sankey2.png"}, {"name":"sankey3", "path":"img/sankey3.png"}],
28-
"version": "1.0.3",
29-
"updated": "2021-09-24"
28+
"version": "1.0.4",
29+
"updated": "2021-09-30"
3030
},
3131
"dependencies": {
3232
"grafanaDependency": ">=7.0.3",

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.0.3",
3+
"version": "1.0.4",
44
"description": "Sankey Panel Plugin for Grafana",
55
"license": "Apache-2.0",
66
"repository": "https://github.com/netsage-project/netsage-sankey-panel",

src/SankeyPanel.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import React from 'react';
2-
// import React, { useRef } from 'react';
32
import { PanelProps } from '@grafana/data';
43
import { SankeyOptions } from 'types';
54
import { parseData } from 'dataParser';
65
import { Sankey } from './components/Sankey';
7-
// import * as d3 from 'd3';
8-
// import * as d3Sankey from 'd3-sankey';
6+
import { useTheme2 } from '@grafana/ui';
97

108
interface Props extends PanelProps<SankeyOptions> {}
119
/**
@@ -18,6 +16,7 @@ export const SankeyPanel: React.FC<Props> = ({ options, data, width, height, id
1816
let graphOptions = {
1917
...options,
2018
};
19+
const theme = useTheme2();
2120
/**
2221
* Feed data and options into data parser.
2322
* @param {*} { data, options }
@@ -34,7 +33,8 @@ export const SankeyPanel: React.FC<Props> = ({ options, data, width, height, id
3433
const rowDisplayNames = parsedData[2];
3534
const field = parsedData[3];
3635
const fixColor = parsedData[4];
37-
const textColor = fixColor(graphOptions.textColor);
36+
// const textColor = fixColor(graphOptions.textColor);
37+
const textColor = theme.colors.text.primary;
3838
const nodeColor = fixColor(graphOptions.nodeColor);
3939

4040
return (

src/components/Node.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import { useTheme2 } from '@grafana/ui';
23

34
interface NodeProps {
45
data: any;
@@ -16,6 +17,8 @@ interface NodeProps {
1617
* @return {*} the node and its label
1718
*/
1819
export const Node: React.FC<NodeProps> = ({ data, textColor, nodeColor, panelId }) => {
20+
const theme = useTheme2();
21+
1922
let x0 = data.x0;
2023
let x1 = data.x1;
2124
let y0 = data.y0;
@@ -26,6 +29,7 @@ export const Node: React.FC<NodeProps> = ({ data, textColor, nodeColor, panelId
2629

2730
const width = x1 - x0;
2831
const strokeColor = 'black';
32+
const fontSize = theme.typography.fontSize;
2933

3034
return (
3135
<>
@@ -49,7 +53,7 @@ export const Node: React.FC<NodeProps> = ({ data, textColor, nodeColor, panelId
4953
style={{
5054
fill: textColor,
5155
alignmentBaseline: 'middle',
52-
fontSize: 16,
56+
fontSize: fontSize,
5357
textAnchor: x0 < width / 2 ? 'start' : 'end',
5458
pointerEvents: 'none',
5559
userSelect: 'none',

0 commit comments

Comments
 (0)