mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
NodeGraph: Fix rendering issues when values of arc are over 1 (#57460)
This commit is contained in:
parent
6ee69853dc
commit
67aa99af78
@ -123,7 +123,7 @@ export const Node = memo(function Node(props: {
|
||||
*/
|
||||
function ColorCircle(props: { node: NodeDatum }) {
|
||||
const { node } = props;
|
||||
const fullStat = node.arcSections.find((s) => s.values.get(node.dataFrameRowIndex) === 1);
|
||||
const fullStat = node.arcSections.find((s) => s.values.get(node.dataFrameRowIndex) >= 1);
|
||||
const theme = useTheme2();
|
||||
|
||||
if (fullStat) {
|
||||
@ -159,6 +159,7 @@ function ColorCircle(props: { node: NodeDatum }) {
|
||||
(acc, section) => {
|
||||
const color = section.config.color?.fixedColor || '';
|
||||
const value = section.values.get(node.dataFrameRowIndex);
|
||||
|
||||
const el = (
|
||||
<ArcSection
|
||||
key={color}
|
||||
@ -166,7 +167,13 @@ function ColorCircle(props: { node: NodeDatum }) {
|
||||
x={node.x!}
|
||||
y={node.y!}
|
||||
startPercent={acc.percent}
|
||||
percent={value}
|
||||
percent={
|
||||
value + acc.percent > 1
|
||||
? // If the values aren't correct and add up to more than 100% lets still render correctly the amounts we
|
||||
// already have and cap it at 100%
|
||||
1 - acc.percent
|
||||
: value
|
||||
}
|
||||
color={theme.visualization.getColorByName(color)}
|
||||
strokeWidth={2}
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user