Skip to content

Commit

Permalink
Merge pull request #348 from ahinvinith/main
Browse files Browse the repository at this point in the history
Fix: Apache ECharts Panel Issues in Grafana Dashboard
  • Loading branch information
jebjohns authored Apr 9, 2024
2 parents 052ac6c + 711d73e commit 87457b8
Show file tree
Hide file tree
Showing 19 changed files with 659 additions and 246 deletions.
2 changes: 1 addition & 1 deletion charts/client/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.1.23
version: 1.1.24

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
53 changes: 43 additions & 10 deletions charts/client/templates/configmap-azure-dashboard.yaml

Large diffs are not rendered by default.

42 changes: 33 additions & 9 deletions charts/client/templates/configmap-bitbucket-dashboard.yaml

Large diffs are not rendered by default.

55 changes: 42 additions & 13 deletions charts/client/templates/configmap-gitea-dashboard.yaml

Large diffs are not rendered by default.

62 changes: 51 additions & 11 deletions charts/client/templates/configmap-github-dashboard.yaml

Large diffs are not rendered by default.

41 changes: 33 additions & 8 deletions charts/client/templates/configmap-gitlab-dashboard.yaml

Large diffs are not rendered by default.

71 changes: 60 additions & 11 deletions charts/client/templates/configmap-kubedata-dashboard.yaml

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions charts/client/templates/configmap-kuberhealthy-dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ data:
"key": "",
"plugin": "AMap.Scale,AMap.ToolBar"
},
"getOption": "let option; // Initialize the option variable\n\nif (typeof data === 'undefined' || !data.series || !data.series[0] || !data.series[0].fields) {\n // Data is not available or doesn't have the expected structure\n option = {\n title: {\n text: 'Data not available',\n textStyle: {\n fontSize: 24,\n fontWeight: 'bold',\n },\n left: 'center',\n top: 'middle',\n },\n };\n} else {\n // Extract data from your JSON as before\n const namespaces = data.series[0].fields[0].values;\n const counts = data.series[0].fields[1].values;\n\n // Create a hierarchical structure from the data with a default cluster node\n const hierarchy = {\n name: 'CheckName', // Default cluster node\n children: [],\n };\n\n // Create an object to store namespaces and their counts\n const namespaceCounts = {};\n\n // Populate the namespaceCounts object with namespaces and counts\n for (let i = 0; i < namespaces.length; i++) {\n const namespace = namespaces[i];\n const count = counts[i];\n\n if (!namespaceCounts[namespace]) {\n namespaceCounts[namespace] = count;\n } else {\n namespaceCounts[namespace] += count;\n }\n }\n\n // Create nodes for each namespace and add them as children of the default cluster node\n for (const namespace in namespaceCounts) {\n hierarchy.children.push({\n name: namespace,\n children: [{ name: `${namespaceCounts[namespace]}` }],\n });\n }\n\n // Create the tree chart using ECharts\n option = {\n tooltip: {\n trigger: 'item',\n triggerOn: 'mousemove',\n formatter: function (params) {\n const node = params.data;\n let tooltip = '';\n if (node.column) {\n tooltip += `${node.column}: ${node.name}`;\n } else {\n tooltip += node.name;\n }\n return tooltip;\n },\n },\n series: [\n {\n type: 'tree',\n data: [hierarchy], // Use the hierarchy object as the data\n top: '1%',\n left: '7%',\n bottom: '1%',\n right: '20%',\n symbolSize: 7,\n label: {\n position: 'left',\n verticalAlign: 'middle',\n align: 'centre',\n fontSize: 15, // Increase the text size for regular nodes\n fontWeight: 'bold', // Set the font weight to bold\n },\n leaves: {\n label: {\n position: 'right',\n verticalAlign: 'middle',\n align: 'left',\n fontSize: 15, // Increase the text size for leaves\n fontWeight: 'bold', // Set the font weight to bold\n },\n },\n emphasis: {\n focus: 'descendant',\n },\n expandAndCollapse: true,\n animationDuration: 550,\n animationDurationUpdate: 750,\n },\n ],\n };\n}\n\nreturn option;\n",
"getOption": "let option; // Initialize the option variable\n\nif (typeof context.panel.data === 'undefined' || !context.panel.data.series || !context.panel.data.series[0] || !context.panel.data.series[0].fields) {\n // Data is not available or doesn't have the expected structure\n option = {\n title: {\n text: 'Data not available',\n textStyle: {\n fontSize: 24,\n fontWeight: 'bold',\n },\n left: 'center',\n top: 'middle',\n },\n };\n} else {\n // Extract data from your JSON as before\n const namespaces = context.panel.data.series[0].fields[0].values;\n const counts = context.panel.data.series[0].fields[1].values;\n\n // Create a hierarchical structure from the data with a default cluster node\n const hierarchy = {\n name: 'CheckName', // Default cluster node\n children: [],\n };\n\n // Create an object to store namespaces and their counts\n const namespaceCounts = {};\n\n // Populate the namespaceCounts object with namespaces and counts\n for (let i = 0; i < namespaces.length; i++) {\n const namespace = namespaces[i];\n const count = counts[i];\n\n if (!namespaceCounts[namespace]) {\n namespaceCounts[namespace] = count;\n } else {\n namespaceCounts[namespace] += count;\n }\n }\n\n // Create nodes for each namespace and add them as children of the default cluster node\n for (const namespace in namespaceCounts) {\n hierarchy.children.push({\n name: namespace,\n children: [{ name: `${namespaceCounts[namespace]}` }],\n });\n }\n\n // Create the tree chart using ECharts\n option = {\n tooltip: {\n trigger: 'item',\n triggerOn: 'mousemove',\n formatter: function (params) {\n const node = params.data;\n let tooltip = '';\n if (node.column) {\n tooltip += `${node.column}: ${node.name}`;\n } else {\n tooltip += node.name;\n }\n return tooltip;\n },\n },\n series: [\n {\n type: 'tree',\n data: [hierarchy], // Use the hierarchy object as the data\n top: '1%',\n left: '7%',\n bottom: '1%',\n right: '20%',\n symbolSize: 7,\n label: {\n position: 'left',\n verticalAlign: 'middle',\n align: 'centre',\n fontSize: 15, // Increase the text size for regular nodes\n fontWeight: 'bold', // Set the font weight to bold\n },\n leaves: {\n label: {\n position: 'right',\n verticalAlign: 'middle',\n align: 'left',\n fontSize: 15, // Increase the text size for leaves\n fontWeight: 'bold', // Set the font weight to bold\n },\n },\n emphasis: {\n focus: 'descendant',\n },\n expandAndCollapse: true,\n animationDuration: 550,\n animationDurationUpdate: 750,\n },\n ],\n };\n}\n\nreturn option;\n",
"google": {
"callback": "gmapReady",
"key": ""
Expand Down Expand Up @@ -124,7 +124,7 @@ data:
"key": "",
"plugin": "AMap.Scale,AMap.ToolBar"
},
"getOption": "let option; // Initialize the option variable\n\nif (typeof data === 'undefined' || !data.series || !data.series[0] || !data.series[0].fields) {\n // Data is not available or doesn't have the expected structure\n option = {\n title: {\n text: 'Data not available',\n textStyle: {\n fontSize: 24,\n fontWeight: 'bold',\n },\n left: 'center',\n top: 'middle',\n },\n };\n} else {\n // Extract data from your JSON as before\n const namespaces = data.series[0].fields[0].values;\n const counts = data.series[0].fields[1].values;\n\n // Create a hierarchical structure from the data with a default cluster node\n const hierarchy = {\n name: 'CheckName', // Default cluster node\n children: [],\n };\n\n // Create an object to store namespaces and their counts\n const namespaceCounts = {};\n\n // Populate the namespaceCounts object with namespaces and counts\n for (let i = 0; i < namespaces.length; i++) {\n const namespace = namespaces[i];\n const count = counts[i];\n\n if (!namespaceCounts[namespace]) {\n namespaceCounts[namespace] = count;\n } else {\n namespaceCounts[namespace] += count;\n }\n }\n\n // Create nodes for each namespace and add them as children of the default cluster node\n for (const namespace in namespaceCounts) {\n hierarchy.children.push({\n name: namespace,\n children: [{ name: `${namespaceCounts[namespace]}` }],\n });\n }\n\n // Create the tree chart using ECharts\n option = {\n tooltip: {\n trigger: 'item',\n triggerOn: 'mousemove',\n formatter: function (params) {\n const node = params.data;\n let tooltip = '';\n if (node.column) {\n tooltip += `${node.column}: ${node.name}`;\n } else {\n tooltip += node.name;\n }\n return tooltip;\n },\n },\n series: [\n {\n type: 'tree',\n data: [hierarchy], // Use the hierarchy object as the data\n top: '1%',\n left: '7%',\n bottom: '1%',\n right: '20%',\n symbolSize: 7,\n label: {\n position: 'left',\n verticalAlign: 'middle',\n align: 'centre',\n fontSize: 15, // Increase the text size for regular nodes\n fontWeight: 'bold', // Set the font weight to bold\n },\n leaves: {\n label: {\n position: 'right',\n verticalAlign: 'middle',\n align: 'left',\n fontSize: 15, // Increase the text size for leaves\n fontWeight: 'bold', // Set the font weight to bold\n },\n },\n emphasis: {\n focus: 'descendant',\n },\n expandAndCollapse: true,\n animationDuration: 550,\n animationDurationUpdate: 750,\n },\n ],\n };\n}\n\nreturn option;\n",
"getOption": "let option; // Initialize the option variable\n\nif (typeof context.panel.data === 'undefined' || !context.panel.data.series || !context.panel.data.series[0] || !context.panel.data.series[0].fields) {\n // Data is not available or doesn't have the expected structure\n option = {\n title: {\n text: 'Data not available',\n textStyle: {\n fontSize: 24,\n fontWeight: 'bold',\n },\n left: 'center',\n top: 'middle',\n },\n };\n} else {\n // Extract data from your JSON as before\n const namespaces = context.panel.data.series[0].fields[0].values;\n const counts = context.panel.data.series[0].fields[1].values;\n\n // Create a hierarchical structure from the data with a default cluster node\n const hierarchy = {\n name: 'CheckName', // Default cluster node\n children: [],\n };\n\n // Create an object to store namespaces and their counts\n const namespaceCounts = {};\n\n // Populate the namespaceCounts object with namespaces and counts\n for (let i = 0; i < namespaces.length; i++) {\n const namespace = namespaces[i];\n const count = counts[i];\n\n if (!namespaceCounts[namespace]) {\n namespaceCounts[namespace] = count;\n } else {\n namespaceCounts[namespace] += count;\n }\n }\n\n // Create nodes for each namespace and add them as children of the default cluster node\n for (const namespace in namespaceCounts) {\n hierarchy.children.push({\n name: namespace,\n children: [{ name: `${namespaceCounts[namespace]}` }],\n });\n }\n\n // Create the tree chart using ECharts\n option = {\n tooltip: {\n trigger: 'item',\n triggerOn: 'mousemove',\n formatter: function (params) {\n const node = params.data;\n let tooltip = '';\n if (node.column) {\n tooltip += `${node.column}: ${node.name}`;\n } else {\n tooltip += node.name;\n }\n return tooltip;\n },\n },\n series: [\n {\n type: 'tree',\n data: [hierarchy], // Use the hierarchy object as the data\n top: '1%',\n left: '7%',\n bottom: '1%',\n right: '20%',\n symbolSize: 7,\n label: {\n position: 'left',\n verticalAlign: 'middle',\n align: 'centre',\n fontSize: 15, // Increase the text size for regular nodes\n fontWeight: 'bold', // Set the font weight to bold\n },\n leaves: {\n label: {\n position: 'right',\n verticalAlign: 'middle',\n align: 'left',\n fontSize: 15, // Increase the text size for leaves\n fontWeight: 'bold', // Set the font weight to bold\n },\n },\n emphasis: {\n focus: 'descendant',\n },\n expandAndCollapse: true,\n animationDuration: 550,\n animationDurationUpdate: 750,\n },\n ],\n };\n}\n\nreturn option;\n",
"google": {
"callback": "gmapReady",
"key": ""
Expand Down Expand Up @@ -1210,7 +1210,8 @@ data:
"timezone": "",
"title": "KuberHealth",
"uid": "d946c53c-8b1d-4e3c-9154-4219165342",
"version": 2,
"version": 3,
"weekStart": ""
}
{{- end }}
Loading

0 comments on commit 87457b8

Please sign in to comment.