-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
196de90
commit 9d3c516
Showing
14 changed files
with
595 additions
and
186 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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
107 changes: 107 additions & 0 deletions
107
site/src/components/home/statistics/areachart/style.jsx
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,107 @@ | ||
const areaChartStyle = theme => ({ | ||
root: { | ||
"display": "flex", | ||
"flex-direction": "column", | ||
"flex-wrap": "wrap", | ||
"align-content": "flex-start", | ||
"justify-content": "flex-start", | ||
"align-items": "stretch" | ||
}, | ||
header: { | ||
"display": "flex", | ||
"flex-direction": "column", | ||
"flex-wrap": "nowrap", | ||
"justify-content": "center", | ||
"align-items": "stretch" | ||
}, | ||
headerLine: { | ||
"display": "flex", | ||
"flex-direction": "row", | ||
"flex-wrap": "nowrap", | ||
"justify-content": "space-between", | ||
"align-items": "center", | ||
"width": "100%", | ||
"color": theme.palette.text.primary | ||
}, | ||
headerField: { | ||
"display": "flex", | ||
"flex-direction": "row", | ||
"flex-wrap": "nowrap", | ||
"justify-content": "center", | ||
"align-items": "center", | ||
"width": "inherit", | ||
"color": theme.palette.text.secondary | ||
}, | ||
stats: { | ||
"display": "flex", | ||
"flex-direction": "row", | ||
"flex-wrap": "nowrap", | ||
"justify-content": "center", | ||
"align-items": "center", | ||
"padding": "0px", | ||
"color": theme.palette.text.secondary | ||
}, | ||
stat: { | ||
"display": "flex", | ||
"padding": "0px", | ||
"flex-wrap": "nowrap", | ||
"align-items": "center", | ||
"flex-direction": "row", | ||
"justify-content": "center" | ||
}, | ||
tooltipContent: { | ||
"display": "flex", | ||
"flex-direction": "column", | ||
"flex-wrap": "nowrap", | ||
"align-content": "center", | ||
"justify-content": "center", | ||
"align-items": "stretch", | ||
"background-color": "black", | ||
"padding": "5px" | ||
}, | ||
tooltipHeader: { | ||
"font-size": "medium", | ||
"display": "flex", | ||
"flex-direction": "column", | ||
"flex-wrap": "nowrap", | ||
"align-content": "center", | ||
"align-items": "center", | ||
"justify-content": "center", | ||
"border-bottom": "solid 1px" | ||
}, | ||
threads: { | ||
"margin": "0px", | ||
"padding": "0px", | ||
"display": "flex", | ||
"flex-direction": "column", | ||
"flex-wrap": "nowrap", | ||
"align-content": "center", | ||
"justify-content": "center", | ||
"align-items": "stretch", | ||
"font-size": "small", | ||
}, | ||
thread: { | ||
"display": "flex", | ||
"flex-direction": "row", | ||
"flex-wrap": "nowrap", | ||
"align-content": "center", | ||
"justify-content": "space-between", | ||
"align-items": "center", | ||
"column-gap": "5px", | ||
}, | ||
threadValue: { | ||
"display": "flex", | ||
"flex-direction": "row", | ||
"flex-wrap": "nowrap", | ||
"align-content": "center", | ||
"justify-content": "center", | ||
"align-items": "center", | ||
"font-size": "smaller", | ||
"color": "aquamarine", | ||
"column-gap": "3px" | ||
}, | ||
threadSummary: { | ||
"font-size": "x-small", | ||
"color": "aqua" | ||
} | ||
}); |
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,51 @@ | ||
const BarStat = withStyles(barChartStyle)(props => { | ||
const { classes, name, rawvalue, ignored, statsAnimateChange , idleField, category, detail } = props; | ||
const theme = useTheme(); | ||
|
||
const getFillColor = ({step, isIdle}) => { | ||
if (isIdle) { | ||
return theme.palette.taskManager.idleColor; | ||
} | ||
return (theme.palette.taskManager[`${category === "Memory" ? "b" : ""}color${step+1}`]); | ||
} | ||
|
||
return ( | ||
<Box className={`${classes.summary} ${!detail && classes.minimized}`}> | ||
<BarChart | ||
height={detail ? 300 : 80} | ||
width={detail ? 150 : 100} | ||
data={[Object.entries(rawvalue) | ||
.filter(entry=>!["name",...ignored].includes(entry[0])) | ||
.reduce((ret,entry)=>{ret[entry[0]] = entry[1]; return ret},{name:name})]} | ||
margin={{ | ||
top: 20, | ||
right: 30, | ||
left: 20, | ||
bottom: 5}}> | ||
<XAxis hide={true} dataKey="name" /> | ||
<YAxis hide={true} /> | ||
{Object.keys(rawvalue) | ||
.filter(field => !ignored.includes(field)) | ||
.sort(sortStats) | ||
.map((field,idx) => <Bar dataKey={field} | ||
key={field} | ||
stackId="a" | ||
fill={getFillColor({step: idx, isIdle: field === idleField})} | ||
isAnimationActive={statsAnimateChange} | ||
type="monotone" | ||
fillOpacity={1}/>) | ||
} | ||
</BarChart> | ||
<Typography variant="summary">{(Object.entries(rawvalue) | ||
.filter(entry => ![idleField,...ignored].includes(entry[0])) | ||
.reduce((ret,stat)=>ret+stat[1],0.0)/ | ||
Object.entries(rawvalue) | ||
.filter(entry => !ignored.includes(entry[0])) | ||
.reduce((ret,stat)=>ret+stat[1],0.0)*100).toFixed(0)}%</Typography> | ||
</Box>) | ||
|
||
function sortStats(a, b) { | ||
return a === idleField && b !== idleField ? 1 : (a !== idleField && b === idleField ? -1 : a.localeCompare(b)); | ||
} | ||
}); | ||
|
10 changes: 7 additions & 3 deletions
10
...omponents/home/statistics/chart/style.jsx → ...onents/home/statistics/barchart/style.jsx
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
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
Oops, something went wrong.