This repository has been archived by the owner on Apr 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KIALI-529 refactor table and use bar chart instead of pie chart in su…
…mmary panel
- Loading branch information
1 parent
dc4be77
commit 21e7df6
Showing
6 changed files
with
237 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import * as React from 'react'; | ||
import { StackedBarChart } from 'patternfly-react'; | ||
|
||
type InOutRateChartPropType = { | ||
percent2xxIn: number; | ||
percent3xxIn: number; | ||
percent4xxIn: number; | ||
percent5xxIn: number; | ||
percent2xxOut: number; | ||
percent3xxOut: number; | ||
percent4xxOut: number; | ||
percent5xxOut: number; | ||
height?: number; | ||
showLegend?: boolean; | ||
legendPos?: string; // e.g. right, left | ||
}; | ||
|
||
export default class InOutRateChart extends React.Component<InOutRateChartPropType> { | ||
static defaultProps: InOutRateChartPropType = { | ||
percent2xxIn: 0, | ||
percent3xxIn: 0, | ||
percent4xxIn: 0, | ||
percent5xxIn: 0, | ||
percent2xxOut: 0, | ||
percent3xxOut: 0, | ||
percent4xxOut: 0, | ||
percent5xxOut: 0, | ||
height: 150, | ||
showLegend: true, | ||
legendPos: 'bottom' | ||
}; | ||
|
||
constructor(props: InOutRateChartPropType) { | ||
super(props); | ||
} | ||
|
||
render() { | ||
return ( | ||
<StackedBarChart | ||
size={{ height: this.props.height }} | ||
legend={{ show: this.props.showLegend, position: this.props.legendPos }} | ||
grid={{ | ||
x: { | ||
show: false | ||
}, | ||
y: { | ||
show: true | ||
} | ||
}} | ||
axis={{ | ||
rotated: true, | ||
x: { | ||
categories: ['In', 'Out'], | ||
type: 'category' | ||
}, | ||
y: { | ||
show: true, | ||
inner: false, | ||
label: { | ||
text: '%', | ||
position: 'inner-right' | ||
}, | ||
min: 0, | ||
max: 100, | ||
tick: { | ||
values: [0, 25, 50, 75, 100] | ||
}, | ||
padding: { | ||
top: 20, | ||
bottom: 0 | ||
} | ||
} | ||
}} | ||
data={{ | ||
groups: [['OK', '3xx', '4xx', '5xx']], | ||
columns: [ | ||
['OK', this.props.percent2xxIn, this.props.percent2xxOut], | ||
['3xx', this.props.percent3xxIn, this.props.percent3xxOut], | ||
['4xx', this.props.percent4xxIn, this.props.percent4xxOut], | ||
['5xx', this.props.percent5xxIn, this.props.percent5xxOut] | ||
], | ||
// order: 'asc', | ||
colors: { | ||
OK: '#3f9c35', // pf-green-400 | ||
'3xx': '#0088ce', // pf-blue-400 | ||
'4xx': '#ec7a08', // pf-orange-400 | ||
'5xx': '#cc0000' // pf-red-100 | ||
} | ||
}} | ||
/> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import * as React from 'react'; | ||
import { StackedBarChart } from 'patternfly-react'; | ||
|
||
type RateChartPropType = { | ||
percent2xx: number; | ||
percent3xx: number; | ||
percent4xx: number; | ||
percent5xx: number; | ||
height?: number; | ||
showLegend?: boolean; | ||
legendPos?: string; // e.g. right, left | ||
}; | ||
|
||
export default class RateChart extends React.Component<RateChartPropType> { | ||
static defaultProps: RateChartPropType = { | ||
percent2xx: 0, | ||
percent3xx: 0, | ||
percent4xx: 0, | ||
percent5xx: 0, | ||
height: 100, | ||
showLegend: true, | ||
legendPos: 'bottom' | ||
}; | ||
|
||
constructor(props: RateChartPropType) { | ||
super(props); | ||
} | ||
|
||
render() { | ||
return ( | ||
<StackedBarChart | ||
size={{ height: this.props.height }} | ||
legend={{ show: this.props.showLegend, position: this.props.legendPos }} | ||
grid={{ | ||
x: { | ||
show: false | ||
}, | ||
y: { | ||
show: true | ||
} | ||
}} | ||
axis={{ | ||
rotated: true, | ||
x: { | ||
categories: [''], | ||
type: 'category' | ||
}, | ||
y: { | ||
show: true, | ||
inner: false, | ||
label: { | ||
text: '%', | ||
position: 'inner-right' | ||
}, | ||
min: 0, | ||
max: 100, | ||
tick: { | ||
values: [0, 25, 50, 75, 100] | ||
}, | ||
padding: { | ||
top: 20, | ||
bottom: 0 | ||
} | ||
} | ||
}} | ||
data={{ | ||
groups: [['OK', '3xx', '4xx', '5xx']], | ||
columns: [ | ||
['OK', this.props.percent2xx], | ||
['3xx', this.props.percent3xx], | ||
['4xx', this.props.percent4xx], | ||
['5xx', this.props.percent5xx] | ||
], | ||
// order: 'asc', | ||
colors: { | ||
OK: '#3f9c35', // pf-green-400 | ||
'3xx': '#0088ce', // pf-blue-400 | ||
'4xx': '#ec7a08', // pf-orange-400 | ||
'5xx': '#cc0000' // pf-red-100 | ||
} | ||
}} | ||
/> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters