-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add flow efficiency chart to status report
- Loading branch information
Showing
5 changed files
with
124 additions
and
101 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,7 +90,7 @@ | |
], | ||
"max-statements": [ | ||
"error", | ||
44 | ||
27 | ||
] | ||
} | ||
}, | ||
|
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
62 changes: 62 additions & 0 deletions
62
app/spa/src/pages/Projects/Charts/ProjectFlowEfficiency.tsx
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,62 @@ | ||
import { ChartGridItem } from "../../../components/charts/ChartGridItem" | ||
import { LineChart } from "../../../components/charts/LineChart" | ||
import { Project } from "../../../modules/project/project.types" | ||
import { useTranslation } from "react-i18next" | ||
import { SliceTooltipProps } from "@nivo/line" | ||
import LineChartTooltip from "../../../components/charts/tooltips/LineChartTooltip" | ||
|
||
const ProjectFlowEfficiency = ({ project }: ProjectFlowEfficiencyProps) => { | ||
const { t } = useTranslation(["projectChart"]) | ||
|
||
const projectConsolidationsWeekly = project.projectConsolidationsWeekly | ||
const flowEfficiencyChartData = [ | ||
{ | ||
id: project.name || "", | ||
data: | ||
projectConsolidationsWeekly?.map( | ||
({ consolidationDate, flowEfficiency }) => { | ||
return { | ||
x: consolidationDate, | ||
y: flowEfficiency, | ||
} | ||
} | ||
) || [], | ||
}, | ||
] | ||
|
||
return ( | ||
<ChartGridItem title={t("chartsTab.projectCharts.flow_efficiency_chart")}> | ||
<LineChart | ||
data={flowEfficiencyChartData} | ||
axisLeftLegend={"%"} | ||
props={{ | ||
margin: { left: 80, right: 20, top: 25, bottom: 65 }, | ||
axisBottom: { | ||
tickSize: 5, | ||
tickPadding: 5, | ||
legendPosition: "middle", | ||
legendOffset: 60, | ||
tickRotation: -40, | ||
legend: t("chartsTab.projectCharts.hours_consumed_x_label"), | ||
}, | ||
yFormat: (value: number) => `${value}%`, | ||
enableSlices: "x", | ||
sliceTooltip: ({ slice }: SliceTooltipProps) => ( | ||
<LineChartTooltip | ||
slice={slice} | ||
xLabel={t( | ||
"chartsTab.projectCharts.flow_efficiency_tooltip_label" | ||
)} | ||
/> | ||
), | ||
}} | ||
/> | ||
</ChartGridItem> | ||
) | ||
} | ||
|
||
type ProjectFlowEfficiencyProps = { | ||
project: Project | ||
} | ||
|
||
export default ProjectFlowEfficiency |
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